svn commit: r218410 - head/usr.bin/rs

Jaakko Heinonen jh at FreeBSD.org
Mon Feb 7 18:05:57 UTC 2011


Author: jh
Date: Mon Feb  7 18:05:56 2011
New Revision: 218410
URL: http://svn.freebsd.org/changeset/base/218410

Log:
  Handle EOF when skipping lines.

Modified:
  head/usr.bin/rs/rs.c

Modified: head/usr.bin/rs/rs.c
==============================================================================
--- head/usr.bin/rs/rs.c	Mon Feb  7 17:04:31 2011	(r218409)
+++ head/usr.bin/rs/rs.c	Mon Feb  7 18:05:56 2011	(r218410)
@@ -126,14 +126,17 @@ getfile(void)
 	char *p;
 	char *endp;
 	char **ep;
+	int c;
 	int multisep = (flags & ONEISEPONLY ? 0 : 1);
 	int nullpad = flags & NULLPAD;
 	char **padto;
 
 	while (skip--) {
-		getline();
+		c = getline();
 		if (flags & SKIPPRINT)
 			puts(curline);
+		if (c == EOF)
+			return;
 	}
 	getline();
 	if (flags & NOARGS && curlen < owidth)


More information about the svn-src-all mailing list