diff options
Diffstat (limited to 'locale/programs/linereader.c')
-rw-r--r-- | locale/programs/linereader.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 1df7df7e50..c3865e4dd5 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org>, 1996. @@ -111,6 +111,35 @@ lr_eof (struct linereader *lr) void +lr_ignore_rest (struct linereader *lr, int verbose) +{ + if (verbose) + { + while (isspace (lr->buf[lr->idx]) && lr->buf[lr->idx] != '\n' + && lr->buf[lr->idx] != lr->comment_char) + if (lr->buf[lr->idx] == '\0') + { + if (lr_next (lr) < 0) + return; + } + else + ++lr->idx; + + 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")); + } + + /* Ignore continued line. */ + while (lr->bufact > 0 && lr->buf[lr->bufact - 1] != '\n') + if (lr_next (lr) < 0) + break; + + lr->idx = lr->bufact; +} + + +void lr_close (struct linereader *lr) { fclose (lr->fp); |