|
@@ -123,7 +123,7 @@
|
|
%}
|
|
%}
|
|
|
|
|
|
/* start conditions */
|
|
/* start conditions */
|
|
-%x STRING1 STRING2 STR_BETWEEN COMMENT COMMENT_LN ATTR SELECT AVP_PVAR PVAR_P
|
|
|
|
|
|
+%x STRING1 STRING2 STR_BETWEEN COMMENT COMMENT_LN ATTR SELECT AVP_PVAR PVAR_P
|
|
%x PVARID INCLF IMPTF EVRTNAME
|
|
%x PVARID INCLF IMPTF EVRTNAME
|
|
%x LINECOMMENT DEFINE_ID DEFINE_EOL DEFINE_DATA IFDEF_ID IFDEF_EOL IFDEF_SKIP
|
|
%x LINECOMMENT DEFINE_ID DEFINE_EOL DEFINE_DATA IFDEF_ID IFDEF_EOL IFDEF_SKIP
|
|
|
|
|
|
@@ -1065,7 +1065,7 @@ IMPORTFILE "import_file"
|
|
yymore();
|
|
yymore();
|
|
break;
|
|
break;
|
|
case SR_COMPAT_MAX:
|
|
case SR_COMPAT_MAX:
|
|
- default:
|
|
|
|
|
|
+ default:
|
|
state=AVP_PVAR_S; BEGIN(AVP_PVAR);
|
|
state=AVP_PVAR_S; BEGIN(AVP_PVAR);
|
|
yymore();
|
|
yymore();
|
|
break;
|
|
break;
|
|
@@ -1131,14 +1131,14 @@ IMPORTFILE "import_file"
|
|
<INITIAL>{CR} { count();/* return CR;*/ }
|
|
<INITIAL>{CR} { count();/* return CR;*/ }
|
|
|
|
|
|
|
|
|
|
-<INITIAL,SELECT>{QUOTES} { count(); old_initial = YY_START;
|
|
|
|
|
|
+<INITIAL,SELECT>{QUOTES} { count(); old_initial = YY_START;
|
|
old_state = state; state=STRING_S;
|
|
old_state = state; state=STRING_S;
|
|
BEGIN(STRING1); }
|
|
BEGIN(STRING1); }
|
|
<INITIAL>{TICK} { count(); old_initial = YY_START; old_state = state;
|
|
<INITIAL>{TICK} { count(); old_initial = YY_START; old_state = state;
|
|
state=STRING_S; BEGIN(STRING2); }
|
|
state=STRING_S; BEGIN(STRING2); }
|
|
|
|
|
|
|
|
|
|
-<STRING1>{QUOTES} { count_more();
|
|
|
|
|
|
+<STRING1>{QUOTES} { count_more();
|
|
yytext[yyleng-1]=0; yyleng--;
|
|
yytext[yyleng-1]=0; yyleng--;
|
|
addstr(&s_buf, yytext, yyleng);
|
|
addstr(&s_buf, yytext, yyleng);
|
|
state=STR_BETWEEN_S;
|
|
state=STR_BETWEEN_S;
|
|
@@ -1172,7 +1172,7 @@ IMPORTFILE "import_file"
|
|
<STR_BETWEEN>{EAT_ABLE}|{CR} { count_ignore(); }
|
|
<STR_BETWEEN>{EAT_ABLE}|{CR} { count_ignore(); }
|
|
<STR_BETWEEN>{QUOTES} { count_more(); state=STRING_S;
|
|
<STR_BETWEEN>{QUOTES} { count_more(); state=STRING_S;
|
|
BEGIN(STRING1);}
|
|
BEGIN(STRING1);}
|
|
-<STR_BETWEEN>. {
|
|
|
|
|
|
+<STR_BETWEEN>. {
|
|
yyless(0); /* reparse it */
|
|
yyless(0); /* reparse it */
|
|
/* ignore the whitespace now that is
|
|
/* ignore the whitespace now that is
|
|
counted, return saved string value */
|
|
counted, return saved string value */
|
|
@@ -1207,7 +1207,7 @@ IMPORTFILE "import_file"
|
|
<INITIAL>{PREP_START}{REDEF}{EAT_ABLE}+ { count(); pp_define_set_type(2);
|
|
<INITIAL>{PREP_START}{REDEF}{EAT_ABLE}+ { count(); pp_define_set_type(2);
|
|
state = DEFINE_S; BEGIN(DEFINE_ID); }
|
|
state = DEFINE_S; BEGIN(DEFINE_ID); }
|
|
<DEFINE_ID>{ID}{MINUS} { count();
|
|
<DEFINE_ID>{ID}{MINUS} { count();
|
|
- LOG(L_CRIT,
|
|
|
|
|
|
+ LM_CRIT(
|
|
"error at %s line %d: '-' not allowed\n",
|
|
"error at %s line %d: '-' not allowed\n",
|
|
(finame)?finame:"cfg", line);
|
|
(finame)?finame:"cfg", line);
|
|
exit(-1);
|
|
exit(-1);
|
|
@@ -1240,7 +1240,7 @@ IMPORTFILE "import_file"
|
|
if (pp_ifdef_type(0)) return 1;
|
|
if (pp_ifdef_type(0)) return 1;
|
|
state = IFDEF_S; BEGIN(IFDEF_ID); }
|
|
state = IFDEF_S; BEGIN(IFDEF_ID); }
|
|
<IFDEF_ID>{ID}{MINUS} { count();
|
|
<IFDEF_ID>{ID}{MINUS} { count();
|
|
- LOG(L_CRIT,
|
|
|
|
|
|
+ LM_CRIT(
|
|
"error at %s line %d: '-' not allowed\n",
|
|
"error at %s line %d: '-' not allowed\n",
|
|
(finame)?finame:"cfg", line);
|
|
(finame)?finame:"cfg", line);
|
|
exit(-1);
|
|
exit(-1);
|
|
@@ -1302,7 +1302,7 @@ IMPORTFILE "import_file"
|
|
r = pp_subst_run(&s_buf.s);
|
|
r = pp_subst_run(&s_buf.s);
|
|
if(sr_push_yy_state(s_buf.s, 1)<0)
|
|
if(sr_push_yy_state(s_buf.s, 1)<0)
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "error at %s line %d\n", (finame)?finame:"cfg", line);
|
|
|
|
|
|
+ LM_CRIT("error at %s line %d\n", (finame)?finame:"cfg", line);
|
|
exit(-1);
|
|
exit(-1);
|
|
}
|
|
}
|
|
memset(&s_buf, 0, sizeof(s_buf));
|
|
memset(&s_buf, 0, sizeof(s_buf));
|
|
@@ -1320,7 +1320,7 @@ IMPORTFILE "import_file"
|
|
memset(&s_buf, 0, sizeof(s_buf));
|
|
memset(&s_buf, 0, sizeof(s_buf));
|
|
return STRING;
|
|
return STRING;
|
|
case STRING_S:
|
|
case STRING_S:
|
|
- LOG(L_CRIT, "ERROR: cfg. parser: unexpected EOF in"
|
|
|
|
|
|
+ LM_CRIT("cfg. parser: unexpected EOF in"
|
|
" unclosed string\n");
|
|
" unclosed string\n");
|
|
if (s_buf.s){
|
|
if (s_buf.s){
|
|
pkg_free(s_buf.s);
|
|
pkg_free(s_buf.s);
|
|
@@ -1329,28 +1329,28 @@ IMPORTFILE "import_file"
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case COMMENT_S:
|
|
case COMMENT_S:
|
|
- LOG(L_CRIT, "ERROR: cfg. parser: unexpected EOF:"
|
|
|
|
|
|
+ LM_CRIT("cfg. parser: unexpected EOF:"
|
|
" %d comments open\n", comment_nest);
|
|
" %d comments open\n", comment_nest);
|
|
break;
|
|
break;
|
|
case COMMENT_LN_S:
|
|
case COMMENT_LN_S:
|
|
- LOG(L_CRIT, "ERROR: unexpected EOF:"
|
|
|
|
|
|
+ LM_CRIT("unexpected EOF:"
|
|
"comment line open\n");
|
|
"comment line open\n");
|
|
break;
|
|
break;
|
|
case ATTR_S:
|
|
case ATTR_S:
|
|
- LOG(L_CRIT, "ERROR: unexpected EOF"
|
|
|
|
|
|
+ LM_CRIT("unexpected EOF"
|
|
" while parsing"
|
|
" while parsing"
|
|
" avp name\n");
|
|
" avp name\n");
|
|
break;
|
|
break;
|
|
case PVARID_S:
|
|
case PVARID_S:
|
|
p_nest=0;
|
|
p_nest=0;
|
|
- case PVAR_P_S:
|
|
|
|
- LOG(L_CRIT, "ERROR: unexpected EOF"
|
|
|
|
|
|
+ case PVAR_P_S:
|
|
|
|
+ LM_CRIT("unexpected EOF"
|
|
" while parsing pvar name"
|
|
" while parsing pvar name"
|
|
" (%d parenthesis open)\n",
|
|
" (%d parenthesis open)\n",
|
|
p_nest);
|
|
p_nest);
|
|
break;
|
|
break;
|
|
case AVP_PVAR_S:
|
|
case AVP_PVAR_S:
|
|
- LOG(L_CRIT, "ERROR: unexpected EOF"
|
|
|
|
|
|
+ LM_CRIT("unexpected EOF"
|
|
" while parsing"
|
|
" while parsing"
|
|
" avp or pvar name\n");
|
|
" avp or pvar name\n");
|
|
}
|
|
}
|
|
@@ -1396,9 +1396,8 @@ static char* addstr(struct str_buf* dst_b, char* src, int len)
|
|
|
|
|
|
return dst_b->s;
|
|
return dst_b->s;
|
|
error:
|
|
error:
|
|
- LOG(L_CRIT, "ERROR:lex:addstr: memory allocation error\n");
|
|
|
|
- LOG(L_CRIT, "ERROR:lex:addstr: try to increase pkg size with"
|
|
|
|
- " -M parameter\n");
|
|
|
|
|
|
+ LM_CRIT("lex: memory allocation error\n");
|
|
|
|
+ LM_CRIT("lex: try to increase pkg size with -M parameter\n");
|
|
exit(-1);
|
|
exit(-1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1483,18 +1482,18 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
|
|
|
|
if ( include_stack_ptr >= MAX_INCLUDE_DEPTH )
|
|
if ( include_stack_ptr >= MAX_INCLUDE_DEPTH )
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "too many includes\n");
|
|
|
|
|
|
+ LM_CRIT("too many includes\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
l = strlen(fin);
|
|
l = strlen(fin);
|
|
if(l>=MAX_INCLUDE_FNAME)
|
|
if(l>=MAX_INCLUDE_FNAME)
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "included file name too long: %s\n", fin);
|
|
|
|
|
|
+ LM_CRIT("included file name too long: %s\n", fin);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
if(fin[0]!='"' || fin[l-1]!='"')
|
|
if(fin[0]!='"' || fin[l-1]!='"')
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "included file name must be between quotes: %s\n", fin);
|
|
|
|
|
|
+ LM_CRIT("included file name must be between quotes: %s\n", fin);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
j = 0;
|
|
j = 0;
|
|
@@ -1504,7 +1503,7 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
case '\\':
|
|
case '\\':
|
|
if(i+1==l-1)
|
|
if(i+1==l-1)
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "invalid escape at %d in included file name: %s\n", i, fin);
|
|
|
|
|
|
+ LM_CRIT("invalid escape at %d in included file name: %s\n", i, fin);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
i++;
|
|
i++;
|
|
@@ -1528,7 +1527,7 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
}
|
|
}
|
|
if(j==0)
|
|
if(j==0)
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "invalid included file name: %s\n", fin);
|
|
|
|
|
|
+ LM_CRIT("invalid included file name: %s\n", fin);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
fbuf[j] = '\0';
|
|
fbuf[j] = '\0';
|
|
@@ -1542,10 +1541,10 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
{
|
|
{
|
|
if(mode==0)
|
|
if(mode==0)
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "cannot open included file: %s\n", fin);
|
|
|
|
|
|
+ LM_CRIT("cannot open included file: %s\n", fin);
|
|
return -1;
|
|
return -1;
|
|
} else {
|
|
} else {
|
|
- LOG(L_DBG, "importing file ignored: %s\n", fin);
|
|
|
|
|
|
+ LM_DBG("importing file ignored: %s\n", fin);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1555,10 +1554,10 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
/* nothing else to try */
|
|
/* nothing else to try */
|
|
if(mode==0)
|
|
if(mode==0)
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "cannot open included file: %s\n", fin);
|
|
|
|
|
|
+ LM_CRIT("cannot open included file: %s\n", fin);
|
|
return -1;
|
|
return -1;
|
|
} else {
|
|
} else {
|
|
- LOG(L_DBG, "importing file ignored: %s\n", fin);
|
|
|
|
|
|
+ LM_DBG("importing file ignored: %s\n", fin);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1566,7 +1565,7 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
newf = (char*)pkg_malloc(x-tmpfiname+strlen(fbuf)+2);
|
|
newf = (char*)pkg_malloc(x-tmpfiname+strlen(fbuf)+2);
|
|
if(newf==0)
|
|
if(newf==0)
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "no more pkg\n");
|
|
|
|
|
|
+ LM_CRIT("no more pkg\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
newf[0] = '\0';
|
|
newf[0] = '\0';
|
|
@@ -1580,14 +1579,14 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
pkg_free(newf);
|
|
pkg_free(newf);
|
|
if(mode==0)
|
|
if(mode==0)
|
|
{
|
|
{
|
|
- LOG(L_CRIT, "cannot open included file: %s (%s)\n", fbuf, newf);
|
|
|
|
|
|
+ LM_CRIT("cannot open included file: %s (%s)\n", fbuf, newf);
|
|
return -1;
|
|
return -1;
|
|
} else {
|
|
} else {
|
|
- LOG(L_DBG, "importing file ignored: %s (%s)\n", fbuf, newf);
|
|
|
|
|
|
+ LM_DBG("importing file ignored: %s (%s)\n", fbuf, newf);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- LOG(L_DBG, "including file: %s (%s)\n", fbuf, newf);
|
|
|
|
|
|
+ LM_DBG("including file: %s (%s)\n", fbuf, newf);
|
|
} else {
|
|
} else {
|
|
newf = fbuf;
|
|
newf = fbuf;
|
|
}
|
|
}
|
|
@@ -1628,7 +1627,7 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
{
|
|
{
|
|
if(newf!=fbuf)
|
|
if(newf!=fbuf)
|
|
pkg_free(newf);
|
|
pkg_free(newf);
|
|
- LOG(L_CRIT, "no more pkg\n");
|
|
|
|
|
|
+ LM_CRIT("no more pkg\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
if(newf==fbuf)
|
|
if(newf==fbuf)
|
|
@@ -1637,7 +1636,7 @@ static int sr_push_yy_state(char *fin, int mode)
|
|
if(fn->fname==0)
|
|
if(fn->fname==0)
|
|
{
|
|
{
|
|
pkg_free(fn);
|
|
pkg_free(fn);
|
|
- LOG(L_CRIT, "no more pkg!\n");
|
|
|
|
|
|
+ LM_CRIT("no more pkg!\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
strcpy(fn->fname, fbuf);
|
|
strcpy(fn->fname, fbuf);
|
|
@@ -1713,7 +1712,7 @@ int pp_define(int len, const char * text)
|
|
LM_DBG("defining id: %.*s\n", len, text);
|
|
LM_DBG("defining id: %.*s\n", len, text);
|
|
|
|
|
|
if (pp_num_defines == MAX_DEFINES) {
|
|
if (pp_num_defines == MAX_DEFINES) {
|
|
- LOG(L_CRIT, "ERROR: too many defines -- adjust MAX_DEFINES\n");
|
|
|
|
|
|
+ LM_CRIT("too many defines -- adjust MAX_DEFINES\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1721,11 +1720,11 @@ int pp_define(int len, const char * text)
|
|
ppos = pp_lookup(len, text);
|
|
ppos = pp_lookup(len, text);
|
|
if(ppos >= 0) {
|
|
if(ppos >= 0) {
|
|
if(pp_define_type==1) {
|
|
if(pp_define_type==1) {
|
|
- LOG(L_DBG, "ignoring - already defined: %.*s\n", len, text);
|
|
|
|
|
|
+ LM_DBG("ignoring - already defined: %.*s\n", len, text);
|
|
pp_define_index = -2;
|
|
pp_define_index = -2;
|
|
return 0;
|
|
return 0;
|
|
} else if(pp_define_type==2) {
|
|
} else if(pp_define_type==2) {
|
|
- LOG(L_DBG, "redefining: %.*s\n", len, text);
|
|
|
|
|
|
+ LM_DBG("redefining: %.*s\n", len, text);
|
|
pp_define_index = ppos;
|
|
pp_define_index = ppos;
|
|
if(pp_defines[ppos][1].s != NULL) {
|
|
if(pp_defines[ppos][1].s != NULL) {
|
|
pkg_free(pp_defines[ppos][1].s);
|
|
pkg_free(pp_defines[ppos][1].s);
|
|
@@ -1734,7 +1733,7 @@ int pp_define(int len, const char * text)
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
} else {
|
|
} else {
|
|
- LOG(L_CRIT, "ERROR: already defined: %.*s\n", len, text);
|
|
|
|
|
|
+ LM_CRIT("already defined: %.*s\n", len, text);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1742,7 +1741,7 @@ int pp_define(int len, const char * text)
|
|
pp_defines[pp_num_defines][0].len = len;
|
|
pp_defines[pp_num_defines][0].len = len;
|
|
pp_defines[pp_num_defines][0].s = (char*)pkg_malloc(len+1);
|
|
pp_defines[pp_num_defines][0].s = (char*)pkg_malloc(len+1);
|
|
if(pp_defines[pp_num_defines][0].s==NULL) {
|
|
if(pp_defines[pp_num_defines][0].s==NULL) {
|
|
- LOG(L_CRIT, "no more memory to define: %.*s\n", len, text);
|
|
|
|
|
|
+ LM_CRIT("no more memory to define: %.*s\n", len, text);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
memcpy(pp_defines[pp_num_defines][0].s, text, len);
|
|
memcpy(pp_defines[pp_num_defines][0].s, text, len);
|
|
@@ -1765,30 +1764,30 @@ int pp_define_set(int len, char *text)
|
|
|
|
|
|
if(pp_define_index < 0) {
|
|
if(pp_define_index < 0) {
|
|
/* invalid position in define table */
|
|
/* invalid position in define table */
|
|
- LOG(L_BUG, "BUG: the index in define table not set yet\n");
|
|
|
|
|
|
+ LM_BUG("BUG: the index in define table not set yet\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
if(len<=0) {
|
|
if(len<=0) {
|
|
- LOG(L_DBG, "no define value - ignoring\n");
|
|
|
|
|
|
+ LM_DBG("no define value - ignoring\n");
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
if (pp_num_defines == MAX_DEFINES) {
|
|
if (pp_num_defines == MAX_DEFINES) {
|
|
- LOG(L_CRIT, "ERROR: too many defines -- adjust MAX_DEFINES\n");
|
|
|
|
|
|
+ LM_CRIT("too many defines -- adjust MAX_DEFINES\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
if (pp_num_defines == 0) {
|
|
if (pp_num_defines == 0) {
|
|
- LOG(L_BUG, "BUG: setting define value, but no define id yet\n");
|
|
|
|
|
|
+ LM_BUG("BUG: setting define value, but no define id yet\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
ppos = pp_define_index;
|
|
ppos = pp_define_index;
|
|
if (pp_defines[ppos][0].s == NULL) {
|
|
if (pp_defines[ppos][0].s == NULL) {
|
|
- LOG(L_BUG, "BUG: last define ID is null\n");
|
|
|
|
|
|
+ LM_BUG("BUG: last define ID is null\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
if (pp_defines[ppos][1].s != NULL) {
|
|
if (pp_defines[ppos][1].s != NULL) {
|
|
- LOG(L_BUG, "BUG: ID %.*s [%d] overwritten\n",
|
|
|
|
|
|
+ LM_BUG("BUG: ID %.*s [%d] overwritten\n",
|
|
pp_defines[ppos][0].len,
|
|
pp_defines[ppos][0].len,
|
|
pp_defines[ppos][0].s, ppos);
|
|
pp_defines[ppos][0].s, ppos);
|
|
return -1;
|
|
return -1;
|
|
@@ -1831,7 +1830,7 @@ static str *pp_define_get(int len, const char * text)
|
|
static int pp_ifdef_type(int type)
|
|
static int pp_ifdef_type(int type)
|
|
{
|
|
{
|
|
if (pp_sptr == MAX_IFDEFS) {
|
|
if (pp_sptr == MAX_IFDEFS) {
|
|
- LOG(L_CRIT, "ERROR: too many nested ifdefs -- adjust MAX_IFDEFS\n");
|
|
|
|
|
|
+ LM_CRIT("too many nested ifdefs -- adjust MAX_IFDEFS\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|