summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-11-03 21:19:11 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-11-03 21:19:11 +0000
commit426360e3897a4bd682c71e10ea0415071411735a (patch)
treea19e61a8350d758d17e083cc2fec05d0df4dc022 /apps
parentfc9612edad82fd3d171f8915caf8a1f148207a60 (diff)
major update to arg/option parsing APIs and documentation
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6953 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_chanspy.c39
-rwxr-xr-xapps/app_controlplayback.c2
-rwxr-xr-xapps/app_cut.c2
-rwxr-xr-xapps/app_dial.c52
-rwxr-xr-xapps/app_dictate.c2
-rwxr-xr-xapps/app_meetme.c46
-rwxr-xr-xapps/app_mixmonitor.c51
-rwxr-xr-xapps/app_page.c16
-rwxr-xr-xapps/app_read.c2
-rwxr-xr-xapps/app_voicemail.c42
10 files changed, 138 insertions, 116 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index d9138ed00..116441cb9 100755
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -69,18 +69,27 @@ static const char *desc = " Chanspy([<scanspec>][|<options>])\n\n"
static const char *chanspy_spy_type = "ChanSpy";
-#define OPTION_QUIET (1 << 0) /* Quiet, no announcement */
-#define OPTION_BRIDGED (1 << 1) /* Only look at bridged calls */
-#define OPTION_VOLUME (1 << 2) /* Specify initial volume */
-#define OPTION_GROUP (1 << 3) /* Only look at channels in group */
-#define OPTION_RECORD (1 << 4) /* Record */
-
-AST_DECLARE_OPTIONS(chanspy_opts,{
- ['q'] = { OPTION_QUIET },
- ['b'] = { OPTION_BRIDGED },
- ['v'] = { OPTION_VOLUME, 1 },
- ['g'] = { OPTION_GROUP, 2 },
- ['r'] = { OPTION_RECORD, 3 },
+enum {
+ OPTION_QUIET = (1 << 0), /* Quiet, no announcement */
+ OPTION_BRIDGED = (1 << 1), /* Only look at bridged calls */
+ OPTION_VOLUME = (1 << 2), /* Specify initial volume */
+ OPTION_GROUP = (1 << 3), /* Only look at channels in group */
+ OPTION_RECORD = (1 << 4), /* Record */
+} chanspy_opt_flags;
+
+enum {
+ OPT_ARG_VOLUME = 0,
+ OPT_ARG_GROUP,
+ OPT_ARG_RECORD,
+ OPT_ARG_ARRAY_SIZE,
+} chanspy_opt_args;
+
+AST_APP_OPTIONS(chanspy_opts, {
+ AST_APP_OPTION('q', OPTION_QUIET),
+ AST_APP_OPTION('b', OPTION_BRIDGED),
+ AST_APP_OPTION_ARG('v', OPTION_VOLUME, OPT_ARG_VOLUME),
+ AST_APP_OPTION_ARG('g', OPTION_GROUP, OPT_ARG_GROUP),
+ AST_APP_OPTION_ARG('r', OPTION_RECORD, OPT_ARG_RECORD),
});
STANDARD_LOCAL_USER;
@@ -384,7 +393,7 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
ast_set_flag(chan, AST_FLAG_SPYING); /* so nobody can spy on us while we are spying */
- if ((argc = ast_separate_app_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
+ if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
spec = argv[0];
if ( argc > 1) {
options = argv[1];
@@ -395,8 +404,8 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
}
if (options) {
- char *opts[3];
- ast_parseoptions(chanspy_opts, &flags, opts, options);
+ char *opts[OPT_ARG_ARRAY_SIZE];
+ ast_app_parse_options(chanspy_opts, &flags, opts, options);
if (ast_test_flag(&flags, OPTION_GROUP)) {
mygroup = opts[1];
}
diff --git a/apps/app_controlplayback.c b/apps/app_controlplayback.c
index 21320ac9d..0c56c926f 100755
--- a/apps/app_controlplayback.c
+++ b/apps/app_controlplayback.c
@@ -91,7 +91,7 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
tmp = ast_strdupa(data);
memset(argv, 0, sizeof(argv));
- argc = ast_separate_app_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0]));
+ argc = ast_app_separate_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0]));
if (argc < 1) {
ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n");
diff --git a/apps/app_cut.c b/apps/app_cut.c
index 95b5b1ded..ab41d3437 100755
--- a/apps/app_cut.c
+++ b/apps/app_cut.c
@@ -160,7 +160,7 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size
if (data) {
s = ast_strdupa((char *)data);
if (s) {
- ast_separate_app_args(s, '|', args, 3);
+ ast_app_separate_args(s, '|', args, 3);
varname = args[0];
delimiter = args[1];
field = args[2];
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 50b2761c0..bfaefba1e 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -670,31 +670,31 @@ enum {
OPT_ARG_ARRAY_SIZE,
} dial_exec_option_args;
-AST_DECLARE_OPTIONS(dial_exec_options, {
- ['A'] = { .flag = OPT_ANNOUNCE, .arg_index = OPT_ARG_ANNOUNCE + 1, },
- ['C'] = { .flag = OPT_RESETCDR, },
- ['d'] = { .flag = OPT_DTMF_EXIT, },
- ['D'] = { .flag = OPT_SENDDTMF, .arg_index = OPT_ARG_SENDDTMF + 1, },
- ['f'] = { .flag = OPT_FORCECLID, },
- ['g'] = { .flag = OPT_GO_ON, },
- ['G'] = { .flag = OPT_GOTO, .arg_index = OPT_ARG_GOTO + 1, },
- ['h'] = { .flag = OPT_CALLEE_HANGUP, },
- ['H'] = { .flag = OPT_CALLER_HANGUP, },
- ['j'] = { .flag = OPT_PRIORITY_JUMP, },
- ['L'] = { .flag = OPT_DURATION_LIMIT, .arg_index = OPT_ARG_DURATION_LIMIT + 1, },
- ['m'] = { .flag = OPT_MUSICBACK, .arg_index = OPT_ARG_MUSICBACK + 1, },
- ['M'] = { .flag = OPT_CALLEE_MACRO, .arg_index = OPT_ARG_CALLEE_MACRO + 1, },
- ['n'] = { .flag = OPT_SCREEN_NOINTRO, },
- ['N'] = { .flag = OPT_SCREEN_NOCLID, },
- ['o'] = { .flag = OPT_ORIGINAL_CLID, },
- ['p'] = { .flag = OPT_SCREENING, },
- ['P'] = { .flag = OPT_PRIVACY, .arg_index = OPT_ARG_PRIVACY + 1, },
- ['r'] = { .flag = OPT_RINGBACK, },
- ['S'] = { .flag = OPT_DURATION_STOP, .arg_index = OPT_ARG_DURATION_STOP + 1, },
- ['t'] = { .flag = OPT_CALLEE_TRANSFER, },
- ['T'] = { .flag = OPT_CALLER_TRANSFER, },
- ['w'] = { .flag = OPT_CALLEE_MONITOR, },
- ['W'] = { .flag = OPT_CALLER_MONITOR, },
+AST_APP_OPTIONS(dial_exec_options, {
+ AST_APP_OPTION_ARG('A', OPT_ANNOUNCE, OPT_ARG_ANNOUNCE),
+ AST_APP_OPTION('C', OPT_RESETCDR),
+ AST_APP_OPTION('d', OPT_DTMF_EXIT),
+ AST_APP_OPTION_ARG('D', OPT_SENDDTMF, OPT_ARG_SENDDTMF),
+ AST_APP_OPTION('f', OPT_FORCECLID),
+ AST_APP_OPTION('g', OPT_GO_ON),
+ AST_APP_OPTION_ARG('G', OPT_GOTO, OPT_ARG_GOTO),
+ AST_APP_OPTION('h', OPT_CALLEE_HANGUP),
+ AST_APP_OPTION('H', OPT_CALLER_HANGUP),
+ AST_APP_OPTION('j', OPT_PRIORITY_JUMP),
+ AST_APP_OPTION_ARG('L', OPT_DURATION_LIMIT, OPT_ARG_DURATION_LIMIT),
+ AST_APP_OPTION_ARG('m', OPT_MUSICBACK, OPT_ARG_MUSICBACK),
+ AST_APP_OPTION_ARG('M', OPT_CALLEE_MACRO, OPT_ARG_CALLEE_MACRO),
+ AST_APP_OPTION('n', OPT_SCREEN_NOINTRO),
+ AST_APP_OPTION('N', OPT_SCREEN_NOCLID),
+ AST_APP_OPTION('o', OPT_ORIGINAL_CLID),
+ AST_APP_OPTION('p', OPT_SCREENING),
+ AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
+ AST_APP_OPTION('r', OPT_RINGBACK),
+ AST_APP_OPTION_ARG('S', OPT_DURATION_STOP, OPT_ARG_DURATION_STOP),
+ AST_APP_OPTION('t', OPT_CALLEE_TRANSFER),
+ AST_APP_OPTION('T', OPT_CALLER_TRANSFER),
+ AST_APP_OPTION('w', OPT_CALLEE_MONITOR),
+ AST_APP_OPTION('W', OPT_CALLER_MONITOR),
});
static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags)
@@ -762,7 +762,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
AST_STANDARD_APP_ARGS(args, parse);
if (!ast_strlen_zero(args.options)) {
- if (ast_parseoptions(dial_exec_options, &opts, opt_args, args.options)) {
+ if (ast_app_parse_options(dial_exec_options, &opts, opt_args, args.options)) {
LOCAL_USER_REMOVE(u);
return -1;
}
diff --git a/apps/app_dictate.c b/apps/app_dictate.c
index 0df5a5604..71c7fb863 100755
--- a/apps/app_dictate.c
+++ b/apps/app_dictate.c
@@ -102,7 +102,7 @@ static int dictate_exec(struct ast_channel *chan, void *data)
snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
if (!ast_strlen_zero(data) && (mydata = ast_strdupa(data))) {
- argc = ast_separate_app_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
+ argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
}
if (argc) {
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 88e5b76ff..742b6ec68 100755
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -219,28 +219,28 @@ static void *recordthread(void *args);
#define CONFFLAG_ANNOUNCEUSERCOUNT (1 << 22) /* If set, when user joins the conference, they will be told the number of users that are already in */
-AST_DECLARE_OPTIONS(meetme_opts,{
- ['a'] = { CONFFLAG_ADMIN },
- ['c'] = { CONFFLAG_ANNOUNCEUSERCOUNT },
- ['T'] = { CONFFLAG_MONITORTALKER },
- ['i'] = { CONFFLAG_INTROUSER },
- ['m'] = { CONFFLAG_MONITOR },
- ['p'] = { CONFFLAG_POUNDEXIT },
- ['s'] = { CONFFLAG_STARMENU },
- ['t'] = { CONFFLAG_TALKER },
- ['q'] = { CONFFLAG_QUIET },
- ['M'] = { CONFFLAG_MOH },
- ['x'] = { CONFFLAG_MARKEDEXIT },
- ['X'] = { CONFFLAG_EXIT_CONTEXT },
- ['A'] = { CONFFLAG_MARKEDUSER },
- ['b'] = { CONFFLAG_AGI },
- ['w'] = { CONFFLAG_WAITMARKED },
- ['r'] = { CONFFLAG_RECORDCONF },
- ['d'] = { CONFFLAG_DYNAMIC },
- ['D'] = { CONFFLAG_DYNAMICPIN },
- ['e'] = { CONFFLAG_EMPTY },
- ['E'] = { CONFFLAG_EMPTYNOPIN },
- ['P'] = { CONFFLAG_ALWAYSPROMPT },
+AST_APP_OPTIONS(meetme_opts, {
+ AST_APP_OPTION('a', CONFFLAG_ADMIN ),
+ AST_APP_OPTION('c', CONFFLAG_ANNOUNCEUSERCOUNT ),
+ AST_APP_OPTION('T', CONFFLAG_MONITORTALKER ),
+ AST_APP_OPTION('i', CONFFLAG_INTROUSER ),
+ AST_APP_OPTION('m', CONFFLAG_MONITOR ),
+ AST_APP_OPTION('p', CONFFLAG_POUNDEXIT ),
+ AST_APP_OPTION('s', CONFFLAG_STARMENU ),
+ AST_APP_OPTION('t', CONFFLAG_TALKER ),
+ AST_APP_OPTION('q', CONFFLAG_QUIET ),
+ AST_APP_OPTION('M', CONFFLAG_MOH ),
+ AST_APP_OPTION('x', CONFFLAG_MARKEDEXIT ),
+ AST_APP_OPTION('X', CONFFLAG_EXIT_CONTEXT ),
+ AST_APP_OPTION('A', CONFFLAG_MARKEDUSER ),
+ AST_APP_OPTION('b', CONFFLAG_AGI ),
+ AST_APP_OPTION('w', CONFFLAG_WAITMARKED ),
+ AST_APP_OPTION('r', CONFFLAG_RECORDCONF ),
+ AST_APP_OPTION('d', CONFFLAG_DYNAMIC ),
+ AST_APP_OPTION('D', CONFFLAG_DYNAMICPIN ),
+ AST_APP_OPTION('e', CONFFLAG_EMPTY ),
+ AST_APP_OPTION('E', CONFFLAG_EMPTYNOPIN ),
+ AST_APP_OPTION('P', CONFFLAG_ALWAYSPROMPT ),
});
static char *istalking(int x)
@@ -1727,7 +1727,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
ast_copy_string(the_pin, inpin, sizeof(the_pin));
if (inflags) {
- ast_parseoptions(meetme_opts, &confflags, NULL, inflags);
+ ast_app_parse_options(meetme_opts, &confflags, NULL, inflags);
dynamic = ast_test_flag(&confflags, CONFFLAG_DYNAMIC | CONFFLAG_DYNAMICPIN);
if (ast_test_flag(&confflags, CONFFLAG_DYNAMICPIN) && !inpin)
strcpy(the_pin, "q");
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index 554a02c8e..5ad56e4fd 100755
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -85,19 +85,26 @@ struct mixmonitor {
};
enum {
- MUXFLAG_APPEND = (1 << 1),
- MUXFLAG_BRIDGED = (1 << 2),
- MUXFLAG_VOLUME = (1 << 3),
- MUXFLAG_READVOLUME = (1 << 4),
- MUXFLAG_WRITEVOLUME = (1 << 5),
+ MUXFLAG_APPEND = (1 << 1),
+ MUXFLAG_BRIDGED = (1 << 2),
+ MUXFLAG_VOLUME = (1 << 3),
+ MUXFLAG_READVOLUME = (1 << 4),
+ MUXFLAG_WRITEVOLUME = (1 << 5),
} mixmonitor_flags;
-AST_DECLARE_OPTIONS(mixmonitor_opts,{
- ['a'] = { MUXFLAG_APPEND },
- ['b'] = { MUXFLAG_BRIDGED },
- ['v'] = { MUXFLAG_READVOLUME, 1 },
- ['V'] = { MUXFLAG_WRITEVOLUME, 2 },
- ['W'] = { MUXFLAG_VOLUME, 3 },
+enum {
+ OPT_ARG_READVOLUME = 0,
+ OPT_ARG_WRITEVOLUME,
+ OPT_ARG_VOLUME,
+ OPT_ARG_ARRAY_SIZE,
+} mixmonitor_args;
+
+AST_APP_OPTIONS(mixmonitor_opts, {
+ AST_APP_OPTION('a', MUXFLAG_APPEND),
+ AST_APP_OPTION('b', MUXFLAG_BRIDGED),
+ AST_APP_OPTION_ARG('v', MUXFLAG_READVOLUME, OPT_ARG_READVOLUME),
+ AST_APP_OPTION_ARG('V', MUXFLAG_WRITEVOLUME, OPT_ARG_WRITEVOLUME),
+ AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
});
static void stopmon(struct ast_channel *chan, struct ast_channel_spy *spy)
@@ -331,35 +338,35 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data)
}
if (args.options) {
- char *opts[3] = { NULL, };
+ char *opts[OPT_ARG_ARRAY_SIZE] = { NULL, };
- ast_parseoptions(mixmonitor_opts, &flags, opts, args.options);
+ ast_app_parse_options(mixmonitor_opts, &flags, opts, args.options);
if (ast_test_flag(&flags, MUXFLAG_READVOLUME)) {
- if (ast_strlen_zero(opts[0])) {
+ if (ast_strlen_zero(opts[OPT_ARG_READVOLUME])) {
ast_log(LOG_WARNING, "No volume level was provided for the heard volume ('v') option.\n");
- } else if ((sscanf(opts[0], "%d", &x) != 1) || (x < -4) || (x > 4)) {
- ast_log(LOG_NOTICE, "Heard volume must be a number between -4 and 4, not '%s'\n", opts[0]);
+ } else if ((sscanf(opts[OPT_ARG_READVOLUME], "%d", &x) != 1) || (x < -4) || (x > 4)) {
+ ast_log(LOG_NOTICE, "Heard volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_READVOLUME]);
} else {
readvol = get_volfactor(x);
}
}
if (ast_test_flag(&flags, MUXFLAG_WRITEVOLUME)) {
- if (ast_strlen_zero(opts[1])) {
+ if (ast_strlen_zero(opts[OPT_ARG_WRITEVOLUME])) {
ast_log(LOG_WARNING, "No volume level was provided for the spoken volume ('V') option.\n");
- } else if ((sscanf(opts[1], "%d", &x) != 1) || (x < -4) || (x > 4)) {
- ast_log(LOG_NOTICE, "Spoken volume must be a number between -4 and 4, not '%s'\n", opts[1]);
+ } else if ((sscanf(opts[OPT_ARG_WRITEVOLUME], "%d", &x) != 1) || (x < -4) || (x > 4)) {
+ ast_log(LOG_NOTICE, "Spoken volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_WRITEVOLUME]);
} else {
writevol = get_volfactor(x);
}
}
if (ast_test_flag(&flags, MUXFLAG_VOLUME)) {
- if (ast_strlen_zero(opts[2])) {
+ if (ast_strlen_zero(opts[OPT_ARG_VOLUME])) {
ast_log(LOG_WARNING, "No volume level was provided for the combined volume ('W') option.\n");
- } else if ((sscanf(opts[2], "%d", &x) != 1) || (x < -4) || (x > 4)) {
- ast_log(LOG_NOTICE, "Combined volume must be a number between -4 and 4, not '%s'\n", opts[2]);
+ } else if ((sscanf(opts[OPT_ARG_VOLUME], "%d", &x) != 1) || (x < -4) || (x > 4)) {
+ ast_log(LOG_NOTICE, "Combined volume must be a number between -4 and 4, not '%s'\n", opts[OPT_ARG_VOLUME]);
} else {
readvol = writevol = get_volfactor(x);
}
diff --git a/apps/app_page.c b/apps/app_page.c
index 921316d81..d2a65f4e8 100755
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -61,12 +61,14 @@ STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
-#define PAGE_DUPLEX (1 << 0)
-#define PAGE_QUIET (1 << 1)
-
-AST_DECLARE_OPTIONS(page_opts,{
- ['d'] = { PAGE_DUPLEX },
- ['q'] = { PAGE_QUIET },
+enum {
+ PAGE_DUPLEX = (1 << 0),
+ PAGE_QUIET = (1 << 1),
+} page_opt_flags;
+
+AST_APP_OPTIONS(page_opts, {
+ AST_APP_OPTION('d', PAGE_DUPLEX),
+ AST_APP_OPTION('q', PAGE_QUIET),
});
struct calloutdata {
@@ -142,7 +144,7 @@ static int page_exec(struct ast_channel *chan, void *data)
tmp = strsep(&options, "|");
if (options)
- ast_parseoptions(page_opts, &flags, NULL, options);
+ ast_app_parse_options(page_opts, &flags, NULL, options);
snprintf(meetmeopts, sizeof(meetmeopts), "%ud|%sqxdw", confid, ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m");
while ((tech = strsep(&tmp, "&"))) {
diff --git a/apps/app_read.c b/apps/app_read.c
index 0c4e2872b..ed4272da6 100755
--- a/apps/app_read.c
+++ b/apps/app_read.c
@@ -103,7 +103,7 @@ static int read_exec(struct ast_channel *chan, void *data)
return -1;
}
- if (ast_separate_app_args(argcopy, '|', args, sizeof(args) / sizeof(args[0])) < 1) {
+ if (ast_app_separate_args(argcopy, '|', args, sizeof(args) / sizeof(args[0])) < 1) {
ast_log(LOG_WARNING, "Cannot Parse Arguments.\n");
LOCAL_USER_REMOVE(u);
return -1;
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index fab901590..1ab7dceff 100755
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -107,21 +107,25 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#define ERROR_LOCK_PATH -100
-#define OPT_SILENT (1 << 0)
-#define OPT_BUSY_GREETING (1 << 1)
-#define OPT_UNAVAIL_GREETING (1 << 2)
-#define OPT_RECORDGAIN (1 << 3)
-#define OPT_PREPEND_MAILBOX (1 << 4)
-
-#define OPT_ARG_RECORDGAIN 0
-#define OPT_ARG_ARRAY_SIZE 1
-
-AST_DECLARE_OPTIONS(vm_app_options, {
- ['s'] = { .flag = OPT_SILENT },
- ['b'] = { .flag = OPT_BUSY_GREETING },
- ['u'] = { .flag = OPT_UNAVAIL_GREETING },
- ['g'] = { .flag = OPT_RECORDGAIN, .arg_index = OPT_ARG_RECORDGAIN + 1},
- ['p'] = { .flag = OPT_PREPEND_MAILBOX },
+enum {
+ OPT_SILENT =(1 << 0),
+ OPT_BUSY_GREETING = (1 << 1),
+ OPT_UNAVAIL_GREETING = (1 << 2),
+ OPT_RECORDGAIN = (1 << 3),
+ OPT_PREPEND_MAILBOX = (1 << 4),
+} vm_option_flags;
+
+enum {
+ OPT_ARG_RECORDGAIN = 0,
+ OPT_ARG_ARRAY_SIZE = 1,
+} vm_option_args;
+
+AST_APP_OPTIONS(vm_app_options, {
+ AST_APP_OPTION('s', OPT_SILENT),
+ AST_APP_OPTION('b', OPT_BUSY_GREETING),
+ AST_APP_OPTION('u', OPT_UNAVAIL_GREETING),
+ AST_APP_OPTION_ARG('g', OPT_RECORDGAIN, OPT_ARG_RECORDGAIN),
+ AST_APP_OPTION('p', OPT_PREPEND_MAILBOX),
});
static int load_config(void);
@@ -5033,9 +5037,9 @@ static int vm_execmain(struct ast_channel *chan, void *data)
char *opts[OPT_ARG_ARRAY_SIZE];
tmp = ast_strdupa(data);
- argc = ast_separate_app_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0]));
+ argc = ast_app_separate_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0]));
if (argc == 2) {
- if (ast_parseoptions(vm_app_options, &flags, opts, argv[1])) {
+ if (ast_app_parse_options(vm_app_options, &flags, opts, argv[1])) {
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -5460,9 +5464,9 @@ static int vm_exec(struct ast_channel *chan, void *data)
if (!ast_strlen_zero(data)) {
ast_copy_string(tmp, data, sizeof(tmp));
- argc = ast_separate_app_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0]));
+ argc = ast_app_separate_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0]));
if (argc == 2) {
- if (ast_parseoptions(vm_app_options, &flags, opts, argv[1])) {
+ if (ast_app_parse_options(vm_app_options, &flags, opts, argv[1])) {
LOCAL_USER_REMOVE(u);
return -1;
}