CMDLIST: a basic command to display a list of all possible commands Usage: cmdlist <= display all possible commands cmdlist [command] <= check whether a command exists or not
| 69 | // Usage: cmdlist <= display all possible commands |
| 70 | // cmdlist [command] <= check whether a command exists or not |
| 71 | void Console::BasicCmdcmdlist(Console* console, const char* text, void* user_data) |
| 72 | { |
| 73 | ConsoleCommand* pcmd; |
| 74 | if(!text) |
| 75 | { |
| 76 | for(int i=0;i<256;i++) |
| 77 | { |
| 78 | pcmd = console->mCmds[i]; |
| 79 | while(pcmd) |
| 80 | { |
| 81 | console->out(pcmd->fullcmd); |
| 82 | pcmd = pcmd->next; |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | else |
| 87 | { |
| 88 | int i = text[0]; |
| 89 | if( (i >= 'A') && (i<='Z') ) |
| 90 | i -= 'A' - 'a'; |
| 91 | pcmd = console->mCmds[i]; |
| 92 | while(pcmd) |
| 93 | { |
| 94 | if(Ps::strncmp(pcmd->fullcmd, text, strlen(text)) == 0) |
| 95 | console->out(pcmd->fullcmd); |
| 96 | pcmd = pcmd->next; |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | // CMDHIST: a basic command to display command history |
| 102 | // Usage: cmdhist |