mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-22 13:25:17 +00:00
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
This commit is contained in:
31
main/file.c
31
main/file.c
@@ -1133,7 +1133,7 @@ static int show_file_formats(int fd, int argc, char *argv[])
|
|||||||
struct ast_format *f;
|
struct ast_format *f;
|
||||||
int count_fmt = 0;
|
int count_fmt = 0;
|
||||||
|
|
||||||
if (argc != 3)
|
if (argc != 4)
|
||||||
return RESULT_SHOWUSAGE;
|
return RESULT_SHOWUSAGE;
|
||||||
ast_cli(fd, FORMAT, "Format", "Name", "Extensions");
|
ast_cli(fd, FORMAT, "Format", "Name", "Extensions");
|
||||||
|
|
||||||
@@ -1153,13 +1153,40 @@ static int show_file_formats(int fd, int argc, char *argv[])
|
|||||||
#undef FORMAT2
|
#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[] =
|
char show_file_formats_usage[] =
|
||||||
"Usage: core show file formats\n"
|
"Usage: core show file formats\n"
|
||||||
" Displays currently registered file formats (if any)\n";
|
" Displays currently registered file formats (if any)\n";
|
||||||
|
|
||||||
struct ast_cli_entry cli_show_file_formats_deprecated = {
|
struct ast_cli_entry cli_show_file_formats_deprecated = {
|
||||||
{ "show", "file", "formats" },
|
{ "show", "file", "formats" },
|
||||||
show_file_formats, NULL,
|
show_file_formats_deprecated, NULL,
|
||||||
NULL };
|
NULL };
|
||||||
|
|
||||||
struct ast_cli_entry cli_file[] = {
|
struct ast_cli_entry cli_file[] = {
|
||||||
|
Reference in New Issue
Block a user