| 42 | }; |
| 43 | |
| 44 | int cmdHelp(_In_ LPCTSTR BaseName, _In_opt_ LPCTSTR Machine, _In_ DWORD Flags, _In_ int argc, _In_reads_(argc) PTSTR argv[]) |
| 45 | /*++ |
| 46 | |
| 47 | Routine Description: |
| 48 | |
| 49 | HELP command |
| 50 | allow HELP or HELP <command> |
| 51 | |
| 52 | Arguments: |
| 53 | |
| 54 | BaseName - name of executable |
| 55 | Machine - if non-NULL, remote machine (ignored) |
| 56 | argc/argv - remaining parameters |
| 57 | |
| 58 | Return Value: |
| 59 | |
| 60 | EXIT_xxxx |
| 61 | |
| 62 | --*/ |
| 63 | { |
| 64 | DWORD helptext = 0; |
| 65 | int dispIndex; |
| 66 | LPCTSTR cmd = NULL; |
| 67 | BOOL unknown = FALSE; |
| 68 | |
| 69 | UNREFERENCED_PARAMETER(Machine); |
| 70 | UNREFERENCED_PARAMETER(Flags); |
| 71 | |
| 72 | if(argc) { |
| 73 | // |
| 74 | // user passed in a command for help on... long help |
| 75 | // |
| 76 | for(dispIndex = 0;DispatchTable[dispIndex].cmd;dispIndex++) { |
| 77 | if(_tcsicmp(argv[0],DispatchTable[dispIndex].cmd)==0) { |
| 78 | cmd = DispatchTable[dispIndex].cmd; |
| 79 | helptext = DispatchTable[dispIndex].longHelp; |
| 80 | break; |
| 81 | } |
| 82 | } |
| 83 | if(!cmd) { |
| 84 | unknown = TRUE; |
| 85 | cmd = argv[0]; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | if(helptext) { |
| 90 | // |
| 91 | // long help |
| 92 | // |
| 93 | FormatToStream(stdout,helptext,BaseName,cmd); |
| 94 | } else { |
| 95 | // |
| 96 | // help help |
| 97 | // |
| 98 | FormatToStream(stdout,unknown ? MSG_HELP_OTHER : MSG_HELP_LONG,BaseName,cmd); |
| 99 | // |
| 100 | // enumerate through each command and display short help for each |
| 101 | // |
nothing calls this directly
no test coverage detected