Fix core show file formats CLI command.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@52335 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Joshua Colp 19 years ago
parent 3b44625323
commit bc43c82f05

@ -1133,6 +1133,33 @@ static int show_file_formats(int fd, int argc, char *argv[])
struct ast_format *f;
int count_fmt = 0;
if (argc != 4)
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
}
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");
@ -1159,7 +1186,7 @@ char show_file_formats_usage[] =
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[] = {

Loading…
Cancel
Save