summaryrefslogtreecommitdiff
path: root/gen.c
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1993-12-09 13:58:09 +0000
committerVern Paxson <vern@ee.lbl.gov>1993-12-09 13:58:09 +0000
commite89ab843296311d34122769645394f04feb7f36c (patch)
tree34549c3f4b5b9769d67ed33b76c4f27b0ff6f422 /gen.c
parentd865c176c6e5bf6768dbc4577595cdfe20d0baab (diff)
Fixed bug in interactive reads where char is unsigned
Diffstat (limited to 'gen.c')
-rw-r--r--gen.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gen.c b/gen.c
index e25160d..11dfb50 100644
--- a/gen.c
+++ b/gen.c
@@ -1255,10 +1255,13 @@ void make_tables()
{
printf(
"\tif ( yy_current_buffer->is_interactive ) \\\n" );
+ printf( "\t\t{ \\\n" );
+ printf( "\t\tint c = getc( yyin ); \\\n" );
+ printf( "\t\tresult = c == EOF ? 0 : 1; \\\n" );
+ printf( "\t\tbuf[0] = (char) c; \\\n" );
+ printf( "\t\t} \\\n" );
printf(
-"\t\tresult = ((int) (buf[0] = getc( yyin ))) == EOF ? 0 : 1; \\\n" );
- printf(
-"\telse if ( ((result = fread( (char *) buf, 1, max_size, yyin )) == 0)\\\n" );
+ "\telse if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \\\n" );
printf( "\t\t && ferror( yyin ) ) \\\n" );
printf(
"\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" );\n" );