diff options
Diffstat (limited to 'examples/c/pushcalc/calc.y')
-rw-r--r-- | examples/c/pushcalc/calc.y | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/c/pushcalc/calc.y b/examples/c/pushcalc/calc.y index 7b0b9996..6d49470c 100644 --- a/examples/c/pushcalc/calc.y +++ b/examples/c/pushcalc/calc.y @@ -1,7 +1,7 @@ %code top { #include <ctype.h> /* isdigit. */ - #include <stdbool.h> - #include <stdio.h> /* For printf, etc. */ + #include <stdio.h> /* printf. */ + #include <stdlib.h> /* abort. */ #include <string.h> /* strcmp. */ } @@ -81,7 +81,8 @@ yylex (YYSTYPE *yylval) if (c == '.' || isdigit (c)) { ungetc (c, stdin); - scanf ("%lf", &yylval->NUM); + if (scanf ("%lf", &yylval->NUM) != 1) + abort (); return NUM; } |