forked from KolibriOS/kolibrios
Shell 0.4.4 (All)
git-svn-id: svn://kolibrios.org@1665 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
32
programs/system/shell/cmd/cmd_help.c
Normal file
32
programs/system/shell/cmd/cmd_help.c
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
int cmd_help(char cmd[])
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
char available[]={" %d commands available:\n\r"};
|
||||
|
||||
if ( !strlen(cmd) )
|
||||
{
|
||||
printf (available, NUM_OF_CMD);
|
||||
for (i = 0; i < NUM_OF_CMD; i++)
|
||||
printf(" %s\n\r", COMMANDS[i].name);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0; i<NUM_OF_CMD; i++)
|
||||
if ( !strcmp(cmd, COMMANDS[i].name) )
|
||||
{
|
||||
printf(COMMANDS[i].help);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
printf (" Command \'%s\' not found.\n\r", cmd);
|
||||
printf (available, NUM_OF_CMD);
|
||||
for (i = 0; i < NUM_OF_CMD; i++)
|
||||
printf(" %s\n\r", COMMANDS[i].name);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
Reference in New Issue
Block a user