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 = \ ...@@ -13,6 +13,7 @@ APP_OBJS = \
fru_utils.o \ fru_utils.o \
term.o \ term.o \
util.o \ util.o \
fpga_device.o \
LDLIBS+=-lgpiod -lreadline -lsensors -li2c LDLIBS+=-lgpiod -lreadline -lsensors -li2c
CFLAGS+=-Wall -ggdb -g -O2 \ CFLAGS+=-Wall -ggdb -g -O2 \
......
...@@ -95,15 +95,23 @@ struct command_entry commands_list[] = { ...@@ -95,15 +95,23 @@ struct command_entry commands_list[] = {
int cmd_help(char *params) int cmd_help(char *params)
{ {
struct command_entry *entry = commands_list; struct command_entry *entry;
char buf[50]; char buf[50];
/* Print fantray's help if requested */ printf("diot_util for HW version %d\n", SB_VER);
if (params && !strncmp(params, "fantray", strlen("fantray"))) printf("Available commands:\n");
if (params && !strncmp(params, "fantray", strlen("fantray"))) {
/* Print fantray's help if requested */
entry = commands_list_fantray; entry = commands_list_fantray;
printf("diot_util for HW version %d\n", SB_VER); } else if (params && !strncmp(params, "fantray", strlen("fantray"))) {
printf("Available commands:\n"); /* Print gateware if requested */
while (entry->cmd_name) { entry = commands_list_fpga_device;
} else {
entry = commands_list;
}
while (entry->cmd_name) {
sprintf(buf, "%s %s", entry->cmd_name, sprintf(buf, "%s %s", entry->cmd_name,
entry->cmd_params ? entry->cmd_params : ""); entry->cmd_params ? entry->cmd_params : "");
printf("%-18s - %s", buf, entry->cmd_help_string); printf("%-18s - %s", buf, entry->cmd_help_string);
...@@ -599,7 +607,7 @@ char *command_name_generator_fantray(const char *text, int state) ...@@ -599,7 +607,7 @@ char *command_name_generator_fantray(const char *text, int state)
return NULL; return NULL;
} }
/* command name generator for fantray */ /* command name generator for gateware */
char *command_name_generator_gateware(const char *text, int state) char *command_name_generator_gateware(const char *text, int state)
{ {
static int list_index, len; 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