From: Ulrich Drepper Date: Sat, 14 Mar 1998 08:50:27 +0000 (+0000) Subject: (lr_token): Return EOF token at EOF. X-Git-Tag: cvs/before-sparc-2_0_x-branch~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96b6c4d6c35054aa00204f48f5dcf500ac6d0d25;p=thirdparty%2Fglibc.git (lr_token): Return EOF token at EOF. (get_toplvl_escape): Correctly terminate loop at EOF. --- diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index edb5a51f5c1..5283bd4ffa6 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -160,6 +160,12 @@ lr_token (struct linereader *lr, const struct charset_t *charset) { ch = lr_getc (lr); + if (ch == EOF) + { + lr->token.tok = tok_eof; + return &lr->token; + }; + if (ch == '\n') { lr->token.tok = tok_eol; @@ -284,7 +290,7 @@ get_toplvl_escape (struct linereader *lr) esc_error: lr->token.val.str.start = &lr->buf[start_idx]; - while (ch != EOF || !isspace (ch)) + while (ch != EOF && !isspace (ch)) ch = lr_getc (lr); lr->token.val.str.len = lr->idx - start_idx;