1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

Write number of bytes read/written and "?" prompt to stdout, not stderr.

This matches both historical behavior and the POSIX specification.
From Soeren Tempel.
This commit is contained in:
millert 2022-11-18 14:52:03 +00:00
parent 0ee28c099b
commit a565d659ae
2 changed files with 9 additions and 9 deletions

View File

@ -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;
}

View File

@ -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,