diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-02-16 08:15:06 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2006-02-16 08:15:06 +0000 |
commit | cd6f443d4e32ec479b44a3c2ee07e3a40039d4c7 (patch) | |
tree | 89d18af2b696d2e8ed560bff61a7b3a5f7e2f2cd /usr.bin/diff/diffreg.c | |
parent | cd9dbddc64df0fa7b6acb4131caf05ed1aefd199 (diff) |
Strip newline from lines used with -I, otherwise ^$ will match all
lines and ignore them all. With and ok jaredy@
Diffstat (limited to 'usr.bin/diff/diffreg.c')
-rw-r--r-- | usr.bin/diff/diffreg.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 2757ef06f53..86ab79e53df 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffreg.c,v 1.62 2005/01/13 08:27:45 otto Exp $ */ +/* $OpenBSD: diffreg.c,v 1.63 2006/02/16 08:15:05 otto Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -65,7 +65,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.62 2005/01/13 08:27:45 otto Exp $"; +static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.63 2006/02/16 08:15:05 otto Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -977,6 +977,8 @@ preadline(int fd, size_t len, off_t off) line = emalloc(len + 1); if ((nr = pread(fd, line, len, off)) < 0) err(1, "preadline"); + if (nr > 0 && line[nr-1] == '\n') + nr--; line[nr] = '\0'; return (line); } |