aboutsummaryrefslogtreecommitdiffstats
path: root/main/file.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-26 23:46:47 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-01-26 23:46:47 +0000
commit01af888f4151b4f52230718918713188b97569e4 (patch)
tree5371b7750e7cea87ed2ae73bb5ff4f30a697fbcc /main/file.c
parent68b1f90265e123f72667c3698d53b31ea000cd07 (diff)
Fix core show file formats CLI command.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@52335 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/file.c')
-rw-r--r--main/file.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/main/file.c b/main/file.c
index 5192984d3..bb9f05964 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1133,7 +1133,7 @@ static int show_file_formats(int fd, int argc, char *argv[])
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 @@ static int show_file_formats(int fd, int argc, char *argv[])
#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[] = {