From: David M. Lee Date: Fri, 5 Oct 2012 20:20:28 +0000 (+0000) Subject: I've committed too much. Reverting part of r374570. X-Git-Tag: 1.8.18.0-rc1~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=40da12652ef8c65a289d828d055a240ee79ddd67;p=thirdparty%2Fasterisk.git I've committed too much. Reverting part of r374570. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@374581 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/manager.c b/main/manager.c index d2840b09f0..7cbcc96b73 100644 --- a/main/manager.c +++ b/main/manager.c @@ -1651,9 +1651,8 @@ static char *handle_showmanagers(struct ast_cli_entry *e, int cmd, struct ast_cl static char *handle_showmancmds(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct manager_action *cur; - int name_len = 1; - int space_remaining; -#define HSMC_FORMAT " %-*.*s %-*.*s\n" + struct ast_str *authority; +#define HSMC_FORMAT " %-15.15s %-15.15s %-55.55s\n" switch (cmd) { case CLI_INIT: e->command = "manager show commands"; @@ -1664,25 +1663,13 @@ static char *handle_showmancmds(struct ast_cli_entry *e, int cmd, struct ast_cli case CLI_GENERATE: return NULL; } + authority = ast_str_alloca(80); + ast_cli(a->fd, HSMC_FORMAT, "Action", "Privilege", "Synopsis"); + ast_cli(a->fd, HSMC_FORMAT, "------", "---------", "--------"); AST_RWLIST_RDLOCK(&actions); AST_RWLIST_TRAVERSE(&actions, cur, list) { - int incoming_len = strlen(cur->action); - if (incoming_len > name_len) { - name_len = incoming_len; - } - } - - space_remaining = 85 - name_len; - if (space_remaining < 0) { - space_remaining = 0; - } - - ast_cli(a->fd, HSMC_FORMAT, name_len, name_len, "Action", space_remaining, space_remaining, "Synopsis"); - ast_cli(a->fd, HSMC_FORMAT, name_len, name_len, "------", space_remaining, space_remaining, "--------"); - - AST_RWLIST_TRAVERSE(&actions, cur, list) { - ast_cli(a->fd, HSMC_FORMAT, name_len, name_len, cur->action, space_remaining, space_remaining, cur->synopsis); + ast_cli(a->fd, HSMC_FORMAT, cur->action, authority_to_str(cur->authority, &authority), cur->synopsis); } AST_RWLIST_UNLOCK(&actions);