[PATCH] storescp: add --exec-sync for Unix

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
eludias
Posts: 6
Joined: Tue, 2005-08-30, 16:18

[PATCH] storescp: add --exec-sync for Unix

#1 Post by eludias »

Hi,

My previous patch added --exec-sync for Windows. This one also adds it to Unix. Tested on Linux.

The actual patch is quite small since the required infrastructure was already in place. Actually, --exec-sync was already the default for Unix.

Code: Select all

diff --git a/dcmnet/apps/storescp.cc b/dcmnet/apps/storescp.cc
index cf6c40b..39b6e50 100644
--- a/dcmnet/apps/storescp.cc
+++ b/dcmnet/apps/storescp.cc
@@ -191,8 +191,8 @@ OFBool             opt_forkMode = OFFalse;
 
 #ifdef _WIN32
 OFBool             opt_forkedChild = OFFalse;
-OFBool             opt_execSync = OFFalse;            // default: execute in background
 #endif
+OFBool             opt_execSync = OFFalse;            // default: execute in background
 
 #ifdef WITH_OPENSSL
 static int         opt_keyFileFormat = SSL_FILETYPE_PEM;
@@ -391,9 +391,7 @@ int main(int argc, char *argv[])
     cmd.addOption(  "--rename-on-eostudy",      "-rns",      "(only w/ -ss) Having received and processed\nall C-STORE-Request messages that belong to\none study, rename output files according to\na certain pattern" );
     cmd.addOption(  "--eostudy-timeout",        "-tos",  1,  "[t]imeout: integer (only w/ -ss, -xcs or -rns)",
                                                              "specifies a timeout of t seconds for\nend-of-study determination" );
-#ifdef _WIN32
     cmd.addOption(  "--exec-sync",              "-xs",       "execute command synchronously in foreground" );
-#endif
 
 #ifdef WITH_OPENSSL
   cmd.addGroup("transport layer security (TLS) options:");
@@ -806,9 +804,7 @@ int main(int argc, char *argv[])
       app.checkValue(cmd.getValueAndCheckMin(opt_endOfStudyTimeout, 0));
     }
 
-#ifdef _WIN32
     if (cmd.findOption("--exec-sync")) opt_execSync = OFTrue;
-#endif
 
   }
 
@@ -2318,7 +2314,7 @@ static void executeCommand( const OFString &cmd )
   {
     /* we are the parent process */
     /* remove pending zombie child processes */
-    cleanChildren(pid, OFTrue);
+    cleanChildren(pid, opt_execSync);
   }
   else // in case we are the child process, execute the command etc.
   {
diff --git a/dcmnet/docs/storescp.man b/dcmnet/docs/storescp.man
index 9588ca6..a15f7a4 100644
--- a/dcmnet/docs/storescp.man
+++ b/dcmnet/docs/storescp.man
@@ -270,7 +270,6 @@ filename generation:
 
   -xs   --exec-sync
           execute command synchronously in foreground.
-          This option is available on Windows only.
 
 \endverbatim
 


Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Thank you for your contribution. We've added another entry to our internal to-do-list :-)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest