From: millert Date: Fri, 18 Nov 2022 14:52:03 +0000 (+0000) Subject: Write number of bytes read/written and "?" prompt to stdout, not stderr. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a565d659ae9cb286fd98881cb000c22327ebd4a3;p=openbsd Write number of bytes read/written and "?" prompt to stdout, not stderr. This matches both historical behavior and the POSIX specification. From Soeren Tempel. --- 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,