[Asterisk-cvs] asterisk pbx.c,1.273,1.274

kpfleming kpfleming
Wed Sep 14 13:21:25 CDT 2005


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

Modified Files:
	pbx.c 
Log Message:
slightly clear argument processing


Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.273
retrieving revision 1.274
diff -u -d -r1.273 -r1.274
--- pbx.c	13 Sep 2005 21:59:45 -0000	1.273
+++ pbx.c	14 Sep 2005 17:19:55 -0000	1.274
@@ -5574,7 +5574,7 @@
 {
 	int res = 0;
 	int argc;
-	char *args;
+	char *parse;
 	char *argv[4];
 	char *options = NULL; 
 	char *filename = NULL;
@@ -5583,19 +5583,22 @@
 	char *context = NULL;
 	struct ast_flags flags = {0};
 
-	args = ast_strdupa(data);
+	parse = ast_strdupa(data);
 
-	if ((argc = ast_separate_app_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
-		if (argc > 0) {
+	if ((argc = ast_separate_app_args(parse, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
+		switch (argc) {
+		case 4:
+			context = argv[3];
+		case 3:
+			lang = argv[2];
+		case 2:
+			options = argv[1];
+		case 1:
 			filename = argv[0];
-			if (argc > 1)
-				options = argv[1];
-			if (argc > 2)
-				lang = argv[2];
-			if (argc > 3)
-				context = argv[3];
-		} else {
+			break;
+		default:
 			ast_log(LOG_WARNING, "Background requires an argument (filename)\n");
+			break;
 		}
 	}
 




More information about the svn-commits mailing list