summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-11-10 18:51:35 +0000
committermillert <millert@openbsd.org>2003-11-10 18:51:35 +0000
commit643dc60cf1a752f3670f67e8f898a4c2e0a15bb8 (patch)
tree5a508a38cd1047d8d0d321e6ecc48b4fbe9a1044 /usr.bin/diff
parentconstify. ok markus@ & djm@ (diff)
downloadwireguard-openbsd-643dc60cf1a752f3670f67e8f898a4c2e0a15bb8.tar.xz
wireguard-openbsd-643dc60cf1a752f3670f67e8f898a4c2e0a15bb8.zip
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/diff')
-rw-r--r--usr.bin/diff/diffreg.c12
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 {