]> granicus.if.org Git - apache/commitdiff
Add a timeout option to wintty. This allows the user to specify a number
authorRyan Bloom <rbb@apache.org>
Fri, 21 Jun 2002 18:49:11 +0000 (18:49 +0000)
committerRyan Bloom <rbb@apache.org>
Fri, 21 Jun 2002 18:49:11 +0000 (18:49 +0000)
of seconds to wait after the program terminates before closing the window.
Previously, the windows would remain open indefinately.  This option is
not currently being used by Apache.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95836 13f79535-47bb-0310-9956-ffa450edef68

support/win32/wintty.c

index 638ac5a3711ef3e0b7c33f876b7ce2fdde27912f..47b0be485bc39dd0ff52338d0e7bc700281558de 100644 (file)
@@ -83,6 +83,7 @@ const char *options =
 "\t-u{nprocessed} or -p{rocessed} input\n"
 "\t-n{owrap}      or -w{rap} output lines\n"
 "\t-f{ormatted}   or -r{aw} output lines\n"
+"\t-O{output} [number of seconds]\n"
 "\t-v{erbose} error reporting (for debugging)\n"
 "\t-? for this message\n\n";
 
@@ -120,6 +121,7 @@ int main(int argc, char** argv)
     DWORD newoutmode = 0, notoutmode = 0;
     DWORD tid;
     DWORD len;
+    DWORD timeout = INFINITE;
     BOOL isservice = FALSE;
     char *arg0 = argv[0];
 
@@ -147,6 +149,16 @@ int main(int argc, char** argv)
                     notoutmode |= ENABLE_PROCESSED_OUTPUT;   break;
                 case 'f':
                     newoutmode |= ENABLE_PROCESSED_OUTPUT;   break;
+                case 'o':
+                    if (*(argv + 1) && *(argv + 1)[0] != '-') {
+                        *(++argv);
+                        timeout = atoi(*argv) / 1000;
+                        --argc;
+                    }
+                    else {
+                        timeout = 0;
+                    }  
+                    break;
                 case 'v':
                     verbose = TRUE;
                     break;
@@ -358,7 +370,7 @@ int main(int argc, char** argv)
         }
     }
 
-    WaitForSingleObject(thread, INFINITE);
+    WaitForSingleObject(thread, timeout);
     FreeConsole();
     if (isservice) {
         if (!SetProcessWindowStation(hsavewinsta)) {