Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Feb 2011 18:05:57 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218410 - head/usr.bin/rs
Message-ID:  <201102071805.p17I5vXV017411@svn.freebsd.org>

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



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