Whitespace fix forgotten by someone who added a note about needing to fix this...

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@16234 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Olle Johansson 20 years ago
parent aa029f44f0
commit 16728da6a7

@ -1374,134 +1374,133 @@ static int pbx_load_module(void)
if (con == NULL) if (con == NULL)
continue; continue;
/* XXX indentation should be fixed for this block */ for (v = ast_variable_browse(cfg, cxt); v; v = v->next) {
for (v = ast_variable_browse(cfg, cxt); v; v = v->next) { if (!strcasecmp(v->name, "exten")) {
if (!strcasecmp(v->name, "exten")) { char *ext, *pri, *appl, *data, *cidmatch;
char *ext, *pri, *appl, *data, *cidmatch; char *stringp=NULL;
char *stringp=NULL; int ipri = -2;
int ipri = -2; char realext[256]="";
char realext[256]=""; char *plus, *firstp, *firstc;
char *plus, *firstp, *firstc; char *tc = strdup(v->value);
char *tc = strdup(v->value); if (tc == NULL)
if (tc == NULL) fprintf(stderr,"Error strdup returned NULL in %s\n",__PRETTY_FUNCTION__);
fprintf(stderr,"Error strdup returned NULL in %s\n",__PRETTY_FUNCTION__); else {
else { stringp=tc;
stringp=tc; ext = strsep(&stringp, ",");
ext = strsep(&stringp, ","); if (!ext)
if (!ext) ext="";
ext=""; pbx_substitute_variables_helper(NULL, ext, realext, sizeof(realext) - 1);
pbx_substitute_variables_helper(NULL, ext, realext, sizeof(realext) - 1); cidmatch = strchr(realext, '/');
cidmatch = strchr(realext, '/'); if (cidmatch) {
if (cidmatch) { *cidmatch++ = '\0';
*cidmatch++ = '\0'; ast_shrink_phone_number(cidmatch);
ast_shrink_phone_number(cidmatch); }
} pri = strsep(&stringp, ",");
pri = strsep(&stringp, ","); if (!pri)
if (!pri) pri="";
pri=""; label = strchr(pri, '(');
label = strchr(pri, '('); if (label) {
if (label) { *label++ = '\0';
*label++ = '\0'; end = strchr(label, ')');
end = strchr(label, ')'); if (end)
if (end) *end = '\0';
*end = '\0'; else
else ast_log(LOG_WARNING, "Label missing trailing ')' at line %d\n", v->lineno);
ast_log(LOG_WARNING, "Label missing trailing ')' at line %d\n", v->lineno); }
} plus = strchr(pri, '+');
plus = strchr(pri, '+'); if (plus)
if (plus) *plus++ = '\0';
*plus++ = '\0'; if (!strcmp(pri,"hint"))
if (!strcmp(pri,"hint")) ipri=PRIORITY_HINT;
ipri=PRIORITY_HINT; else if (!strcmp(pri, "next") || !strcmp(pri, "n")) {
else if (!strcmp(pri, "next") || !strcmp(pri, "n")) { if (lastpri > -2)
if (lastpri > -2) ipri = lastpri + 1;
ipri = lastpri + 1; else
else ast_log(LOG_WARNING, "Can't use 'next' priority on the first entry!\n");
ast_log(LOG_WARNING, "Can't use 'next' priority on the first entry!\n"); } else if (!strcmp(pri, "same") || !strcmp(pri, "s")) {
} else if (!strcmp(pri, "same") || !strcmp(pri, "s")) { if (lastpri > -2)
if (lastpri > -2) ipri = lastpri;
ipri = lastpri; else
else ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n");
ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n"); } else {
} else { if (sscanf(pri, "%d", &ipri) != 1) {
if (sscanf(pri, "%d", &ipri) != 1) { if ((ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) {
if ((ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) { ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno);
ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno); ipri = 0;
ipri = 0;
}
} }
} }
appl = stringp; }
if (!appl) appl = stringp;
appl=""; if (!appl)
/* Find the first occurrence of either '(' or ',' */ appl="";
firstc = strchr(appl, ','); /* Find the first occurrence of either '(' or ',' */
firstp = strchr(appl, '('); firstc = strchr(appl, ',');
if (firstc && ((!firstp) || (firstc < firstp))) { firstp = strchr(appl, '(');
/* comma found, no parenthesis */ if (firstc && ((!firstp) || (firstc < firstp))) {
/* or both found, but comma found first */ /* comma found, no parenthesis */
appl = strsep(&stringp, ","); /* or both found, but comma found first */
data = stringp; appl = strsep(&stringp, ",");
} else if ((!firstc) && (!firstp)) { data = stringp;
/* Neither found */ } else if ((!firstc) && (!firstp)) {
data = ""; /* Neither found */
data = "";
} else {
/* Final remaining case is parenthesis found first */
appl = strsep(&stringp, "(");
data = stringp;
end = strrchr(data, ')');
if ((end = strrchr(data, ')'))) {
*end = '\0';
} else { } else {
/* Final remaining case is parenthesis found first */ ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s'\n", appl, data);
appl = strsep(&stringp, "(");
data = stringp;
end = strrchr(data, ')');
if ((end = strrchr(data, ')'))) {
*end = '\0';
} else {
ast_log(LOG_WARNING, "No closing parenthesis found? '%s(%s'\n", appl, data);
}
ast_process_quotes_and_slashes(data, ',', '|');
} }
ast_process_quotes_and_slashes(data, ',', '|');
}
if (!data) if (!data)
data=""; data="";
appl = ast_skip_blanks(appl); appl = ast_skip_blanks(appl);
if (ipri) { if (ipri) {
if (plus) if (plus)
ipri += atoi(plus); ipri += atoi(plus);
lastpri = ipri; lastpri = ipri;
if (!ast_opt_dont_warn) { if (!ast_opt_dont_warn) {
if (!strcmp(realext, "_.")) if (!strcmp(realext, "_."))
ast_log(LOG_WARNING, "The use of '_.' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X.' instead at line %d\n", v->lineno); ast_log(LOG_WARNING, "The use of '_.' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X.' instead at line %d\n", v->lineno);
} }
if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), free, registrar)) { if (ast_add_extension2(con, 0, realext, ipri, label, cidmatch, appl, strdup(data), free, registrar)) {
ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno); ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
}
} }
free(tc);
} }
} else if(!strcasecmp(v->name, "include")) { free(tc);
memset(realvalue, 0, sizeof(realvalue));
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
if (ast_context_add_include2(con, realvalue, registrar))
ast_log(LOG_WARNING, "Unable to include context '%s' in context '%s'\n", v->value, cxt);
} else if(!strcasecmp(v->name, "ignorepat")) {
memset(realvalue, 0, sizeof(realvalue));
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
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 *appl, *data;
memset(realvalue, 0, sizeof(realvalue));
if (!strcasecmp(v->name, "switch"))
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
else
ast_copy_string(realvalue, v->value, sizeof(realvalue));
appl = strsep(&stringp, "/");
data = strsep(&stringp, ""); /* XXX what for ? */
if (!data)
data = "";
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 if(!strcasecmp(v->name, "include")) {
memset(realvalue, 0, sizeof(realvalue));
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
if (ast_context_add_include2(con, realvalue, registrar))
ast_log(LOG_WARNING, "Unable to include context '%s' in context '%s'\n", v->value, cxt);
} else if(!strcasecmp(v->name, "ignorepat")) {
memset(realvalue, 0, sizeof(realvalue));
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
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 *appl, *data;
memset(realvalue, 0, sizeof(realvalue));
if (!strcasecmp(v->name, "switch"))
pbx_substitute_variables_helper(NULL, v->value, realvalue, sizeof(realvalue) - 1);
else
ast_copy_string(realvalue, v->value, sizeof(realvalue));
appl = strsep(&stringp, "/");
data = strsep(&stringp, ""); /* XXX what for ? */
if (!data)
data = "";
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);
} }
}
} }
ast_config_destroy(cfg); ast_config_destroy(cfg);
} }

Loading…
Cancel
Save