From: Ulrich Drepper Date: Wed, 19 Nov 1997 22:55:04 +0000 (+0000) Subject: Don't discard lines after comments. X-Git-Tag: cvs/glibc-2_0_6-pre2~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4dfe2462ddf3f6896b8231866fa39809921351a;p=thirdparty%2Fglibc.git Don't discard lines after comments. --- diff --git a/intl/localealias.c b/intl/localealias.c index e08cdf94a99..94673de35b6 100644 --- a/intl/localealias.c +++ b/intl/localealias.c @@ -1,5 +1,5 @@ /* localealias.c -- handle aliases for locale names - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. @@ -229,6 +229,19 @@ read_alias_file (fname, fname_len) /* EOF reached. */ break; + /* Possibly not the whole line fits into the buffer. Ignore + the rest of the line. */ + if (strchr (buf, '\n') == NULL) + { + char altbuf[BUFSIZ]; + do + if (fgets (altbuf, sizeof altbuf, fp) == NULL) + /* Make sure the inner loop will be left. The outer loop + will exit at the `feof' test. */ + break; + while (strchr (altbuf, '\n') == NULL); + } + cp = buf; /* Ignore leading white space. */ while (isspace (cp[0])) @@ -296,17 +309,6 @@ read_alias_file (fname, fname_len) ++added; } } - - /* Possibly not the whole line fits into the buffer. Ignore - the rest of the line. */ - while (strchr (cp, '\n') == NULL) - { - cp = buf; - if (fgets (buf, BUFSIZ, fp) == NULL) - /* Make sure the inner loop will be left. The outer loop - will exit at the `feof' test. */ - *cp = '\n'; - } } /* Should we test for ferror()? I think we have to silently ignore