Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/echo Catch up with /bin/sh built-in echo ... if a write ...
details: https://anonhg.NetBSD.org/src/rev/02b435a708ee
branches: trunk
changeset: 379215:02b435a708ee
user: kre <kre%NetBSD.org@localhost>
date: Wed May 19 22:12:36 2021 +0000
description:
Catch up with /bin/sh built-in echo ... if a write error occurs,
don't just exit(1), write an error message to stderr as well
(required for POSIX conformance).
diffstat:
bin/echo/echo.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r 0cb48449277d -r 02b435a708ee bin/echo/echo.c
--- a/bin/echo/echo.c Wed May 19 16:06:13 2021 +0000
+++ b/bin/echo/echo.c Wed May 19 22:12:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: echo.c,v 1.19 2016/09/05 01:00:07 sevan Exp $ */
+/* $NetBSD: echo.c,v 1.20 2021/05/19 22:12:36 kre Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -40,10 +40,11 @@
#if 0
static char sccsid[] = "@(#)echo.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: echo.c,v 1.19 2016/09/05 01:00:07 sevan Exp $");
+__RCSID("$NetBSD: echo.c,v 1.20 2021/05/19 22:12:36 kre Exp $");
#endif
#endif /* not lint */
+#include <err.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
@@ -75,7 +76,7 @@ main(int argc, char *argv[])
(void)putchar('\n');
fflush(stdout);
if (ferror(stdout))
- exit(1);
+ err(1, "write error");
exit(0);
/* NOTREACHED */
}
Home |
Main Index |
Thread Index |
Old Index