Commit 5f4bc4d2 authored by Alén Arias Vázquez's avatar Alén Arias Vázquez 😎

clean function cmd help

parent a43bf6ca
......@@ -13,6 +13,7 @@ APP_OBJS = \
fru_utils.o \
term.o \
util.o \
fpga_device.o \
LDLIBS+=-lgpiod -lreadline -lsensors -li2c
CFLAGS+=-Wall -ggdb -g -O2 \
......
......@@ -95,15 +95,23 @@ struct command_entry commands_list[] = {
int cmd_help(char *params)
{
struct command_entry *entry = commands_list;
struct command_entry *entry;
char buf[50];
/* Print fantray's help if requested */
if (params && !strncmp(params, "fantray", strlen("fantray")))
printf("diot_util for HW version %d\n", SB_VER);
printf("Available commands:\n");
if (params && !strncmp(params, "fantray", strlen("fantray"))) {
/* Print fantray's help if requested */
entry = commands_list_fantray;
printf("diot_util for HW version %d\n", SB_VER);
printf("Available commands:\n");
while (entry->cmd_name) {
} else if (params && !strncmp(params, "fantray", strlen("fantray"))) {
/* Print gateware if requested */
entry = commands_list_fpga_device;
} else {
entry = commands_list;
}
while (entry->cmd_name) {
sprintf(buf, "%s %s", entry->cmd_name,
entry->cmd_params ? entry->cmd_params : "");
printf("%-18s - %s", buf, entry->cmd_help_string);
......@@ -599,7 +607,7 @@ char *command_name_generator_fantray(const char *text, int state)
return NULL;
}
/* command name generator for fantray */
/* command name generator for gateware */
char *command_name_generator_gateware(const char *text, int state)
{
static int list_index, len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment