[PATCH 2/2] cmd: Launch the command with the /? option for external commands shipped with cmd.exe
Christian Costa
titan.costa at wanadoo.fr
Wed Sep 7 02:10:06 CDT 2011
---
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..3d608bd 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];
+ WCHAR space_slashdot_ask[] = {' ', '/','?','\0'};
+ strcpyW(cmd, command);
+ strcatW(cmd, space_slashdot_ask);
+ WCMD_run_program(cmd, 0);
+ return;
+ }
+ }
WCMD_output (WCMD_LoadMessage(WCMD_NOCMDHELP), command);
}
return;
More information about the wine-patches
mailing list