programs/wcmd: wcmd-1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This small change to wcmd allows us to use "wcmd /c <command>" from other
applications. Basically, it skips the initialisation of the console and uses
the current STDIN and STDOUT handles for output instead of allocating a new
console which will return immediately. 

The benefit of this is that we can pipe commands to and read piped output
from the interpreter.

License:
LGPL

Changelog:
* programs/wcmd/wcmdmain.c: Jaco Greeff <jaco@puxedo.org>
- Skip the allocation of a new console on "wcmd /c <command>" execution,
using the current allocated STDIN and STDOUT handles for command input/output


--[ inline diff ]--


diff -aurN wcmd.orig/programs/wcmd/wcmdmain.c wcmd.new/programs/wcmd/wcmdmain.c
--- wcmd.orig/programs/wcmd/wcmdmain.c	2002-11-02 16:51:02.000000000 +0000
+++ wcmd.new/programs/wcmd/wcmdmain.c	2002-11-02 16:56:10.000000000 +0000
@@ -67,6 +67,16 @@
     }
   }

+  /* If we do a "wcmd /c command", we don't want to allocate a new
+   * console since the command returns immediately. Rather, we use
+   * the surrently allocated input and output handles. This allows
+   * us to pipe to and read from the command interpreter.
+   */
+  if (strstr(args, "/c") != NULL) {
+    WCMD_process_command (param);
+    return 0;
+  }
+
 /*
  *	Allocate a console and set it up.
  */
@@ -87,11 +97,6 @@
     WCMD_echo ("OFF");
   }
 
-  if (strstr(args, "/c") != NULL) {
-    WCMD_process_command (param);
-    return 0;
-  }
-
   if (strstr(args, "/k") != NULL) {
     WCMD_process_command (param);
   }




[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux