2
0
mirror of git://sourceware.org/git/glibc.git synced 2025-04-24 14:41:06 +08:00

(lr_token): Return EOF token at EOF.

(get_toplvl_escape): Correctly terminate loop at EOF.
This commit is contained in:
Ulrich Drepper 1998-03-14 08:50:27 +00:00
parent 9c1da4f907
commit 96b6c4d6c3

@ -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 <drepper@gnu.ai.mit.edu>, 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;