Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2011 15:19:25 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r224944 - stable/8/usr.bin/rs
Message-ID:  <201108171519.p7HFJPp1010888@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108171519.p7HFJPp1010888>