/[radius]/radius/lib/users.l
ViewVC logotype

Diff of /radius/lib/users.l

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by gray, Tue Sep 30 15:25:16 2003 UTC revision 1.10 by gray, Tue Oct 14 07:10:42 2003 UTC
# Line 54  static int preproc(); Line 54  static int preproc();
54  static void read_number(char *text, int len, int base);  static void read_number(char *text, int len, int base);
55    
56  static struct obstack stack; /* Obstack for keeping string values */  static struct obstack stack; /* Obstack for keeping string values */
57  char *source_filename;       /* Current filename */  LOCUS source_locus;
58  ino_t source_inode;          /* Inode of the current source (for preventing  ino_t source_inode;          /* Inode of the current source (for preventing
59                                  recursive inclusion */                                  recursive inclusion */
60  int source_line_num;         /* Current line number */  
61                    
62  #ifdef FLEX_SCANNER  #ifdef FLEX_SCANNER
63  #define xinput() (yyin ? getc(yyin) : EOF)  #define xinput() (yyin ? getc(yyin) : EOF)
# Line 195  xunput(int c) Line 195  xunput(int c)
195    
196  struct buffer_ctx {  struct buffer_ctx {
197          struct buffer_ctx *prev;          struct buffer_ctx *prev;
198          char *filename;          LOCUS loc;
         int line;  
199          ino_t i_node;          ino_t i_node;
200          FILE *yyin;          FILE *yyin;
201          LEX_BUFFER_STATE state;          LEX_BUFFER_STATE state;
# Line 233  push_source(char *name) Line 232  push_source(char *name)
232                  return 1;                  return 1;
233          }          }
234    
235          if (source_filename && st.st_ino == source_inode) {          if (source_locus.file && st.st_ino == source_inode) {
236                  yyerror("recursive inclusion");                  yyerror("recursive inclusion");
237                  return 1;                  return 1;
238          }          }
239          if (ctx = ctx_lookup(st.st_ino)) {          if (ctx = ctx_lookup(st.st_ino)) {
240                  yyerror("recursive inclusion");                  yyerror("recursive inclusion");
241                  if (ctx->prev)                  if (ctx->prev)
242                          radlog(L_ERR, _("%s:%d: `%s' already included here"),                          radlog_loc(L_ERR, &ctx->prev->loc,
243                                 ctx->prev->filename, ctx->prev->line, name);                                     _("`%s' already included here"),
244                                       name);
245                  else                  else
246                          radlog(L_ERR, _("`%s' already included at top level"),                          radlog(L_ERR, _("`%s' already included at top level"),
247                                 name);                                 name);
# Line 256  push_source(char *name) Line 256  push_source(char *name)
256          }          }
257    
258          /* Push current context */          /* Push current context */
259          if (source_filename) {          if (source_locus.file) {
260                  ctx = emalloc(sizeof(*ctx));                  ctx = emalloc(sizeof(*ctx));
261                  ctx->filename = source_filename;                  ctx->loc = source_locus;
                 ctx->line = source_line_num;  
262                  ctx->i_node = source_inode;                  ctx->i_node = source_inode;
263                  ctx->yyin = yyin;                  ctx->yyin = yyin;
264                  ctx->prev = context_stack;                  ctx->prev = context_stack;
# Line 276  push_source(char *name) Line 275  push_source(char *name)
275                  lex_set_buffer(yyin);                  lex_set_buffer(yyin);
276  #endif  #endif
277          }          }
278          source_filename = name;          source_locus.file = name;
279          source_line_num = 1;          source_locus.line = 1;
280          source_inode = st.st_ino;          source_inode = st.st_ino;
281          return 0;          return 0;
282  }  }
# Line 299  pop_source() Line 298  pop_source()
298                  return 1;                  return 1;
299          }          }
300          /* Restore previous context */          /* Restore previous context */
301          source_filename = context_stack->filename;          source_locus = context_stack->loc;
         source_line_num = context_stack->line;  
302          source_inode = context_stack->i_node;          source_inode = context_stack->i_node;
303          RESTORE_BUFFER_STATE(context_stack->state);          RESTORE_BUFFER_STATE(context_stack->state);
304          ctx = context_stack->prev;          ctx = context_stack->prev;
# Line 321  D [0-9]{1,3} Line 319  D [0-9]{1,3}
319  #.*\n   {  #.*\n   {
320            if (strncmp(yytext+1, "debug", 5) == 0)            if (strncmp(yytext+1, "debug", 5) == 0)
321                    enable_usr_dbg(1);                    enable_usr_dbg(1);
322            source_line_num++; /* a comment */            source_locus.line++; /* a comment */
323          }          }
324  #.*     /* end-of-file comment */;  #.*     /* end-of-file comment */;
325  \$.*$   preproc();  \$.*$   preproc();
# Line 398  NULL    return NUL; Line 396  NULL    return NUL;
396  }  }
397  {WS}    ;  {WS}    ;
398  \n      {  \n      {
399            source_line_num++;            source_locus.line++;
400          }          }
401  "="     return EQ;  "="     return EQ;
402  "!="    return NE;  "!="    return NE;
# Line 440  init_lex(char *name) Line 438  init_lex(char *name)
438          obstack_init(&stack);          obstack_init(&stack);
439                    
440          context_stack = NULL;          context_stack = NULL;
441          source_filename = NULL;          source_locus.file = NULL;
442          return push_source(name);          return push_source(name);
443  }  }
444    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26