|
|
@ -1224,7 +1224,7 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, const ch
|
|
|
|
int length;
|
|
|
|
int length;
|
|
|
|
char workspace[4096];
|
|
|
|
char workspace[4096];
|
|
|
|
char ltmp[4096], var[4096];
|
|
|
|
char ltmp[4096], var[4096];
|
|
|
|
char *nextvar, *nextexp, *nextfunc;
|
|
|
|
char *nextvar, *nextexp, *nextfunc, *nextthing;
|
|
|
|
char *vars, *vare;
|
|
|
|
char *vars, *vare;
|
|
|
|
int pos, brackets, needsub, len, needfunc;
|
|
|
|
int pos, brackets, needsub, len, needfunc;
|
|
|
|
|
|
|
|
|
|
|
@ -1234,35 +1234,23 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, const ch
|
|
|
|
while(!ast_strlen_zero(whereweare) && count) {
|
|
|
|
while(!ast_strlen_zero(whereweare) && count) {
|
|
|
|
/* Assume we're copying the whole remaining string */
|
|
|
|
/* Assume we're copying the whole remaining string */
|
|
|
|
pos = strlen(whereweare);
|
|
|
|
pos = strlen(whereweare);
|
|
|
|
|
|
|
|
nextvar = NULL;
|
|
|
|
/* Look for a variable */
|
|
|
|
nextexp = NULL;
|
|
|
|
nextvar = strstr(whereweare, "${");
|
|
|
|
nextfunc = NULL;
|
|
|
|
|
|
|
|
nextthing = strchr(whereweare, '$');
|
|
|
|
/* Look for an expression */
|
|
|
|
if (nextthing) {
|
|
|
|
nextexp = strstr(whereweare, "$[");
|
|
|
|
switch(nextthing[1]) {
|
|
|
|
|
|
|
|
case '{':
|
|
|
|
/* Look for a function */
|
|
|
|
nextvar = nextthing;
|
|
|
|
nextfunc = strstr(whereweare, "$(");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '[':
|
|
|
|
/* Pick the first one only */
|
|
|
|
nextexp = nextthing;
|
|
|
|
len = 0;
|
|
|
|
break;
|
|
|
|
if (nextvar)
|
|
|
|
case '(':
|
|
|
|
len++;
|
|
|
|
nextfunc = nextthing;
|
|
|
|
if(nextexp)
|
|
|
|
break;
|
|
|
|
len++;
|
|
|
|
}
|
|
|
|
if(nextfunc)
|
|
|
|
|
|
|
|
len++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (len > 1) {
|
|
|
|
|
|
|
|
if(nextfunc) {
|
|
|
|
|
|
|
|
nextvar = nextexp = NULL;
|
|
|
|
|
|
|
|
} else if (nextvar) {
|
|
|
|
|
|
|
|
nextexp = nextfunc = NULL;
|
|
|
|
|
|
|
|
} else if (nextexp) {
|
|
|
|
|
|
|
|
nextvar = nextfunc = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* If there is one, we only go that far */
|
|
|
|
/* If there is one, we only go that far */
|
|
|
|
if (nextvar)
|
|
|
|
if (nextvar)
|
|
|
|
pos = nextvar - whereweare;
|
|
|
|
pos = nextvar - whereweare;
|
|
|
|