diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-08-02 17:39:51 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1996-08-02 17:39:51 +0000 |
commit | 1511ec17050384e07842ce6d80189816f6233231 (patch) | |
tree | 6b1630df9e9eaa08c04e868dce4be9a93ce5d1c1 | |
parent | 72037cee5888b3da950f02a231c4398aee177949 (diff) |
Exit with status >0 if any error occured; from FreeBSD
-rw-r--r-- | bin/cat/cat.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c index d503c61cab9..d193f27b349 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cat.c,v 1.3 1996/08/02 12:40:48 deraadt Exp $ */ +/* $OpenBSD: cat.c,v 1.4 1996/08/02 17:39:50 tholo Exp $ */ /* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: cat.c,v 1.3 1996/08/02 12:40:48 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: cat.c,v 1.4 1996/08/02 17:39:50 tholo Exp $"; #endif #endif /* not lint */ @@ -136,6 +136,7 @@ cook_args(argv) fp = stdin; else if ((fp = fopen(*argv, "r")) == NULL) { warn("%s", *argv); + rval = 1; ++argv; continue; } @@ -204,6 +205,7 @@ cook_buf(fp) } if (ferror(fp)) { warn("%s", filename); + rval = 1; clearerr(fp); } if (ferror(stdout)) @@ -224,6 +226,7 @@ raw_args(argv) fd = fileno(stdin); else if ((fd = open(*argv, O_RDONLY, 0)) < 0) { warn("%s", *argv); + rval = 1; ++argv; continue; } @@ -256,6 +259,8 @@ raw_cat(rfd) for (off = 0; nr; nr -= nw, off += nw) if ((nw = write(wfd, buf + off, nr)) < 0) err(1, "stdout"); - if (nr < 0) + if (nr < 0) { warn("%s", filename); + rval = 1; + } } |