svn commit: r224944 - stable/8/usr.bin/rs

Jaakko Heinonen jh at FreeBSD.org
Wed Aug 17 15:19:26 UTC 2011


Author: jh
Date: Wed Aug 17 15:19:25 2011
New Revision: 224944
URL: http://svn.freebsd.org/changeset/base/224944

Log:
  MFC r218410: Handle EOF when skipping lines.

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

Modified: stable/8/usr.bin/rs/rs.c
==============================================================================
--- stable/8/usr.bin/rs/rs.c	Wed Aug 17 15:13:07 2011	(r224943)
+++ stable/8/usr.bin/rs/rs.c	Wed Aug 17 15:19:25 2011	(r224944)
@@ -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