This issue sort of closes 10786; All config files support #include with globbing (you know, *,[chars],?,{list,list},etc), so I've updated the AEL system to support this also.
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Filename is incredibly way too long (%d chars!). Inclusion ignored!\n", my_file, my_lineno, my_col, yyleng - 10);
} else {
int i;
strncpy(fnamebuf, p1, p2-p1);
fnamebuf[p2-p1] = 0;
for (i=0; i<include_stack_index; i++) {
if ( !strcmp(fnamebuf,include_stack[i].fname )) {
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n",
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Couldn't find the include file: %s; ignoring the Include directive!\n", my_file, my_lineno, my_col, fnamebuf);
if (glob_ret == GLOB_NOSPACE) {
ast_log(LOG_WARNING,
"Glob Expansion of pattern '%s' failed: Not enough memory\n", fnamebuf);
} else if (glob_ret == GLOB_ABORTED) {
ast_log(LOG_WARNING,
"Glob Expansion of pattern '%s' failed: Read error\n", fnamebuf);
} else if (glob_ret == GLOB_NOMATCH) {
ast_log(LOG_WARNING,
"Glob Expansion of pattern '%s' failed: No matches!\n", fnamebuf);
} else {
char *buffer;
struct stat stats;
stat(fnamebuf, &stats);
buffer = (char*)malloc(stats.st_size+1);
fread(buffer, 1, stats.st_size, in1);
buffer[stats.st_size] = 0;
ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf, (int)stats.st_size);
ast_log(LOG_ERROR,"Include file name not present!\n");
return;
}
for (i=0; i<include_stack_index; i++) {
if ( !strcmp(fnamebuf,include_stack[i].fname )) {
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n",
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Couldn't find the include file: %s; ignoring the Include directive!\n", my_file, my_lineno, my_col, fnamebuf2);
} else {
char *buffer;
struct stat stats;
stat(fnamebuf2, &stats);
buffer = (char*)malloc(stats.st_size+1);
fread(buffer, 1, stats.st_size, in1);
buffer[stats.st_size] = 0;
ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf2, (int)stats.st_size);
/* Code executed at the beginning of each rule, after yytext and yyleng
@ -1116,10 +1130,10 @@ YY_DECL
registerintyy_act;
structyyguts_t*yyg=(structyyguts_t*)yyscanner;
#line 173 "ael.flex"
#line 181 "ael.flex"
#line 1122 "ael_lex.c"
#line 1136 "ael_lex.c"
yylval=yylval_param;
@ -1210,250 +1224,250 @@ do_action: /* This label is used only to access EOF actions. */
case1:
YY_RULE_SETUP
#line 175 "ael.flex"
#line 183 "ael.flex"
{STORE_POS;returnLC;}
YY_BREAK
case2:
YY_RULE_SETUP
#line 176 "ael.flex"
#line 184 "ael.flex"
{STORE_POS;returnRC;}
YY_BREAK
case3:
YY_RULE_SETUP
#line 177 "ael.flex"
#line 185 "ael.flex"
{STORE_POS;returnLP;}
YY_BREAK
case4:
YY_RULE_SETUP
#line 178 "ael.flex"
#line 186 "ael.flex"
{STORE_POS;returnRP;}
YY_BREAK
case5:
YY_RULE_SETUP
#line 179 "ael.flex"
#line 187 "ael.flex"
{STORE_POS;returnSEMI;}
YY_BREAK
case6:
YY_RULE_SETUP
#line 180 "ael.flex"
#line 188 "ael.flex"
{STORE_POS;returnEQ;}
YY_BREAK
case7:
YY_RULE_SETUP
#line 181 "ael.flex"
#line 189 "ael.flex"
{STORE_POS;returnCOMMA;}
YY_BREAK
case8:
YY_RULE_SETUP
#line 182 "ael.flex"
#line 190 "ael.flex"
{STORE_POS;returnCOLON;}
YY_BREAK
case9:
YY_RULE_SETUP
#line 183 "ael.flex"
#line 191 "ael.flex"
{STORE_POS;returnAMPER;}
YY_BREAK
case10:
YY_RULE_SETUP
#line 184 "ael.flex"
#line 192 "ael.flex"
{STORE_POS;returnBAR;}
YY_BREAK
case11:
YY_RULE_SETUP
#line 185 "ael.flex"
#line 193 "ael.flex"
{STORE_POS;returnEXTENMARK;}
YY_BREAK
case12:
YY_RULE_SETUP
#line 186 "ael.flex"
#line 194 "ael.flex"
{STORE_POS;returnAT;}
YY_BREAK
case13:
YY_RULE_SETUP
#line 187 "ael.flex"
#line 195 "ael.flex"
{/*comment*/}
YY_BREAK
case14:
YY_RULE_SETUP
#line 188 "ael.flex"
#line 196 "ael.flex"
{STORE_POS;returnKW_CONTEXT;}
YY_BREAK
case15:
YY_RULE_SETUP
#line 189 "ael.flex"
#line 197 "ael.flex"
{STORE_POS;returnKW_ABSTRACT;}
YY_BREAK
case16:
YY_RULE_SETUP
#line 190 "ael.flex"
#line 198 "ael.flex"
{STORE_POS;returnKW_MACRO;};
YY_BREAK
case17:
YY_RULE_SETUP
#line 191 "ael.flex"
#line 199 "ael.flex"
{STORE_POS;returnKW_GLOBALS;}
YY_BREAK
case18:
YY_RULE_SETUP
#line 192 "ael.flex"
#line 200 "ael.flex"
{STORE_POS;returnKW_IGNOREPAT;}
YY_BREAK
case19:
YY_RULE_SETUP
#line 193 "ael.flex"
#line 201 "ael.flex"
{STORE_POS;returnKW_SWITCH;}
YY_BREAK
case20:
YY_RULE_SETUP
#line 194 "ael.flex"
#line 202 "ael.flex"
{STORE_POS;returnKW_IF;}
YY_BREAK
case21:
YY_RULE_SETUP
#line 195 "ael.flex"
#line 203 "ael.flex"
{STORE_POS;returnKW_IFTIME;}
YY_BREAK
case22:
YY_RULE_SETUP
#line 196 "ael.flex"
#line 204 "ael.flex"
{STORE_POS;returnKW_RANDOM;}
YY_BREAK
case23:
YY_RULE_SETUP
#line 197 "ael.flex"
#line 205 "ael.flex"
{STORE_POS;returnKW_REGEXTEN;}
YY_BREAK
case24:
YY_RULE_SETUP
#line 198 "ael.flex"
#line 206 "ael.flex"
{STORE_POS;returnKW_HINT;}
YY_BREAK
case25:
YY_RULE_SETUP
#line 199 "ael.flex"
#line 207 "ael.flex"
{STORE_POS;returnKW_ELSE;}
YY_BREAK
case26:
YY_RULE_SETUP
#line 200 "ael.flex"
#line 208 "ael.flex"
{STORE_POS;returnKW_GOTO;}
YY_BREAK
case27:
YY_RULE_SETUP
#line 201 "ael.flex"
#line 209 "ael.flex"
{STORE_POS;returnKW_JUMP;}
YY_BREAK
case28:
YY_RULE_SETUP
#line 202 "ael.flex"
#line 210 "ael.flex"
{STORE_POS;returnKW_RETURN;}
YY_BREAK
case29:
YY_RULE_SETUP
#line 203 "ael.flex"
#line 211 "ael.flex"
{STORE_POS;returnKW_BREAK;}
YY_BREAK
case30:
YY_RULE_SETUP
#line 204 "ael.flex"
#line 212 "ael.flex"
{STORE_POS;returnKW_CONTINUE;}
YY_BREAK
case31:
YY_RULE_SETUP
#line 205 "ael.flex"
#line 213 "ael.flex"
{STORE_POS;returnKW_FOR;}
YY_BREAK
case32:
YY_RULE_SETUP
#line 206 "ael.flex"
#line 214 "ael.flex"
{STORE_POS;returnKW_WHILE;}
YY_BREAK
case33:
YY_RULE_SETUP
#line 207 "ael.flex"
#line 215 "ael.flex"
{STORE_POS;returnKW_CASE;}
YY_BREAK
case34:
YY_RULE_SETUP
#line 208 "ael.flex"
#line 216 "ael.flex"
{STORE_POS;returnKW_DEFAULT;}
YY_BREAK
case35:
YY_RULE_SETUP
#line 209 "ael.flex"
#line 217 "ael.flex"
{STORE_POS;returnKW_PATTERN;}
YY_BREAK
case36:
YY_RULE_SETUP
#line 210 "ael.flex"
#line 218 "ael.flex"
{STORE_POS;returnKW_CATCH;}
YY_BREAK
case37:
YY_RULE_SETUP
#line 211 "ael.flex"
#line 219 "ael.flex"
{STORE_POS;returnKW_SWITCHES;}
YY_BREAK
case38:
YY_RULE_SETUP
#line 212 "ael.flex"
#line 220 "ael.flex"
{STORE_POS;returnKW_ESWITCHES;}
YY_BREAK
case39:
YY_RULE_SETUP
#line 213 "ael.flex"
#line 221 "ael.flex"
{STORE_POS;returnKW_INCLUDES;}
YY_BREAK
case40:
YY_RULE_SETUP
#line 214 "ael.flex"
#line 222 "ael.flex"
{BEGIN(comment);my_col+=2;}
YY_BREAK
case41:
YY_RULE_SETUP
#line 216 "ael.flex"
#line 224 "ael.flex"
{my_col+=yyleng;}
YY_BREAK
case42:
/* rule 42 can match eol */
YY_RULE_SETUP
#line 217 "ael.flex"
#line 225 "ael.flex"
{++my_lineno;my_col=1;}
YY_BREAK
case43:
YY_RULE_SETUP
#line 218 "ael.flex"
#line 226 "ael.flex"
{my_col+=yyleng;}
YY_BREAK
case44:
/* rule 44 can match eol */
YY_RULE_SETUP
#line 219 "ael.flex"
#line 227 "ael.flex"
{++my_lineno;my_col=1;}
YY_BREAK
case45:
YY_RULE_SETUP
#line 220 "ael.flex"
#line 228 "ael.flex"
{my_col+=2;BEGIN(INITIAL);}
YY_BREAK
case46:
/* rule 46 can match eol */
YY_RULE_SETUP
#line 222 "ael.flex"
#line 230 "ael.flex"
{my_lineno++;my_col=1;}
YY_BREAK
case47:
YY_RULE_SETUP
#line 223 "ael.flex"
#line 231 "ael.flex"
{my_col+=yyleng;}
YY_BREAK
case48:
YY_RULE_SETUP
#line 224 "ael.flex"
#line 232 "ael.flex"
{my_col+=(yyleng*8)-(my_col%8);}
YY_BREAK
case49:
YY_RULE_SETUP
#line 226 "ael.flex"
#line 234 "ael.flex"
{
STORE_POS;
yylval->str=strdup(yytext);
@ -1471,7 +1485,7 @@ YY_RULE_SETUP
case50:
/* rule 50 can match eol */
YY_RULE_SETUP
#line 242 "ael.flex"
#line 250 "ael.flex"
{
if(pbcpop(')')){/* error */
STORE_LOC;
@ -1497,7 +1511,7 @@ YY_RULE_SETUP
case51:
/* rule 51 can match eol */
YY_RULE_SETUP
#line 264 "ael.flex"
#line 272 "ael.flex"
{
charc=yytext[yyleng-1];
if(c=='(')
@ -1509,7 +1523,7 @@ YY_RULE_SETUP
case52:
/* rule 52 can match eol */
YY_RULE_SETUP
#line 272 "ael.flex"
#line 280 "ael.flex"
{
charc=yytext[yyleng-1];
if(pbcpop(c)){/* error */
@ -1534,7 +1548,7 @@ YY_RULE_SETUP
case53:
/* rule 53 can match eol */
YY_RULE_SETUP
#line 294 "ael.flex"
#line 302 "ael.flex"
{
charc=yytext[yyleng-1];
if(c=='(')
@ -1546,7 +1560,7 @@ YY_RULE_SETUP
case54:
/* rule 54 can match eol */
YY_RULE_SETUP
#line 302 "ael.flex"
#line 310 "ael.flex"
{
if(pbcpop(')')){/* error */
STORE_LOC;
@ -1574,7 +1588,7 @@ YY_RULE_SETUP
case55:
/* rule 55 can match eol */
YY_RULE_SETUP
#line 326 "ael.flex"
#line 334 "ael.flex"
{
if(parencount!=0){/* printf("Folding in a comma!\n"); */
yymore();
@ -1592,7 +1606,7 @@ YY_RULE_SETUP
case56:
/* rule 56 can match eol */
YY_RULE_SETUP
#line 340 "ael.flex"
#line 348 "ael.flex"
{
charc=yytext[yyleng-1];
if(pbcpop(c)){/* error */
@ -1613,7 +1627,7 @@ YY_RULE_SETUP
case57:
/* rule 57 can match eol */
YY_RULE_SETUP
#line 357 "ael.flex"
#line 365 "ael.flex"
{
charc=yytext[yyleng-1];
yymore();
@ -1623,7 +1637,7 @@ YY_RULE_SETUP
case58:
/* rule 58 can match eol */
YY_RULE_SETUP
#line 363 "ael.flex"
#line 371 "ael.flex"
{
charc=yytext[yyleng-1];
if(pbcpop(c)){/* error */
@ -1639,7 +1653,7 @@ YY_RULE_SETUP
case59:
/* rule 59 can match eol */
YY_RULE_SETUP
#line 375 "ael.flex"
#line 383 "ael.flex"
{
STORE_LOC;
yylval->str=strdup(yytext);
@ -1652,11 +1666,14 @@ YY_RULE_SETUP
case60:
/* rule 60 can match eol */
YY_RULE_SETUP
#line 384 "ael.flex"
#line 392 "ael.flex"
{
FILE*in1;
charfnamebuf[1024],*p1,*p2;
interror=1;/* don't use the file if set */
intglob_ret;
glob_tglobbuf;/* the current globbuf */
intglobbuf_pos=-1;/* where we are in the current globbuf */
globbuf.gl_offs=0;/* initialize it to silence gcc */
p1=strchr(yytext,'"');
p2=strrchr(yytext,'"');
if(include_stack_index>=MAX_INCLUDE_DEPTH){
@ -1664,56 +1681,30 @@ YY_RULE_SETUP
}elseif((int)(p2-p1)>sizeof(fnamebuf)-1){
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Filename is incredibly way too long (%d chars!). Inclusion ignored!\n",my_file,my_lineno,my_col,yyleng-10);
}else{
inti;
strncpy(fnamebuf,p1,p2-p1);
fnamebuf[p2-p1]=0;
for(i=0;i<include_stack_index;i++){
if(!strcmp(fnamebuf,include_stack[i].fname)){
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n",
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Couldn't find the include file: %s; ignoring the Include directive!\n",my_file,my_lineno,my_col,fnamebuf);
if(glob_ret==GLOB_NOSPACE){
ast_log(LOG_WARNING,
"Glob Expansion of pattern '%s' failed: Not enough memory\n",fnamebuf);
}elseif(glob_ret==GLOB_ABORTED){
ast_log(LOG_WARNING,
"Glob Expansion of pattern '%s' failed: Read error\n",fnamebuf);
}elseif(glob_ret==GLOB_NOMATCH){
ast_log(LOG_WARNING,
"Glob Expansion of pattern '%s' failed: No matches!\n",fnamebuf);
}else{
char*buffer;
structstatstats;
stat(fnamebuf,&stats);
buffer=(char*)malloc(stats.st_size+1);
fread(buffer,1,stats.st_size,in1);
buffer[stats.st_size]=0;
ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf,(int)stats.st_size);
ast_log(LOG_ERROR,"Include file name not present!\n");
return;
}
for(i=0;i<include_stack_index;i++){
if(!strcmp(fnamebuf,include_stack[i].fname)){
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Nice Try!!! But %s has already been included (perhaps by another file), and would cause an infinite loop of file inclusions!!! Include directive ignored\n",
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Couldn't find the include file: %s; ignoring the Include directive!\n",my_file,my_lineno,my_col,fnamebuf2);
}else{
char*buffer;
structstatstats;
stat(fnamebuf2,&stats);
buffer=(char*)malloc(stats.st_size+1);
fread(buffer,1,stats.st_size,in1);
buffer[stats.st_size]=0;
ast_log(LOG_NOTICE," --Read in included file %s, %d chars\n",fnamebuf2,(int)stats.st_size);