diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-11-10 18:51:36 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-11-10 18:51:36 +0000 |
commit | 75c78ad58707153f5ff3ff013f60a29a61f3eac3 (patch) | |
tree | 07ec2b43b85ed356781e09f61dc7003747d92bc1 /usr.bin | |
parent | 57e398022d3a2175230da106bd6b225959d48ab5 (diff) |
Din't print the "No newline at end of file" to inline (ie: to stdout)
for edit scripts. Instead, print it to stderr. This matches the
GNU diff behavior and fixes a problem with RCS and files with no
trailing newline. tedu@ OK
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/diff/diffreg.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 848e19edf4f..467c797021a 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffreg.c,v 1.51 2003/10/28 13:23:59 avsm Exp $ */ +/* $OpenBSD: diffreg.c,v 1.52 2003/11/10 18:51:35 millert Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -65,7 +65,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.51 2003/10/28 13:23:59 avsm Exp $"; +static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.52 2003/11/10 18:51:35 millert Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -1119,8 +1119,12 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { if ((c = getc(lb)) == EOF) { - puts("\n\\ No newline at end of file"); - return (0);; + if (format == D_EDIT || format == D_REVERSE || + format == D_NREVERSE) + warnx("No newline at end of file"); + else + puts("\n\\ No newline at end of file"); + return (0); } if (c == '\t' && tflag) { do { |