output.c output.h: expose OUTPUT_ERR (flag for an exposed flags variable)
bltin.h: support ferror() echo.c: use ferror() to fail on output write errors Another piece of PR bin/39574.
This commit is contained in:
parent
540cab1ec8
commit
30a1416240
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bltin.h,v 1.12 2008/03/29 09:55:40 apb Exp $ */
|
||||
/* $NetBSD: bltin.h,v 1.13 2008/10/12 01:40:37 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -56,6 +56,7 @@
|
|||
#undef putc
|
||||
#undef putchar
|
||||
#undef fileno
|
||||
#undef ferror
|
||||
#define FILE struct output
|
||||
#define stdout out1
|
||||
#define stderr out2
|
||||
|
@ -67,6 +68,7 @@
|
|||
#define fputs(...) _RETURN_INT(outstr(__VA_ARGS__))
|
||||
#define fflush(f) _RETURN_INT(flushout(f))
|
||||
#define fileno(f) ((f)->fd)
|
||||
#define ferror(f) ((f)->flags & OUTPUT_ERR)
|
||||
#define INITARGS(argv)
|
||||
#define err sh_err
|
||||
#define verr sh_verr
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: echo.c,v 1.13 2007/12/12 22:55:43 lukem Exp $ */
|
||||
/* $NetBSD: echo.c,v 1.14 2008/10/12 01:40:37 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -52,7 +52,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: echo.c,v 1.13 2007/12/12 22:55:43 lukem Exp $");
|
||||
__RCSID("$NetBSD: echo.c,v 1.14 2008/10/12 01:40:37 dholland Exp $");
|
||||
|
||||
#define main echocmd
|
||||
|
||||
|
@ -115,5 +115,8 @@ main(int argc, char **argv)
|
|||
}
|
||||
if (! nflag)
|
||||
putchar('\n');
|
||||
fflush(stdout);
|
||||
if (ferror(stdout))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: output.c,v 1.29 2006/03/17 14:47:10 rumble Exp $ */
|
||||
/* $NetBSD: output.c,v 1.30 2008/10/12 01:40:37 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: output.c,v 1.29 2006/03/17 14:47:10 rumble Exp $");
|
||||
__RCSID("$NetBSD: output.c,v 1.30 2008/10/12 01:40:37 dholland Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -72,7 +72,6 @@ __RCSID("$NetBSD: output.c,v 1.29 2006/03/17 14:47:10 rumble Exp $");
|
|||
#define OUTBUFSIZ BUFSIZ
|
||||
#define BLOCK_OUT -2 /* output to a fixed block of memory */
|
||||
#define MEM_OUT -3 /* output to dynamically allocated memory */
|
||||
#define OUTPUT_ERR 01 /* error occurred on output */
|
||||
|
||||
|
||||
struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: output.h,v 1.18 2008/03/29 09:49:52 apb Exp $ */
|
||||
/* $NetBSD: output.h,v 1.19 2008/10/12 01:40:37 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -47,6 +47,9 @@ struct output {
|
|||
short flags;
|
||||
};
|
||||
|
||||
/* flags for ->flags */
|
||||
#define OUTPUT_ERR 01 /* error occurred on output */
|
||||
|
||||
extern struct output output;
|
||||
extern struct output errout;
|
||||
extern struct output memout;
|
||||
|
|
Loading…
Reference in New Issue