[asterisk-commits] dlee: branch 1.8 r374581 - /branches/1.8/main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 5 15:20:32 CDT 2012


Author: dlee
Date: Fri Oct  5 15:20:28 2012
New Revision: 374581

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=374581
Log:
I've committed too much. Reverting part of r374570.

Modified:
    branches/1.8/main/manager.c

Modified: branches/1.8/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/manager.c?view=diff&rev=374581&r1=374580&r2=374581
==============================================================================
--- branches/1.8/main/manager.c (original)
+++ branches/1.8/main/manager.c Fri Oct  5 15:20:28 2012
@@ -1651,9 +1651,8 @@
 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 @@
 	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);
 




More information about the asterisk-commits mailing list