]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Don't discard lines after comments.
authorUlrich Drepper <drepper@redhat.com>
Wed, 19 Nov 1997 22:55:04 +0000 (22:55 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 19 Nov 1997 22:55:04 +0000 (22:55 +0000)
intl/localealias.c

index e08cdf94a99e5141d4300e31bafc030311cf036c..94673de35b6c0ba9dc73d9b7f67d0e464115b66d 100644 (file)
@@ -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