[Asterisk-cvs] asterisk/apps app_chanspy.c, 1.29, 1.30 app_controlplayback.c, 1.17, 1.18 app_cut.c, 1.18, 1.19 app_dial.c, 1.177, 1.178 app_dictate.c, 1.9, 1.10 app_meetme.c, 1.117, 1.118 app_mixmonitor.c, 1.9, 1.10 app_page.c, 1.9, 1.10 app_read.c, 1.26, 1.27 app_voicemail.c, 1.258, 1.259

kpfleming kpfleming
Thu Nov 3 16:27:26 CST 2005


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv1836/apps

Modified Files:
	app_chanspy.c app_controlplayback.c app_cut.c app_dial.c 
	app_dictate.c app_meetme.c app_mixmonitor.c app_page.c 
	app_read.c app_voicemail.c 
Log Message:
major update to arg/option parsing APIs and documentation


Index: app_chanspy.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_chanspy.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- app_chanspy.c	28 Oct 2005 23:01:13 -0000	1.29
+++ app_chanspy.c	3 Nov 2005 21:19:10 -0000	1.30
@@ -69,18 +69,27 @@
 
 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 */
+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;
 
-AST_DECLARE_OPTIONS(chanspy_opts,{
-	['q'] = { OPTION_QUIET },
-	['b'] = { OPTION_BRIDGED },
-	['v'] = { OPTION_VOLUME, 1 },
-	['g'] = { OPTION_GROUP, 2 },
-	['r'] = { OPTION_RECORD, 3 },
+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 @@
 
 	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 @@
 	}
 	
 	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];
 		}

Index: app_controlplayback.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_controlplayback.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- app_controlplayback.c	26 Oct 2005 19:48:14 -0000	1.17
+++ app_controlplayback.c	3 Nov 2005 21:19:10 -0000	1.18
@@ -91,7 +91,7 @@
 	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");

Index: app_cut.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_cut.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- app_cut.c	1 Nov 2005 21:02:07 -0000	1.18
+++ app_cut.c	3 Nov 2005 21:19:10 -0000	1.19
@@ -160,7 +160,7 @@
 	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];

Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- app_dial.c	2 Nov 2005 21:50:03 -0000	1.177
+++ app_dial.c	3 Nov 2005 21:19:10 -0000	1.178
@@ -670,31 +670,31 @@
 	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 @@
 	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;
 		}

Index: app_dictate.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dictate.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- app_dictate.c	26 Oct 2005 19:48:14 -0000	1.9
+++ app_dictate.c	3 Nov 2005 21:19:10 -0000	1.10
@@ -102,7 +102,7 @@
 	
 	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) {

Index: app_meetme.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_meetme.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- app_meetme.c	28 Oct 2005 16:36:10 -0000	1.117
+++ app_meetme.c	3 Nov 2005 21:19:10 -0000	1.118
@@ -219,28 +219,28 @@
 #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 @@
 		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");

Index: app_mixmonitor.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_mixmonitor.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- app_mixmonitor.c	1 Nov 2005 20:57:42 -0000	1.9
+++ app_mixmonitor.c	3 Nov 2005 21:19:10 -0000	1.10
@@ -85,19 +85,26 @@
 };
 
 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 @@
 	}
 
 	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);
 			}

Index: app_page.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_page.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- app_page.c	26 Oct 2005 19:48:14 -0000	1.9
+++ app_page.c	3 Nov 2005 21:19:10 -0000	1.10
@@ -61,12 +61,14 @@
 
 LOCAL_USER_DECL;
 
-#define PAGE_DUPLEX (1 << 0)
-#define PAGE_QUIET  (1 << 1)
+enum {
+	PAGE_DUPLEX = (1 << 0),
+	PAGE_QUIET = (1 << 1),
+} page_opt_flags;
 
-AST_DECLARE_OPTIONS(page_opts,{
-	['d'] = { PAGE_DUPLEX },
-	['q'] = { PAGE_QUIET },
+AST_APP_OPTIONS(page_opts, {
+	AST_APP_OPTION('d', PAGE_DUPLEX),
+	AST_APP_OPTION('q', PAGE_QUIET),
 });
 
 struct calloutdata {
@@ -142,7 +144,7 @@
 
 	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, "&"))) {

Index: app_read.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_read.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- app_read.c	26 Oct 2005 19:48:14 -0000	1.26
+++ app_read.c	3 Nov 2005 21:19:10 -0000	1.27
@@ -103,7 +103,7 @@
 		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;

Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.258
retrieving revision 1.259
diff -u -d -r1.258 -r1.259
--- app_voicemail.c	1 Nov 2005 02:20:30 -0000	1.258
+++ app_voicemail.c	3 Nov 2005 21:19:10 -0000	1.259
@@ -107,21 +107,25 @@
 
 #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)
+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;
 
-#define OPT_ARG_RECORDGAIN	0
-#define OPT_ARG_ARRAY_SIZE	1
+enum {
+	OPT_ARG_RECORDGAIN = 0,
+	OPT_ARG_ARRAY_SIZE = 1,
+} vm_option_args;
 
-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 },
+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 @@
 		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 @@
 
 	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;
 			}




More information about the svn-commits mailing list