[asterisk-commits] file: branch 1.4 r52335 - /branches/1.4/main/file.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Jan 26 16:46:48 MST 2007


Author: file
Date: Fri Jan 26 17:46:47 2007
New Revision: 52335

URL: http://svn.digium.com/view/asterisk?view=rev&rev=52335
Log:
Fix core show file formats CLI command.

Modified:
    branches/1.4/main/file.c

Modified: branches/1.4/main/file.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/file.c?view=diff&rev=52335&r1=52334&r2=52335
==============================================================================
--- branches/1.4/main/file.c (original)
+++ branches/1.4/main/file.c Fri Jan 26 17:46:47 2007
@@ -1133,7 +1133,7 @@
 	struct ast_format *f;
 	int count_fmt = 0;
 
-	if (argc != 3)
+	if (argc != 4)
 		return RESULT_SHOWUSAGE;
 	ast_cli(fd, FORMAT, "Format", "Name", "Extensions");
 	        
@@ -1153,13 +1153,40 @@
 #undef FORMAT2
 }
 
+static int show_file_formats_deprecated(int fd, int argc, char *argv[])
+{
+#define FORMAT "%-10s %-10s %-20s\n"
+#define FORMAT2 "%-10s %-10s %-20s\n"
+	struct ast_format *f;
+	int count_fmt = 0;
+	
+	if (argc != 3)
+		return RESULT_SHOWUSAGE;
+	ast_cli(fd, FORMAT, "Format", "Name", "Extensions");
+	
+	if (AST_LIST_LOCK(&formats)) {
+		ast_log(LOG_WARNING, "Unable to lock format list\n");
+		return -1;
+	}
+	
+	AST_LIST_TRAVERSE(&formats, f, list) {
+		ast_cli(fd, FORMAT2, ast_getformatname(f->format), f->name, f->exts);
+		count_fmt++;
+	}
+	AST_LIST_UNLOCK(&formats);
+	ast_cli(fd, "%d file formats registered.\n", count_fmt);
+	return RESULT_SUCCESS;
+#undef FORMAT
+#undef FORMAT2
+}
+
 char show_file_formats_usage[] = 
 "Usage: core show file formats\n"
 "       Displays currently registered file formats (if any)\n";
 
 struct ast_cli_entry cli_show_file_formats_deprecated = {
 	{ "show", "file", "formats" },
-	show_file_formats, NULL,
+	show_file_formats_deprecated, NULL,
 	NULL };
 
 struct ast_cli_entry cli_file[] = {



More information about the asterisk-commits mailing list