about summary refs log tree commit diff
path: root/locale/programs/linereader.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-02-09 17:02:23 +0000
committerUlrich Drepper <drepper@redhat.com>2001-02-09 17:02:23 +0000
commitf126ef6731021d7796f88800eb59106388683280 (patch)
treea83034b45cbc94d0923ea5d4e5175257a7d781ca /locale/programs/linereader.h
parent90feeaa2ebef8b807cfb774bcbe311325eae0b3b (diff)
downloadglibc-f126ef6731021d7796f88800eb59106388683280.tar.gz
glibc-f126ef6731021d7796f88800eb59106388683280.tar.xz
glibc-f126ef6731021d7796f88800eb59106388683280.zip
Update.
2001-02-09  Ulrich Drepper  <drepper@redhat.com>

	* locale/programs/linereader.c (get_ident): Stop loop if EOF.  Use
	lr_ungetc to push back last read character.
	* locale/programs/linereader.h (lr_ungetc): Don't push back is
	character is EOF.
	(lr_ignore_rest): Don't warn about garbage if it is really the end
	of the file.

	* manual/Makefile: Use ifnottext and not ifinfo to protect Top node
	definition.
Diffstat (limited to 'locale/programs/linereader.h')
-rw-r--r--locale/programs/linereader.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h
index 94802fcaa7..27ea124037 100644
--- a/locale/programs/linereader.h
+++ b/locale/programs/linereader.h
@@ -123,7 +123,8 @@ lr_ungetc (struct linereader *lr, int ch)
   if (lr->idx == 0)
     return -1;
 
-  lr->buf[--lr->idx] = ch;
+  if (ch != EOF)
+    lr->buf[--lr->idx] = ch;
   return 0;
 }
 
@@ -154,7 +155,8 @@ lr_ignore_rest (struct linereader *lr, int verbose)
 	else
 	  ++lr->idx;
 
-      if (lr->buf[lr->idx] != '\n' &&lr->buf[lr->idx] != lr->comment_char)
+      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"));
     }