From fd0b69a4e7f57297f9c011c75820432d693e21a5 Mon Sep 17 00:00:00 2001 From: tilghman Date: Mon, 23 Jul 2007 19:51:41 +0000 Subject: Merge the dialplan_aesthetics branch. Most of this patch simply converts applications using old methods of parsing arguments to using the standard macros. However, the big change is that the really old way of specifying application and arguments separated by a comma will no longer work (e.g. NoOp,foo|bar). Instead, the way that has been recommended since long before 1.0 will become the only method available (e.g. NoOp(foo,bar). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@76703 f38db490-d61c-443f-a65b-d21fe96a405b --- pbx/pbx_config.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'pbx/pbx_config.c') diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 799892ba9..5a7280c9a 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1386,7 +1386,7 @@ static int pbx_load_config(const char *config_file) if (tc) { int ipri = -2; char realext[256]=""; - char *plus, *firstp, *firstc; + char *plus, *firstp; char *pri, *appl, *data, *cidmatch; char *stringp = tc; char *ext = strsep(&stringp, ","); @@ -1433,19 +1433,12 @@ static int pbx_load_config(const char *config_file) ipri = 0; } appl = S_OR(stringp, ""); - /* Find the first occurrence of either '(' or ',' */ - firstc = strchr(appl, ','); + /* Find the first occurrence of '(' */ firstp = strchr(appl, '('); - if (firstc && (!firstp || firstc < firstp)) { - /* comma found, no parenthesis */ - /* or both found, but comma found first */ - appl = strsep(&stringp, ","); - data = stringp; - } else if (!firstc && !firstp) { - /* Neither found */ + if (!firstp) { + /* No arguments */ data = ""; } else { - /* Final remaining case is parenthesis found first */ appl = strsep(&stringp, "("); data = stringp; end = strrchr(data, ')'); @@ -1454,11 +1447,10 @@ static int pbx_load_config(const char *config_file) } else { ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s'\n", appl, data); } - ast_process_quotes_and_slashes(data, ',', '|'); } if (!data) - data=""; + data = ""; appl = ast_skip_blanks(appl); if (ipri) { if (plus) @@ -1483,7 +1475,7 @@ static int pbx_load_config(const char *config_file) if (ast_context_add_ignorepat2(con, realvalue, registrar)) ast_log(LOG_WARNING, "Unable to include ignorepat '%s' in context '%s'\n", v->value, cxt); } else if (!strcasecmp(v->name, "switch") || !strcasecmp(v->name, "lswitch") || !strcasecmp(v->name, "eswitch")) { - char *stringp= realvalue; + char *stringp = realvalue; char *appl, *data; memset(realvalue, 0, sizeof(realvalue)); @@ -1492,9 +1484,7 @@ static int pbx_load_config(const char *config_file) else ast_copy_string(realvalue, v->value, sizeof(realvalue)); appl = strsep(&stringp, "/"); - data = strsep(&stringp, ""); /* XXX what for ? */ - if (!data) - data = ""; + data = S_OR(stringp, ""); if (ast_context_add_switch2(con, appl, data, !strcasecmp(v->name, "eswitch"), registrar)) ast_log(LOG_WARNING, "Unable to include switch '%s' in context '%s'\n", v->value, cxt); } else { -- cgit v1.2.3