2010-10-17 21:50:55 +02:00
|
|
|
|
2021-06-12 23:34:41 +02:00
|
|
|
int cmd_help(char cmd[]) {
|
|
|
|
int i;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
2021-06-12 23:34:41 +02:00
|
|
|
if ( !strlen(cmd) ) {
|
|
|
|
int columns_max=3;
|
|
|
|
printf (CMD_HELP_AVAIL, NUM_OF_CMD);
|
|
|
|
for (i = 0; i < NUM_OF_CMD; i++) {
|
|
|
|
printf(" %-12s", COMMANDS[i].name);
|
|
|
|
if ((i) && ((i+1)%columns_max == 0)) printf("\n\r");
|
|
|
|
}
|
|
|
|
if ((i)%columns_max != 0) printf("\n\r");
|
|
|
|
return TRUE;
|
2017-09-27 20:44:15 +02:00
|
|
|
}
|
2021-06-12 23:34:41 +02:00
|
|
|
else {
|
|
|
|
for (i=0; i<NUM_OF_CMD; i++)
|
|
|
|
if ( !strcmp(cmd, COMMANDS[i].name) ) {
|
|
|
|
printf(COMMANDS[i].help);
|
|
|
|
return TRUE;
|
2010-10-17 21:50:55 +02:00
|
|
|
}
|
|
|
|
|
2021-06-12 23:34:41 +02:00
|
|
|
printf (CMD_HELP_CMD_NOT_FOUND, cmd);
|
|
|
|
printf (CMD_HELP_AVAIL, NUM_OF_CMD);
|
|
|
|
for (i = 0; i < NUM_OF_CMD; i++)
|
|
|
|
printf(" %s\n\r", COMMANDS[i].name);
|
|
|
|
}
|
2010-10-17 21:50:55 +02:00
|
|
|
|
2021-06-12 23:34:41 +02:00
|
|
|
return FALSE;
|
2010-10-17 21:50:55 +02:00
|
|
|
}
|
2013-02-17 16:22:51 +01:00
|
|
|
|