Christian Costa : cmd: Launch the command with the /? option for external commands shipped with cmd.exe.

Alexandre Julliard julliard at winehq.org
Wed Sep 7 12:35:28 CDT 2011


Module: wine
Branch: master
Commit: ccbae4fa6e17b2bb50b8cff89c9a65f9742e0285
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ccbae4fa6e17b2bb50b8cff89c9a65f9742e0285

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Wed Sep  7 09:10:06 2011 +0200

cmd: Launch the command with the /? option for external commands shipped with cmd.exe.

---

 programs/cmd/builtins.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 7063eb7..1320b32 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -67,6 +67,10 @@ static const WCHAR parmY[] = {'/','Y','\0'};
 static const WCHAR parmNoY[] = {'/','-','Y','\0'};
 static const WCHAR nullW[] = {'\0'};
 
+const WCHAR externals[][10] = {
+        {'A','T','T','R','I','B','\0'}
+};
+
 /**************************************************************************
  * WCMD_ask_confirm
  *
@@ -1330,6 +1334,7 @@ void WCMD_give_help (const WCHAR *command) {
     WCMD_output_asis (WCMD_LoadMessage(WCMD_ALLHELP));
   }
   else {
+    /* Display help message for builtin command */
     for (i=0; i<=WCMD_EXIT; i++) {
       if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
 	  command, -1, inbuilt[i], -1) == CSTR_EQUAL) {
@@ -1337,6 +1342,18 @@ void WCMD_give_help (const WCHAR *command) {
 	return;
       }
     }
+    /* Launch the command with the /? option for external commands shipped with cmd.exe */
+    for (i = 0; i <= (sizeof(externals)/sizeof(externals[0])); i++) {
+      if (CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
+	  command, -1, externals[i], -1) == CSTR_EQUAL) {
+        WCHAR cmd[128];
+        static const WCHAR helpW[] = {' ', '/','?','\0'};
+        strcpyW(cmd, command);
+        strcatW(cmd, helpW);
+        WCMD_run_program(cmd, 0);
+        return;
+      }
+    }
     WCMD_output (WCMD_LoadMessage(WCMD_NOCMDHELP), command);
   }
   return;




More information about the wine-cvs mailing list