xref: /reactos/base/system/diskpart/help.c (revision 50cf16b3)
1 /*
2  * PROJECT:         ReactOS DiskPart
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * FILE:            base/system/diskpart/help.c
5  * PURPOSE:         Manages all the partitions of the OS in an interactive way.
6  * PROGRAMMERS:     Lee Schroeder
7  */
8 
9 #include "diskpart.h"
10 
11 /*
12  * help_cmdlist():
13  * shows all the available commands and basic descriptions for diskpart
14  */
15 VOID help_cmdlist(VOID)
16 {
17     PCOMMAND cmdptr;
18 
19     /* Print the header information */
20     ConResPuts(StdOut, IDS_APP_HEADER);
21     ConPuts(StdOut, L"\n");
22 
23     /* List all the commands and the basic descriptions */
24     for (cmdptr = cmds; cmdptr->name; cmdptr++)
25         ConResPuts(StdOut, cmdptr->help_desc);
26 
27     ConPuts(StdOut, L"\n");
28 }
29 
30 /* help_main(char *arg):
31  * main entry point for the help command. Gives help to users who needs it.
32  */
33 BOOL help_main(INT argc, LPWSTR *argv)
34 {
35     PCOMMAND cmdptr;
36 
37     if (argc == 1)
38     {
39         help_cmdlist();
40         return TRUE;
41     }
42 
43     /* Scan internal command table */
44     for (cmdptr = cmds; cmdptr->name; cmdptr++)
45     {
46         if (_wcsicmp(argv[1], cmdptr->name) == 0)
47         {
48             ConResPuts(StdOut, cmdptr->help);
49             return TRUE;
50         }
51     }
52 
53     help_cmdlist();
54 
55     return TRUE;
56 }
57