[asterisk-commits] russell: branch russell/data_retrieval r111943 - /team/russell/data_retrieval...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 28 19:02:06 CDT 2008


Author: russell
Date: Fri Mar 28 19:02:06 2008
New Revision: 111943

URL: http://svn.digium.com/view/asterisk?view=rev&rev=111943
Log:
tweak CLI command output because I'm picky

Modified:
    team/russell/data_retrieval/main/data.c

Modified: team/russell/data_retrieval/main/data.c
URL: http://svn.digium.com/view/asterisk/team/russell/data_retrieval/main/data.c?view=diff&rev=111943&r1=111942&r2=111943
==============================================================================
--- team/russell/data_retrieval/main/data.c (original)
+++ team/russell/data_retrieval/main/data.c Fri Mar 28 19:02:06 2008
@@ -373,6 +373,8 @@
 	const struct ast_data_node *node, int level)
 {
 	int i;
+	enum ast_data_node_type node_type;
+	const struct ast_data_node *next = NULL;
 
 	if (!node)
 		return;
@@ -384,12 +386,14 @@
 	}
 
 	if (level) {
-		ast_str_append(buf, 0, ">");
-	}
-
-	ast_str_append(buf, 0, " %s: ", ast_data_node_get_name(node));
-
-	switch (ast_data_node_get_type(node)) {
+		ast_str_append(buf, 0, "> ");
+	}
+
+	ast_str_append(buf, 0, "%s: ", ast_data_node_get_name(node));
+
+	node_type = ast_data_node_get_type(node);
+
+	switch (node_type) {
 	case AST_DATA_NODE_GROUPING:
 		break;
 	case AST_DATA_NODE_BOOL:
@@ -404,10 +408,21 @@
 	}
 
 	ast_cli(a->fd, "%s\n", (*buf)->str);
+	
+	if (level == 0 && node_type == AST_DATA_NODE_GROUPING) {
+		ast_cli(a->fd, "===\n");
+	}
 
 	cli_print_node(a, buf, ast_data_node_get_child(node), level + 1);
 
-	cli_print_node(a, buf, ast_data_node_get_next(node), level);
+	next = ast_data_node_get_next(node);
+
+	if (level == 1 && (node_type == AST_DATA_NODE_GROUPING || !next)) {
+		ast_cli(a->fd, "===\n");
+	}
+
+	if (next)
+		cli_print_node(a, buf, next, level);
 }
 
 static char *cli_data_get(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)




More information about the asterisk-commits mailing list