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 |
|
|
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 */; |
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 |
} |
} |
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 |
} |
} |
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; |
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, |
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 |
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; |
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) |
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; |
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) |