about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-11-19 22:55:04 +0000
committerUlrich Drepper <drepper@redhat.com>1997-11-19 22:55:04 +0000
commite4dfe2462ddf3f6896b8231866fa39809921351a (patch)
treece738defe47af13a15e69a144e132033f996eb7d
parent3c3d34f3da67e964ee89318f07583b99d6686eb1 (diff)
downloadglibc-e4dfe2462ddf3f6896b8231866fa39809921351a.tar.gz
glibc-e4dfe2462ddf3f6896b8231866fa39809921351a.tar.xz
glibc-e4dfe2462ddf3f6896b8231866fa39809921351a.zip
Don't discard lines after comments.
-rw-r--r--intl/localealias.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/intl/localealias.c b/intl/localealias.c
index e08cdf94a9..94673de35b 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