[svn-commits] eliel: branch group/data_api_gsoc2009 r204406 - /team/group/data_api_gsoc2009...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 30 10:58:38 CDT 2009


Author: eliel
Date: Tue Jun 30 10:58:34 2009
New Revision: 204406

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204406
Log:
Dump to a specified file in XML format for debugging.

Modified:
    team/group/data_api_gsoc2009/tests/test_data.c

Modified: team/group/data_api_gsoc2009/tests/test_data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/tests/test_data.c?view=diff&rev=204406&r1=204405&r2=204406
==============================================================================
--- team/group/data_api_gsoc2009/tests/test_data.c (original)
+++ team/group/data_api_gsoc2009/tests/test_data.c Tue Jun 30 10:58:34 2009
@@ -68,14 +68,12 @@
 
 static const struct ast_data_entry test_providers[] = {
 	AST_DATA_ENTRY("test/node1/node11/node111", &test_provider),
-/*
 	AST_DATA_ENTRY("test/node1/node12/node121", &test_provider),
 	AST_DATA_ENTRY("test/node1/node13/node131", &test_provider),
 	AST_DATA_ENTRY("test/node2/node14/node141", &test_provider),
 	AST_DATA_ENTRY("test/node2/node14/node142", &test_provider),
 	AST_DATA_ENTRY("test/node2/node15/node151", &test_provider),
 	AST_DATA_ENTRY("test/node2/node15/node152", &test_provider),
-*/
 };
 
 static char *handle_cli_data_get_bench(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
@@ -148,6 +146,7 @@
 
 static char *handle_cli_data_get_dump(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
+	char *res = CLI_SUCCESS;
 	struct ast_xml_doc *doc;
 	FILE *outfile;
 	struct ast_data_query query = {
@@ -164,19 +163,25 @@
 		return NULL;
 	}
 
+	if (a->argc != e->args + 1) {
+		return CLI_SHOWUSAGE;
+	}
+
 	/* and now get it in xml form. */
 	doc = ast_data_get_xml(&query);
 	if (doc) {
-		outfile = fopen("/tmp/ast_data_xml_output", "w+");
+		outfile = fopen(a->argv[e->args], "w+");
 		if (outfile) {
 			ast_xml_doc_dump_file(outfile, doc);
+		} else {
+			res = CLI_FAILURE;
 		}
 		ast_xml_close(doc);
 	} else {
-		return CLI_FAILURE;
-	}
-
-	return CLI_SUCCESS;
+		res = CLI_FAILURE;
+	}
+
+	return res;
 }
 
 static struct ast_cli_entry cli_data[] = {




More information about the svn-commits mailing list