mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-27 05:03:07 +00:00
* tests/calc.m4 (calc.y): Do not assign to stdin, as it's not
portable.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2000-09-19 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* tests/calc.m4 (calc.y): Do not assign to stdin, as it's not
|
||||||
|
portable.
|
||||||
|
|
||||||
2000-09-18 Akim Demaille <akim@epita.fr>
|
2000-09-18 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* configure.in: Append WARNING_CFLAGS to CFLAGS.
|
* configure.in: Append WARNING_CFLAGS to CFLAGS.
|
||||||
|
|||||||
@@ -54,11 +54,13 @@ exp: NUM { $$ = $1; }
|
|||||||
| '(' exp ')' { $$ = $2; }
|
| '(' exp ')' { $$ = $2; }
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
FILE *yyin = stdin;
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argn, const char **argv)
|
main (int argn, const char **argv)
|
||||||
{
|
{
|
||||||
if (argn == 2)
|
if (argn == 2)
|
||||||
stdin = fopen (argv[1], "r");
|
yyin = fopen (argv[1], "r");
|
||||||
if (!stdin)
|
if (!stdin)
|
||||||
{
|
{
|
||||||
perror (argv[1]);
|
perror (argv[1]);
|
||||||
@@ -110,13 +112,13 @@ yylex ()
|
|||||||
int c;
|
int c;
|
||||||
|
|
||||||
/* Skip white space. */
|
/* Skip white space. */
|
||||||
while ((c = getchar ()) == ' ' || c == '\t')
|
while ((c = getc (yyin)) == ' ' || c == '\t')
|
||||||
;
|
;
|
||||||
/* process numbers */
|
/* process numbers */
|
||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
{
|
{
|
||||||
ungetc (c, stdin);
|
ungetc (c, yyin);
|
||||||
yylval = read_signed_integer (stdin);
|
yylval = read_signed_integer (yyin);
|
||||||
return NUM;
|
return NUM;
|
||||||
}
|
}
|
||||||
/* Return end-of-file. */
|
/* Return end-of-file. */
|
||||||
|
|||||||
Reference in New Issue
Block a user