2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS help utility
4 * FILE: base/applications/cmdutils/help/help.c
5 * PURPOSE: Provide help for command-line utilities
6 * PROGRAMMERS: Lee Schroeder (spaceseel at gmail dot com)
7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
12 #define WIN32_NO_STATUS
24 IsInternalCommand(PCWSTR Cmd
)
30 if (!Cmd
) return FALSE
;
32 for (i
= 0; i
< ARRAYSIZE(InternalCommands
); ++i
)
34 res
= _wcsicmp(InternalCommands
[i
], Cmd
);
37 /* This is an internal command */
43 * The internal commands list is sorted in alphabetical order.
44 * We can quit the loop immediately since the current internal
45 * command is lexically greater than the command to be tested.
51 /* Command not found */
55 int wmain(int argc
, WCHAR
* argv
[])
57 WCHAR CmdLine
[CMDLINE_LENGTH
];
59 /* Initialize the Console Standard Streams */
63 * If the user hasn't asked for specific help,
64 * then print out the list of available commands.
68 ConResPuts(StdOut
, IDS_HELP1
);
69 ConResPuts(StdOut
, IDS_HELP2
);
74 * Bad usage (too much options) or we use the /? switch.
75 * Display help for the HELP command.
77 if ((argc
> 2) || (wcscmp(argv
[1], L
"/?") == 0))
79 ConResPuts(StdOut
, IDS_USAGE
);
84 * If the command is not an internal one,
85 * display an information message and exit.
87 if (!IsInternalCommand(argv
[1]))
89 ConResPrintf(StdOut
, IDS_NO_ENTRY
, argv
[1]);
94 * Run "<command> /?" in the current command processor.
96 StringCbPrintfW(CmdLine
, sizeof(CmdLine
), L
"%ls /?", argv
[1]);
99 return _wsystem(CmdLine
);