[asterisk-commits] trunk - r8007 /trunk/apps/app_dictate.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 12 09:11:50 CST 2006


Author: bweschke
Date: Thu Jan 12 09:11:49 2006
New Revision: 8007

URL: http://svn.digium.com/view/asterisk?rev=8007&view=rev
Log:
 Use argument macro in app_dictate #6222


Modified:
    trunk/apps/app_dictate.c

Modified: trunk/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dictate.c?rev=8007&r1=8006&r2=8007&view=diff
==============================================================================
--- trunk/apps/app_dictate.c (original)
+++ trunk/apps/app_dictate.c Thu Jan 12 09:11:49 2006
@@ -82,7 +82,12 @@
 
 static int dictate_exec(struct ast_channel *chan, void *data)
 {
-	char *mydata, *argv[3], *path = NULL, filein[256], *filename = "";
+	char *path = NULL, filein[256], *filename = "";
+	char *parse;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(base);
+		AST_APP_ARG(filename);
+	);
 	char dftbase[256];
 	char *base;
 	struct ast_flags flags = {0};
@@ -91,7 +96,6 @@
 	struct localuser *u;
 	int ffactor = 320 * 80,
 		res = 0,
-		argc = 0,
 		done = 0,
 		oldr = 0,
 		lastop = 0,
@@ -105,17 +109,23 @@
 	LOCAL_USER_ADD(u);
 	
 	snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
-	if (!ast_strlen_zero(data) && (mydata = ast_strdupa(data))) {
-		argc = ast_app_separate_args(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
-	}
+	if (!ast_strlen_zero(data)) {
+		parse = ast_strdupa(data);
+		if (!parse) {
+			ast_log(LOG_ERROR, "Out of memory!\n");
+			return -1;
+		}
+		AST_STANDARD_APP_ARGS(args, parse);
+	} else
+		args.argc = 0;
 	
-	if (argc) {
-		base = argv[0];
+	if (args.argc && !ast_strlen_zero(args.base)) {
+		base = args.base;
 	} else {
 		base = dftbase;
 	}
-	if (argc && argv[1]) {
-		filename = argv[1];
+	if (args.argc > 1 && args.filename) {
+		filename = args.filename;
 	} 
 	oldr = chan->readformat;
 	if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR)) < 0) {



More information about the asterisk-commits mailing list