aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_oss.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-17 11:15:54 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-17 11:15:54 +0000
commitf7f05c0d50abb8d82d5c41670446d6250165509f (patch)
tree97702e910efa92e0dfeb890492864a793e6ed862 /channels/chan_oss.c
parent5cea0449f7a89ac2922a594138a4a5f42951e6a6 (diff)
use the regexp cli support on some of the command
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47788 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_oss.c')
-rw-r--r--channels/chan_oss.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index f261708f4..74e056692 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1065,11 +1065,10 @@ static struct ast_channel *oss_request(const char *type, int format, void *data,
static char *console_autoanswer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct chan_oss_pvt *o = find_desc(oss_active);
- static char *choices[] = { "on", "off", NULL };
switch (cmd) {
case CLI_INIT:
- e->command = "console autoanswer";
+ e->command = "console autoanswer [on|off]";
e->usage =
"Usage: console autoanswer [on|off]\n"
" Enables or disables autoanswer feature. If used without\n"
@@ -1078,23 +1077,23 @@ static char *console_autoanswer(struct ast_cli_entry *e, int cmd, struct ast_cli
return NULL;
case CLI_GENERATE:
- return (a->pos != e->args + 1) ? NULL : ast_cli_complete(a->word, choices, a->n);
+ return NULL;
}
- if (a->argc == e->args) {
+ if (a->argc == e->args - 1) {
ast_cli(a->fd, "Auto answer is %s.\n", o->autoanswer ? "on" : "off");
return CLI_SUCCESS;
}
- if (a->argc != e->args + 1)
+ if (a->argc != e->args)
return CLI_SHOWUSAGE;
if (o == NULL) {
ast_log(LOG_WARNING, "Cannot find device %s (should not happen!)\n",
oss_active);
return CLI_FAILURE;
}
- if (!strcasecmp(a->argv[e->args], "on"))
+ if (!strcasecmp(a->argv[e->args-1], "on"))
o->autoanswer = 1;
- else if (!strcasecmp(a->argv[e->args], "off"))
+ else if (!strcasecmp(a->argv[e->args - 1], "off"))
o->autoanswer = 0;
else
return CLI_SHOWUSAGE;
@@ -1287,21 +1286,20 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args
static char *console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct chan_oss_pvt *o = find_desc(oss_active);
- static char *choices[] = { "mute", "unmute", NULL };
char *s;
if (cmd == CLI_INIT) {
- e->command = "console";
+ e->command = "console {mute|unmute}";
e->usage =
- "Usage: console [mute|unmute]\n"
+ "Usage: console {mute|unmute}\n"
" Mute/unmute the microphone.\n";
return NULL;
} else if (cmd == CLI_GENERATE)
- return (a->pos != e->args) ? NULL : ast_cli_complete(a->word, choices, a->n);
+ return NULL;
- if (a->argc != e->args+1)
+ if (a->argc != e->args)
return CLI_SHOWUSAGE;
- s = a->argv[e->args];
+ s = a->argv[e->args-1];
if (!strcasecmp(s, "mute"))
o->mute = 1;
else if (!strcasecmp(s, "unmute"))