svn commit: r226106 - stable/7/usr.bin/rs

Jaakko Heinonen jh at FreeBSD.org
Fri Oct 7 14:27:20 UTC 2011


Author: jh
Date: Fri Oct  7 14:27:20 2011
New Revision: 226106
URL: http://svn.freebsd.org/changeset/base/226106

Log:
  MFC r218410: Handle EOF when skipping lines.

Modified:
  stable/7/usr.bin/rs/rs.c
Directory Properties:
  stable/7/usr.bin/rs/   (props changed)

Modified: stable/7/usr.bin/rs/rs.c
==============================================================================
--- stable/7/usr.bin/rs/rs.c	Fri Oct  7 13:43:01 2011	(r226105)
+++ stable/7/usr.bin/rs/rs.c	Fri Oct  7 14:27:20 2011	(r226106)
@@ -130,14 +130,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