From f126ef6731021d7796f88800eb59106388683280 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 9 Feb 2001 17:02:23 +0000 Subject: Update. 2001-02-09 Ulrich Drepper * locale/programs/linereader.c (get_ident): Stop loop if EOF. Use lr_ungetc to push back last read character. * locale/programs/linereader.h (lr_ungetc): Don't push back is character is EOF. (lr_ignore_rest): Don't warn about garbage if it is really the end of the file. * manual/Makefile: Use ifnottext and not ifinfo to protect Top node definition. --- locale/programs/linereader.c | 4 ++-- locale/programs/linereader.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'locale') diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 5dba62f796..9a61428ac5 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -528,7 +528,7 @@ get_ident (struct linereader *lr) ADDC (lr->buf[lr->idx - 1]); while (!isspace ((ch = lr_getc (lr))) && ch != '"' && ch != ';' - && ch != '<' && ch != ',') + && ch != '<' && ch != ',' && ch != EOF) { if (ch == lr->escape_char) { @@ -542,7 +542,7 @@ get_ident (struct linereader *lr) ADDC (ch); } - lr_ungetn (lr, 1); + lr_ungetc (lr, ch); kw = lr->hash_fct (buf, bufact); diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h index 94802fcaa7..27ea124037 100644 --- a/locale/programs/linereader.h +++ b/locale/programs/linereader.h @@ -123,7 +123,8 @@ lr_ungetc (struct linereader *lr, int ch) if (lr->idx == 0) return -1; - lr->buf[--lr->idx] = ch; + if (ch != EOF) + lr->buf[--lr->idx] = ch; return 0; } @@ -154,7 +155,8 @@ lr_ignore_rest (struct linereader *lr, int verbose) else ++lr->idx; - if (lr->buf[lr->idx] != '\n' &&lr->buf[lr->idx] != lr->comment_char) + if (lr->buf[lr->idx] != '\n' && ! feof (lr->fp) + && lr->buf[lr->idx] != lr->comment_char) lr_error (lr, _("trailing garbage at end of line")); } -- cgit 1.4.1