/[radius]/radius/radtest/input.l
ViewVC logotype

Diff of /radius/radtest/input.l

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

revision 1.19 by gray, Thu Jun 19 12:39:42 2003 UTC revision 1.20 by gray, Tue Oct 14 07:10:43 2003 UTC
# Line 47  Line 47 
47  int getline (char **lineptr, size_t *n, FILE *stream);  int getline (char **lineptr, size_t *n, FILE *stream);
48  #endif  #endif
49    
50  int source_line_num;  LOCUS source_locus;
 char *source_filename;  
51  static int interactive;  static int interactive;
52  static struct obstack string_stk;  static struct obstack string_stk;
53    
# Line 70  DQ {D3}\.{D3}\.{D3}\.{D3} Line 69  DQ {D3}\.{D3}\.{D3}\.{D3}
69    
70  %%  %%
71  #.*\n   { /* a comment */  #.*\n   { /* a comment */
72          source_line_num++;          source_locus.line++;
73          return EOL;          return EOL;
74  }        }      
75  #.*     /* end-of-file comment */;  #.*     /* end-of-file comment */;
# Line 129  exit    return EXIT; Line 128  exit    return EXIT;
128  }  }
129  \"[^\\"]*\n {  \"[^\\"]*\n {
130          BEGIN(STRING);          BEGIN(STRING);
131          source_line_num++;          source_locus.line++;
132          add_str(yytext+1, yyleng-1);          add_str(yytext+1, yyleng-1);
133  }  }
134  \"[^\\"]*\\. {  \"[^\\"]*\\. {
135          BEGIN(STRING);          BEGIN(STRING);
136          if (yytext[yyleng-1] == '\n')          if (yytext[yyleng-1] == '\n')
137                  source_line_num++;                  source_locus.line++;
138          add_str(yytext+1, yyleng - 3);          add_str(yytext+1, yyleng - 3);
139          add_chr(backspace(yytext[yyleng-1]));          add_chr(backspace(yytext[yyleng-1]));
140  }  }
# Line 155  exit    return EXIT; Line 154  exit    return EXIT;
154  }  }
155  <STRING>[^\\"]*\\. {  <STRING>[^\\"]*\\. {
156          if (yytext[yyleng-1] == '\n')          if (yytext[yyleng-1] == '\n')
157                  source_line_num++;                  source_locus.line++;
158          add_str(yytext, yyleng - 2);          add_str(yytext, yyleng - 2);
159          add_chr(backspace(yytext[yyleng-1]));          add_chr(backspace(yytext[yyleng-1]));
160  }  }
161  <STRING>[^\\"]*\n {  <STRING>[^\\"]*\n {
162          source_line_num++;          source_locus.line++;
163          add_str(yytext, yyleng);          add_str(yytext, yyleng);
164          add_chr(backspace(yytext[yyleng-1]));          add_chr(backspace(yytext[yyleng-1]));
165  }  }
# Line 179  exit    return EXIT; Line 178  exit    return EXIT;
178          return NUMBER;          return NUMBER;
179  }  }
180  {WS}    ;  {WS}    ;
181  \\\n    source_line_num++;  \\\n    source_locus.line++;
182  \n      { source_line_num++; return EOL; }  \n      { source_locus.line++; return EOL; }
183  ;       return EOL;  ;       return EOL;
184  "="     return EQ;  "="     return EQ;
185  "!="    return NE;  "!="    return NE;
# Line 205  open_input(char *name) Line 204  open_input(char *name)
204    
205          obstack_init(&string_stk);          obstack_init(&string_stk);
206          if (name && strcmp(name, "-")) {          if (name && strcmp(name, "-")) {
207                  source_filename = name;                  source_locus.file = name;
208                  fp = fopen(name, "r");                  fp = fopen(name, "r");
209                  if (!fp) {                  if (!fp) {
210                          radlog(L_ERR|L_PERROR,                          radlog(L_ERR|L_PERROR,
# Line 213  open_input(char *name) Line 212  open_input(char *name)
212                          return 1;                          return 1;
213                  }                  }
214          } else {          } else {
215                  source_filename = "<teletype>";                  source_locus.file = "<teletype>";
216                  fp = stdin;                  fp = stdin;
217          }          }
218    
219          interactive = isatty(fileno(fp));          interactive = isatty(fileno(fp));
220          source_line_num = 0;          source_locus.line = 0;
221  #ifdef FLEX_SCANNER  #ifdef FLEX_SCANNER
222          yyrestart(fp);          yyrestart(fp);
223  #else  #else
# Line 383  deref_var(char *name, char *p) Line 382  deref_var(char *name, char *p)
382                  if (*p)                  if (*p)
383                          printf("%s", p);                          printf("%s", p);
384                  else                  else
385                          printf("(%s:%d)%s? ",                          printf("(%s:%lu)%s? ",
386                                 source_filename,                                 source_locus.file,
387                                 source_line_num,                                 (unsigned long)source_locus.line,
388                                 name);                                 name);
389                  p = NULL;                  p = NULL;
390                  n = 0;                  n = 0;
# Line 397  deref_var(char *name, char *p) Line 396  deref_var(char *name, char *p)
396                                    
397          case '&':          case '&':
398                  if (!*p)                  if (!*p)
399                          asprintf(&p, "(%s:%d)%s? ",                          asprintf(&p, "(%s:%lu)%s? ",
400                                   source_filename,                                   source_locus.file,
401                                   source_line_num,                                   source_locus.line,
402                                   name);                                   name);
403                  p = getpass(p);                  p = getpass(p);
404                  if (!p)                  if (!p)
# Line 453  deref_parm(unsigned num, char *p) Line 452  deref_parm(unsigned num, char *p)
452                  if (*p)                  if (*p)
453                          printf("%s", p);                          printf("%s", p);
454                  else                  else
455                          printf("(%s:%d)%d? ",                          printf("(%s:%lu)%d? ",
456                                 source_filename,                                 source_locus.file,
457                                 source_line_num,                                 (unsigned long) source_locus.line,
458                                 num);                                 num);
459                  p = NULL;                  p = NULL;
460                  n = 0;                  n = 0;
# Line 466  deref_parm(unsigned num, char *p) Line 465  deref_parm(unsigned num, char *p)
465                                    
466          case '&':          case '&':
467                  if (!*p)                  if (!*p)
468                          asprintf(&p, "(%s:%d)%d? ",                          asprintf(&p, "(%s:%lu)%d? ",
469                                   source_filename,                                   source_locus.file,
470                                   source_line_num,                                   (unsigned long) source_locus.line,
471                                   num);                                   num);
472                  p = getpass(p);                  p = getpass(p);
473                  if (!p)                  if (!p)

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

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