diff options
Diffstat (limited to 'cli/src/cli-cmd-snapshot.c')
| -rw-r--r-- | cli/src/cli-cmd-snapshot.c | 20 | 
1 files changed, 14 insertions, 6 deletions
diff --git a/cli/src/cli-cmd-snapshot.c b/cli/src/cli-cmd-snapshot.c index 80ab2b0f211..e79128c5a59 100644 --- a/cli/src/cli-cmd-snapshot.c +++ b/cli/src/cli-cmd-snapshot.c @@ -15,6 +15,7 @@  #include "cli.h"  #include "cli-cmd.h" +#include "cli-mem-types.h"  extern rpc_clnt_prog_t *cli_rpc_prog; @@ -130,12 +131,19 @@ cli_cmd_snapshot_help_cbk (struct cli_state *state,                             const char **words,                             int wordcount)  { -        struct cli_cmd        *cmd = NULL; - -        for (cmd = snapshot_cmds; cmd->pattern; cmd++) -                if (_gf_false == cmd->disable) -                        cli_out ("%s - %s", cmd->pattern, cmd->desc); - +        struct cli_cmd        *cmd      = NULL; +        struct cli_cmd        *snap_cmd = NULL; +        int                   count     = 0; + +        cmd = GF_CALLOC (1, sizeof (snapshot_cmds), cli_mt_cli_cmd); +        memcpy (cmd, snapshot_cmds, sizeof (snapshot_cmds)); +        count = (sizeof (snapshot_cmds) / sizeof (struct cli_cmd)); +        cli_cmd_sort (cmd, count); + +        for (snap_cmd = cmd; snap_cmd->pattern; snap_cmd++) +                if (_gf_false == snap_cmd->disable) +                        cli_out ("%s - %s", snap_cmd->pattern, snap_cmd->desc); +        GF_FREE (cmd);          return 0;  }  | 
