aboutsummaryrefslogtreecommitdiffstats
path: root/main/image.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-18 19:54:18 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-18 19:54:18 +0000
commit5aacb6a82d4cf625774fa1ea39ca193a3be73b35 (patch)
treecf63baa167f81c95d3dbf417f83681851decad80 /main/image.c
parent4de5810a0530bca0665eadcfb06ef06fd2e86758 (diff)
merge qwell's CLI verbification work
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43212 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/image.c')
-rw-r--r--main/image.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/main/image.c b/main/image.c
index ff67c0340..377ce9208 100644
--- a/main/image.c
+++ b/main/image.c
@@ -46,6 +46,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/cli.h"
#include "asterisk/lock.h"
+/* XXX Why don't we just use the formats struct for this? */
static AST_LIST_HEAD_STATIC(imagers, ast_imager);
int ast_image_register(struct ast_imager *img)
@@ -165,7 +166,6 @@ struct ast_frame *ast_read_image(char *filename, const char *preflang, int forma
return f;
}
-
int ast_send_image(struct ast_channel *chan, char *filename)
{
struct ast_frame *f;
@@ -180,7 +180,7 @@ int ast_send_image(struct ast_channel *chan, char *filename)
return res;
}
-static int show_image_formats(int fd, int argc, char *argv[])
+static int show_image_formats_deprecated(int fd, int argc, char *argv[])
{
#define FORMAT "%10s %10s %50s %10s\n"
#define FORMAT2 "%10s %10s %50s %10s\n"
@@ -193,18 +193,33 @@ static int show_image_formats(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-struct ast_cli_entry show_images =
+static int show_image_formats(int fd, int argc, char *argv[])
{
+#define FORMAT "%10s %10s %50s %10s\n"
+#define FORMAT2 "%10s %10s %50s %10s\n"
+ struct ast_imager *i;
+ if (argc != 4)
+ return RESULT_SHOWUSAGE;
+ ast_cli(fd, FORMAT, "Name", "Extensions", "Description", "Format");
+ AST_LIST_TRAVERSE(&imagers, i, list)
+ ast_cli(fd, FORMAT2, i->name, i->exts, i->desc, ast_getformatname(i->format));
+ return RESULT_SUCCESS;
+}
+
+struct ast_cli_entry cli_show_image_formats_deprecated = {
{ "show", "image", "formats" },
- show_image_formats,
- "Displays image formats",
-"Usage: show image formats\n"
-" displays currently registered image formats (if any)\n"
+ show_image_formats_deprecated, NULL,
+ NULL };
+
+struct ast_cli_entry cli_image[] = {
+ { { "file", "list", "formats", "image" },
+ show_image_formats, "Displays image formats",
+ "Usage: file list formats image\n"
+ " displays currently registered image formats (if any)\n", NULL, &cli_show_image_formats_deprecated },
};
-
int ast_image_init(void)
{
- return ast_cli_register(&show_images);
+ ast_cli_register_multiple(cli_image, sizeof(cli_image) / sizeof(struct ast_cli_entry));
+ return 0;
}
-