kolibrios/programs/system/shell/cmd/cmd_help.c
Nasarus 3256dedea8 Shell 0.4.4 (All)
git-svn-id: svn://kolibrios.org@1665 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-10-17 19:50:55 +00:00

33 lines
583 B
C

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;
}