[Freeswitch-svn] [commit] r5008 - freeswitch/trunk/src/mod/applications/mod_commands

Freeswitch SVN anthm at freeswitch.org
Mon Apr 23 21:15:27 EDT 2007


Author: anthm
Date: Mon Apr 23 21:15:27 2007
New Revision: 5008

Modified:
   freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c

Log:
stop ken's whining

Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c	Mon Apr 23 21:15:27 2007
@@ -821,6 +821,7 @@
 struct holder {
 	switch_stream_handle_t *stream;
 	char *http;
+	char *delim;
 	uint32_t count;
 	int print_title;
 	switch_xml_t xml;
@@ -876,7 +877,7 @@
 				holder->stream->write_function(holder->stream, "<td>");
 				holder->stream->write_function(holder->stream, "<b>%s</b>%s", columnNames[x], x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
 			} else {
-				holder->stream->write_function(holder->stream, "%s%s", columnNames[x], x == (argc - 1) ? "\n" : ",");
+				holder->stream->write_function(holder->stream, "%s%s", columnNames[x], x == (argc - 1) ? "\n" : holder->delim);
 			}
 		}
 	}
@@ -890,7 +891,7 @@
 			holder->stream->write_function(holder->stream, "<td>");
 			holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "</td></tr>\n" : "</td><td>");
 		} else {
-			holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "\n" : ",");
+			holder->stream->write_function(holder->stream, "%s%s", argv[x] ? argv[x] : "", x == (argc - 1) ? "\n" : holder->delim);
 		}
 	}
 
@@ -905,7 +906,7 @@
 	switch_core_db_t *db = switch_core_db_handle();
 	struct holder holder = { 0 };
 	int help = 0;
-	char *mydata = NULL, *argv[5] = {0};
+	char *mydata = NULL, *argv[6] = {0};
 	int argc;
 	char *cmd = NULL, *as = NULL;
 
@@ -969,10 +970,16 @@
 	}
 
 	if (!as) {
-		as = "csv";
+		as = "delim";
+		holder.delim = ",";
 	}
 
-	if (!strcasecmp(as, "csv")) {
+	if (!strcasecmp(as, "delim") || !strcasecmp(as, "csv")) {
+		if (switch_strlen_zero(holder.delim)) {
+			if (!(holder.delim = argv[3])) {
+				holder.delim = ",";
+			}
+		}
 		switch_core_db_exec(db, sql, show_callback, &holder, &errmsg);
 		if (holder.http) {
 			holder.stream->write_function(holder.stream, "</table>");



More information about the Freeswitch-svn mailing list