--- libaitcli/src/cli.c 2013/08/12 09:50:29 1.6 +++ libaitcli/src/cli.c 2013/10/08 09:38:55 1.6.4.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cli.c,v 1.6 2013/08/12 09:50:29 misho Exp $ +* $Id: cli.c,v 1.6.4.2 2013/10/08 09:38:55 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -80,8 +80,12 @@ int cli_Cmd_Help(void * __restrict cli_buffer, int idx cli_Printf(buf, "\n"); if (!args) { - SLIST_FOREACH(cmd, &buf->line_cmds, cmd_next) + SLIST_FOREACH(cmd, &buf->line_cmds, cmd_next) { + if (cmd->cmd_level != idx) + continue; + cli_Printf(buf, "%s\t\t%s\n", cmd->cmd_name, cmd->cmd_help); + } } else { if (!args[1]) cli_Printf(buf, "Help screen::\n"); @@ -90,7 +94,9 @@ int cli_Cmd_Help(void * __restrict cli_buffer, int idx return RETCODE_OK; SLIST_FOREACH(cmd, &buf->line_cmds, cmd_next) { - if (args[1] && (cmd->cmd_level != buf->line_level || strcmp(args[1], cmd->cmd_name))) + if (cmd->cmd_level != idx) + continue; + if (args[1] && (cmd->cmd_level != idx || strcmp(args[1], cmd->cmd_name))) continue; cli_Printf(buf, "%s%s\t\t%s\n", args[1] ? "Syntax::\n\t" : "", cmd->cmd_name,