aboutsummaryrefslogtreecommitdiffstats
path: root/codecs
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-19 18:01:00 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-19 18:01:00 +0000
commit4723d35127a1da861d28ce2ae2ee0e8bbd7c3e7b (patch)
treef7b900279b3959d2cc8feddc22a7d8643eb60f95 /codecs
parent4c11437602461608f71405d14e49493187123ed9 (diff)
More changes to NEW_CLI.
Also fixes a few cli messages and some minor formatting. (closes issue #11001) Reported by: seanbright Patches: newcli.1.patch uploaded by seanbright (license 71) newcli.2.patch uploaded by seanbright (license 71) newcli.4.patch uploaded by seanbright (license 71) newcli.5.patch uploaded by seanbright (license 71) newcli.6.patch uploaded by seanbright (license 71) newcli.7.patch uploaded by seanbright (license 71) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@86534 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs')
-rw-r--r--codecs/codec_zap.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/codecs/codec_zap.c b/codecs/codec_zap.c
index 8bd87f5fd..1b8a2832d 100644
--- a/codecs/codec_zap.c
+++ b/codecs/codec_zap.c
@@ -67,29 +67,10 @@ static struct channel_usage {
int decoders;
} channels;
-static char show_transcoder_usage[] =
-"Usage: show transcoder\n"
-" Displays channel utilization of Zaptel transcoder(s).\n";
-
-static char transcoder_show_usage[] =
-"Usage: transcoder show\n"
-" Displays channel utilization of Zaptel transcoder(s).\n";
-
-static int transcoder_show(int fd, int argc, char **argv);
-
-static struct ast_cli_entry cli_deprecated[] = {
- { { "show", "transcoder", NULL },
- transcoder_show,
- "Display Zaptel transcoder utilization.",
- show_transcoder_usage}
-};
+static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
static struct ast_cli_entry cli[] = {
- { { "transcoder", "show", NULL },
- transcoder_show,
- "Display Zaptel transcoder utilization.",
- transcoder_show_usage, NULL,
- &cli_deprecated[0]}
+ NEW_CLI(handle_cli_transcoder_show, "Display Zaptel transcoder utilization.")
};
struct format_map {
@@ -116,18 +97,32 @@ struct pvt {
struct ast_frame f;
};
-static int transcoder_show(int fd, int argc, char **argv)
+static char *handle_cli_transcoder_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct channel_usage copy;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "transcoder show";
+ e->usage =
+ "Usage: transcoder show\n"
+ " Displays channel utilization of Zaptel transcoder(s).\n";
+ return NULL;
+ case CLI_GENERATE:
+ return NULL;
+ }
+
+ if (a->argc != 2)
+ return CLI_SHOWUSAGE;
+
copy = channels;
if (copy.total == 0)
- ast_cli(fd, "No Zaptel transcoders found.\n");
+ ast_cli(a->fd, "No Zaptel transcoders found.\n");
else
- ast_cli(fd, "%d/%d encoders/decoders of %d channels are in use.\n", copy.encoders, copy.decoders, copy.total);
+ ast_cli(a->fd, "%d/%d encoders/decoders of %d channels are in use.\n", copy.encoders, copy.decoders, copy.total);
- return RESULT_SUCCESS;
+ return CLI_SUCCESS;
}
static int zap_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
@@ -492,4 +487,4 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Generic Zaptel Transcode
.load = load_module,
.unload = unload_module,
.reload = reload,
- );
+ );