From: Erik M. <er...@us...> - 2001-10-07 20:29:41
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv10121 Modified Files: Makefile.am command.c Removed Files: help.c Log Message: Move help command into command.c and remove help.c Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/lib/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 2001/10/07 19:04:25 1.2 +++ Makefile.am 2001/10/07 20:29:38 1.3 @@ -28,7 +28,6 @@ libblob_a_SOURCES = \ command.c \ error.c \ - help.c \ icache.c \ init.c \ led.c \ Index: command.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/command.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- command.c 2001/10/07 19:34:17 1.2 +++ command.c 2001/10/07 20:29:38 1.3 @@ -172,6 +172,47 @@ +/* help command */ +static int help(int argc, char *argv[]) +{ + commandlist_t *cmd; + + /* help on a command? */ + if(argc >= 2) { + for(cmd = commands; cmd != NULL; cmd = cmd->next) { + if(strcmp(cmd->name, argv[1]) == 0) { + SerialOutputString("Help for '"); + SerialOutputString(argv[1]); + SerialOutputString("':\n\nUsage: "); + SerialOutputString(cmd->help); + return 0; + } + } + + return -EINVAL; + } + + SerialOutputString("The following commands are supported:"); + + for(cmd = commands; cmd != NULL; cmd = cmd->next) { + SerialOutputString("\n* "); + SerialOutputString(cmd->name); + } + + SerialOutputString("\nUse \"help command\" to get help on a specific command\n"); + + return 0; +} + +static char helphelp[] = "help [command]\n" +"Get help on [command], " +"or a list of supported commands if a command is omitted.\n"; + +__commandlist(help, "help", helphelp); + + + + /* display a prompt, or the standard prompt if prompt == NULL */ void DisplayPrompt(char *prompt) { --- help.c DELETED --- |