diff options
Diffstat (limited to 'cli/src/cli-cmd-global.c')
| -rw-r--r-- | cli/src/cli-cmd-global.c | 15 | 
1 files changed, 12 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-global.c b/cli/src/cli-cmd-global.c index 9b71821b00c..dc28b74dea5 100644 --- a/cli/src/cli-cmd-global.c +++ b/cli/src/cli-cmd-global.c @@ -58,11 +58,20 @@ cli_cmd_global_help_cbk (struct cli_state *state, struct cli_cmd_word *in_word,                        const char **words, int wordcount)  {          struct cli_cmd        *cmd = NULL; +        struct cli_cmd        *global_cmd = NULL; +        int                   count     = 0; -        for (cmd = global_cmds; cmd->pattern; cmd++) -                if (_gf_false == cmd->disable) -                        cli_out ("%s - %s", cmd->pattern, cmd->desc); +        cmd = GF_CALLOC (1, sizeof (global_cmds), cli_mt_cli_cmd); +        memcpy (cmd, global_cmds, sizeof (global_cmds)); +        count = (sizeof (global_cmds) / sizeof (struct cli_cmd)); +        cli_cmd_sort (cmd, count); +        for (global_cmd = cmd; global_cmd->pattern; global_cmd++) +                if (_gf_false == global_cmd->disable) +                        cli_out ("%s - %s", global_cmd->pattern, +                                 global_cmd->desc); + +        GF_FREE (cmd);          return 0;  }  | 
