diff options
author | Vern Paxson <vern@ee.lbl.gov> | 1995-03-20 14:02:02 +0000 |
---|---|---|
committer | Vern Paxson <vern@ee.lbl.gov> | 1995-03-20 14:02:02 +0000 |
commit | 7952505cbf29015e04a67ce0202f5da83d6f9cb3 (patch) | |
tree | 4c984eaef6395093cdcc9866a96dcf2e72679ba0 /gen.c | |
parent | 1d5a8e257c5762010af50387f16ac6dc3c4effbd (diff) |
read up to newline for interactive reads, rather than one char
Diffstat (limited to 'gen.c')
-rw-r--r-- | gen.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -1281,9 +1281,16 @@ void make_tables() outn( "\tif ( yy_current_buffer->yy_is_interactive ) \\" ); outn( "\t\t{ \\" ); - outn( "\t\tint c = getc( yyin ); \\" ); - outn( "\t\tresult = c == EOF ? 0 : 1; \\" ); - outn( "\t\tbuf[0] = (char) c; \\" ); + outn( "\t\tint c = '*', n; \\" ); + outn( "\t\tfor ( n = 0; n < max_size && \\" ); + outn( "\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\" ); + outn( "\t\t\tbuf[n] = (char) c; \\" ); + outn( "\t\tif ( c == '\\n' ) \\" ); + outn( "\t\t\tbuf[n++] = (char) c; \\" ); + outn( "\t\tif ( c == EOF && ferror( yyin ) ) \\" ); + outn( + "\t\t\tYY_FATAL_ERROR( \"input in flex scanner failed\" ); \\" ); + outn( "\t\tresult = n; \\" ); outn( "\t\t} \\" ); outn( "\telse if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \\" ); |