summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2022-11-18 14:52:04 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2022-11-18 14:52:04 +0000
commit9f4e08be828995f9db5889a542cba4c9ccc39d7a (patch)
treee729c179d613c9f0fd4cc05c2bafecc5582894d7 /bin
parent45da37e7f442c41471675db8a94fbfa1e24c94bd (diff)
Write number of bytes read/written and "?" prompt to stdout, not stderr.
This matches both historical behavior and the POSIX specification. From Soeren Tempel.
Diffstat (limited to 'bin')
-rw-r--r--bin/ed/io.c6
-rw-r--r--bin/ed/main.c12
2 files changed, 9 insertions, 9 deletions
diff --git a/bin/ed/io.c b/bin/ed/io.c
index 97306be16b6..fe0b9394d17 100644
--- a/bin/ed/io.c
+++ b/bin/ed/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.24 2019/06/28 13:41:42 deraadt Exp $ */
+/* $OpenBSD: io.c,v 1.25 2022/11/18 14:52:03 millert Exp $ */
/* $NetBSD: io.c,v 1.2 1995/03/21 09:04:43 cgd Exp $ */
/* io.c: This file contains the i/o routines for the ed line editor */
@@ -64,7 +64,7 @@ read_file(char *fn, int n)
return ERR;
}
if (!scripted)
- fprintf(stderr, "%d\n", size);
+ printf("%d\n", size);
return current_addr - n;
}
@@ -166,7 +166,7 @@ write_file(char *fn, char *mode, int n, int m)
return ERR;
}
if (!scripted)
- fprintf(stderr, "%d\n", size);
+ printf("%d\n", size);
return n ? m - n + 1 : 0;
}
diff --git a/bin/ed/main.c b/bin/ed/main.c
index 231d021ef19..4a690b04de1 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.67 2022/01/22 23:22:11 millert Exp $ */
+/* $OpenBSD: main.c,v 1.68 2022/11/18 14:52:03 millert Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
@@ -184,7 +184,7 @@ top:
signal(SIGINT, signal_int);
if (sigsetjmp(env, 1)) {
status = -1;
- fputs("\n?\n", stderr);
+ fputs("\n?\n", stdout);
seterrmsg("interrupt");
} else {
init_buffers();
@@ -196,7 +196,7 @@ top:
strlcpy(old_filename, *argv,
sizeof old_filename);
} else if (argc) {
- fputs("?\n", stderr);
+ fputs("?\n", stdout);
if (**argv == '\0')
seterrmsg("invalid filename");
if (!interactive)
@@ -215,7 +215,7 @@ top:
continue;
} else if (n == 0) {
if (modified && !scripted) {
- fputs("?\n", stderr);
+ fputs("?\n", stdout);
seterrmsg("warning: file modified");
if (!interactive) {
if (garrulous)
@@ -250,7 +250,7 @@ top:
break;
case EMOD:
modified = 0;
- fputs("?\n", stderr); /* give warning */
+ fputs("?\n", stdout); /* give warning */
seterrmsg("warning: file modified");
if (!interactive) {
if (garrulous)
@@ -271,7 +271,7 @@ top:
quit(3);
break;
default:
- fputs("?\n", stderr);
+ fputs("?\n", stdout);
if (!interactive) {
if (garrulous)
fprintf(stderr,