aboutsummaryrefslogtreecommitdiffstats
path: root/src/cfg_file.l
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-13 18:03:29 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-13 18:03:29 +0300
commit1085ddb9c09caba4bcb4408135044dc24f7798f3 (patch)
tree88a7073ef0b503557fb28e080a61224b60c18d5a /src/cfg_file.l
parent89f264624c1c846c995c22a8390b7e79f09ef960 (diff)
downloadrspamd-1085ddb9c09caba4bcb4408135044dc24f7798f3.tar.gz
rspamd-1085ddb9c09caba4bcb4408135044dc24f7798f3.zip
* Fix reload logic
* Create listen sock for lmtp in main processes dispatcher to allow multiply lmtp workers * Fix logic of logging
Diffstat (limited to 'src/cfg_file.l')
-rw-r--r--src/cfg_file.l46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/cfg_file.l b/src/cfg_file.l
index ac2624155..4e8e4bb8d 100644
--- a/src/cfg_file.l
+++ b/src/cfg_file.l
@@ -10,6 +10,7 @@
#define MAX_INCLUDE_DEPTH 10
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+int line_stack[MAX_INCLUDE_DEPTH];
int include_stack_ptr = 0;
extern struct config_file *cfg;
@@ -101,36 +102,41 @@ yes|YES|no|NO|[yY]|[nN] yylval.flag=parse_flag(yytext); return FLAG;
[a-zA-Z0-9].[a-zA-Z0-9\/.-]+ yylval.string=strdup(yytext); return DOMAINNAME;
<incl>[ \t]* /* eat the whitespace */
<incl>[^ \t\n]+ { /* got the include file name */
- if (include_stack_ptr >= MAX_INCLUDE_DEPTH) {
- yyerror ("yylex: includes nested too deeply");
- return -1;
- }
+ /* got the include file name */
+ if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) {
+ yyerror ("yylex: includes nested too deeply" );
+ return -1;
+ }
- include_stack[include_stack_ptr++] =
- YY_CURRENT_BUFFER;
+ line_stack[include_stack_ptr] = yylineno;
+ include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
- yyin = fopen (yytext, "r");
+ yylineno = 1;
+ yyin = fopen (yytext, "r");
- if (! yyin) {
- yyerror ("yylex: cannot open include file");
+ if (!yyin) {
+ yyerror ("yylex: cannot open include file");
return -1;
}
- yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
+ yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
- BEGIN(INITIAL);
- }
+ BEGIN(INITIAL);
+}
<<EOF>> {
- if ( --include_stack_ptr < 0 ) {
+ if ( --include_stack_ptr < 0 ) {
+ include_stack_ptr = 0;
+ yylineno = 1;
post_load_config (cfg);
- yyterminate ();
- }
- else {
- yy_delete_buffer (YY_CURRENT_BUFFER);
- yy_switch_to_buffer (include_stack[include_stack_ptr]);
- }
- }
+ yyterminate ();
+ }
+ else {
+ yy_delete_buffer (YY_CURRENT_BUFFER);
+ yy_switch_to_buffer (include_stack[include_stack_ptr] );
+ yylineno = line_stack[include_stack_ptr];
+ }
+}
<module>\n /* ignore EOL */;
<module>[ \t]+ /* ignore whitespace */;