+2003-06-18 Ulrich Drepper <drepper@redhat.com>
+
+ * localealias.c (read_alias_file): Determine whether line is read
+ incompletely early, before we modify the line.
+
2005-05-05 Bruno Haible <bruno@clisp.org>
* hash-string.h (__hash_string): Define differently outside glibc.
char *alias;
char *value;
char *cp;
+ int complete_line;
if (FGETS (buf, sizeof buf, fp) == NULL)
/* EOF reached. */
break;
+ /* Determine whether the line is complete. */
+ complete_line = strchr (buf, '\n') != NULL;
+
cp = buf;
/* Ignore leading white space. */
while (isspace ((unsigned char) cp[0]))
/* Possibly not the whole line fits into the buffer. Ignore
the rest of the line. */
- while (strchr (buf, '\n') == NULL)
- if (FGETS (buf, sizeof buf, fp) == NULL)
- /* Make sure the inner loop will be left. The outer loop
- will exit at the `feof' test. */
- break;
+ if (! complete_line)
+ do
+ if (FGETS (buf, sizeof buf, fp) == NULL)
+ /* Make sure the inner loop will be left. The outer loop
+ will exit at the `feof' test. */
+ break;
+ while (strchr (buf, '\n') == NULL);
}
/* Should we test for ferror()? I think we have to silently ignore