Simplify return & fshut() logic
Get rid of the !!()-constructs and use ret where available (or introduce it). In some cases, there would be an "abort" on the first fshut-error, but we want to close all files and report all warnings and then quit, not just the warning for the first file.
This commit is contained in:
parent
e8a4f37884
commit
d23cc72490
4
cat.c
4
cat.c
|
@ -44,5 +44,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
4
cksum.c
4
cksum.c
|
@ -111,5 +111,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
14
cmp.c
14
cmp.c
|
@ -16,7 +16,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
FILE *fp[2];
|
||||
size_t line = 1, n;
|
||||
int lflag = 0, sflag = 0, same = 1, b[2];
|
||||
int ret = 0, lflag = 0, sflag = 0, same = 1, b[2];
|
||||
|
||||
ARGBEGIN {
|
||||
case 'l':
|
||||
|
@ -72,9 +72,11 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
enfshut(2, fp[0], argv[0]);
|
||||
if (fp[0] != fp[1])
|
||||
enfshut(2, fp[1], argv[1]);
|
||||
enfshut(2, stdout, "<stdout>");
|
||||
return !same;
|
||||
if (!ret)
|
||||
ret = !same;
|
||||
if (fshut(fp[0], argv[0]) | (fp[0] != fp[1] && fshut(fp[1], argv[1])) |
|
||||
fshut(stdout, "<stdout>"))
|
||||
ret = 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
6
col.c
6
col.c
|
@ -190,6 +190,8 @@ usage(void)
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ARGBEGIN {
|
||||
case 'b':
|
||||
backspace = 1;
|
||||
|
@ -217,5 +219,7 @@ main(int argc, char *argv[])
|
|||
col();
|
||||
flush();
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
4
cols.c
4
cols.c
|
@ -87,5 +87,7 @@ main(int argc, char *argv[])
|
|||
putchar('\n');
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
9
comm.c
9
comm.c
|
@ -33,7 +33,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
FILE *fp[2];
|
||||
size_t linelen[2] = { 0, 0 };
|
||||
int i, diff = 0;
|
||||
int ret = 0, i, diff = 0;
|
||||
char *line[2] = { NULL, NULL };
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -79,6 +79,9 @@ main(int argc, char *argv[])
|
|||
printline((2 - diff) % 3, line[MAX(0, diff)]);
|
||||
}
|
||||
end:
|
||||
return !!(fshut(fp[0], argv[0]) + (fp[0] != fp[1] && fshut(fp[1], argv[1])) +
|
||||
fshut(stdout, "<stdout>"));
|
||||
ret |= fshut(fp[0], argv[0]);
|
||||
ret |= (fp[0] != fp[1]) && fshut(fp[1], argv[1]);
|
||||
ret |= fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
4
cut.c
4
cut.c
|
@ -201,5 +201,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
4
expand.c
4
expand.c
|
@ -125,5 +125,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
5
expr.c
5
expr.c
|
@ -258,8 +258,11 @@ main(int argc, char *argv[])
|
|||
int ret;
|
||||
|
||||
argv0 = argv[0], argc--, argv++;
|
||||
|
||||
ret = !parse(argv, argc);
|
||||
enfshut(3, stdout, "<stdout>");
|
||||
|
||||
if (fshut(stdout, "<stdout>"))
|
||||
ret = 3;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
4
find.c
4
find.c
|
@ -1036,5 +1036,7 @@ main(int argc, char **argv)
|
|||
t->u.pinfo->freearg(t->extra);
|
||||
free(toks);
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || gflags.ret;
|
||||
gflags.ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return gflags.ret;
|
||||
}
|
||||
|
|
4
fold.c
4
fold.c
|
@ -110,5 +110,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
5
grep.c
5
grep.c
|
@ -277,7 +277,8 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
enfshut(Error, stdin, "<stdin>");
|
||||
enfshut(Error, stdout, "<stdout>");
|
||||
if (fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>"))
|
||||
match = Error;
|
||||
|
||||
return match;
|
||||
}
|
||||
|
|
4
head.c
4
head.c
|
@ -71,5 +71,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
12
join.c
12
join.c
|
@ -477,7 +477,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
size_t jf[2] = { jfield, jfield, };
|
||||
FILE *fp[2];
|
||||
int n;
|
||||
int ret = 0, n;
|
||||
char *fno;
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -544,9 +544,9 @@ main(int argc, char *argv[])
|
|||
if (oflag)
|
||||
freespecs(&output);
|
||||
|
||||
enfshut(2, fp[0], argv[0]);
|
||||
if (fp[0] != fp[1])
|
||||
enfshut(2, fp[1], argv[1]);
|
||||
enfshut(2, stdout, "<stdout>");
|
||||
return 0;
|
||||
if (fshut(fp[0], argv[0]) | (fp[0] != fp[1] && fshut(fp[1], argv[1])) |
|
||||
fshut(stdout, "<stdout>"))
|
||||
ret = 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
8
md5sum.c
8
md5sum.c
|
@ -24,7 +24,7 @@ usage(void)
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
|
||||
int ret = 0, (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
|
||||
uint8_t md[MD5_DIGEST_LENGTH];
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -35,6 +35,8 @@ main(int argc, char *argv[])
|
|||
usage();
|
||||
} ARGEND;
|
||||
|
||||
return cryptfunc(argc, argv, &md5_ops, md, sizeof(md)) ||
|
||||
!!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= cryptfunc(argc, argv, &md5_ops, md, sizeof(md));
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
7
nl.c
7
nl.c
|
@ -113,6 +113,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
FILE *fp = NULL;
|
||||
size_t l, s;
|
||||
int ret = 0;
|
||||
char *d, *formattype, *formatblit;
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -199,6 +200,8 @@ main(int argc, char *argv[])
|
|||
nl(argv[0], fp);
|
||||
}
|
||||
|
||||
return !!((fp && fp != stdin && fshut(fp, argv[0]))
|
||||
+ fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= fp && fp != stdin && fshut(fp, argv[0]);
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
6
paste.c
6
paste.c
|
@ -133,7 +133,9 @@ main(int argc, char *argv[])
|
|||
|
||||
for (i = 0; i < argc; i++)
|
||||
if (dsc[i].fp != stdin && fshut(dsc[i].fp, argv[i]))
|
||||
ret = 1;
|
||||
ret |= fshut(dsc[i].fp, argv[i]);
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
6
sed.c
6
sed.c
|
@ -1682,7 +1682,7 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
char *arg;
|
||||
int script = 0;
|
||||
int ret = 0, script = 0;
|
||||
|
||||
ARGBEGIN {
|
||||
case 'n':
|
||||
|
@ -1717,5 +1717,7 @@ main(int argc, char *argv[])
|
|||
files = argv;
|
||||
run();
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ usage(void)
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
|
||||
int ret = 0, (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
|
||||
uint8_t md[SHA1_DIGEST_LENGTH];
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -34,6 +34,8 @@ main(int argc, char *argv[])
|
|||
usage();
|
||||
} ARGEND;
|
||||
|
||||
return cryptfunc(argc, argv, &sha1_ops, md, sizeof(md)) ||
|
||||
!!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= cryptfunc(argc, argv, &sha1_ops, md, sizeof(md));
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ usage(void)
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
|
||||
int ret = 0, (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
|
||||
uint8_t md[SHA256_DIGEST_LENGTH];
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -34,6 +34,8 @@ main(int argc, char *argv[])
|
|||
usage();
|
||||
} ARGEND;
|
||||
|
||||
return cryptfunc(argc, argv, &sha256_ops, md, sizeof(md)) ||
|
||||
!!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= cryptfunc(argc, argv, &sha256_ops, md, sizeof(md));
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ usage(void)
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
|
||||
int ret = 0, (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
|
||||
uint8_t md[SHA512_DIGEST_LENGTH];
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -34,6 +34,8 @@ main(int argc, char *argv[])
|
|||
usage();
|
||||
} ARGEND;
|
||||
|
||||
return cryptfunc(argc, argv, &sha512_ops, md, sizeof(md)) ||
|
||||
!!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= cryptfunc(argc, argv, &sha512_ops, md, sizeof(md));
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
5
sort.c
5
sort.c
|
@ -332,7 +332,8 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
enfshut(2, stdin, "<stdin>");
|
||||
enfshut(2, stdout, "<stdout>");
|
||||
if (fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>"))
|
||||
ret = 2;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
9
split.c
9
split.c
|
@ -50,7 +50,7 @@ main(int argc, char *argv[])
|
|||
FILE *in = stdin, *out = NULL;
|
||||
size_t size = 1000, scale = 1, n;
|
||||
long l;
|
||||
int ch, plen, slen = 2, always = 0;
|
||||
int ret = 0, ch, plen, slen = 2, always = 0;
|
||||
char name[NAME_MAX + 1], *prefix = "x", *file = NULL, *tmp, *end;
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -124,6 +124,9 @@ main(int argc, char *argv[])
|
|||
putc(ch, out);
|
||||
}
|
||||
|
||||
return !!(fshut(in, "<infile>") + (out && fshut(out, "<outfile>")) +
|
||||
fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= (in != stdin) && fshut(in, "<infile>");
|
||||
ret |= out && (out != stdout) && fshut(out, "<outfile>");
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
5
sponge.c
5
sponge.c
|
@ -14,6 +14,7 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fp, *tmpfp;
|
||||
int ret = 0;
|
||||
|
||||
argv0 = argv[0], argc--, argv++;
|
||||
|
||||
|
@ -29,5 +30,7 @@ main(int argc, char *argv[])
|
|||
eprintf("fopen %s:", argv[0]);
|
||||
concat(tmpfp, "<tmpfile>", fp, argv[0]);
|
||||
|
||||
return !!(fshut(fp, argv[0]) + fshut(tmpfp, "<tmpfile>"));
|
||||
ret |= fshut(fp, argv[0]) | fshut(tmpfp, "<tmpfile>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -94,5 +94,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
6
tail.c
6
tail.c
|
@ -47,7 +47,7 @@ taketail(FILE *fp, const char *str, size_t n)
|
|||
ring = ecalloc(n, sizeof(*ring));
|
||||
size = ecalloc(n, sizeof(*size));
|
||||
|
||||
for (i = j = 0; getline(&ring[i], &size[i], fp) > 0; )
|
||||
for (i = j = 0; getline(ring + i, size + i, fp) > 0; )
|
||||
i = j = (i + 1) % n;
|
||||
} else {
|
||||
r = ecalloc(n, sizeof(*r));
|
||||
|
@ -157,5 +157,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
6
tee.c
6
tee.c
|
@ -15,7 +15,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
FILE **fps = NULL;
|
||||
size_t i, n, nfps;
|
||||
int aflag = 0, iflag = 0;
|
||||
int ret = 0, aflag = 0, iflag = 0;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -47,5 +47,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
7
tr.c
7
tr.c
|
@ -174,6 +174,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
Rune r = 0, lastrune = 0;
|
||||
size_t off1, off2, i, m;
|
||||
int ret = 0;
|
||||
|
||||
ARGBEGIN {
|
||||
case 'c':
|
||||
|
@ -204,8 +205,10 @@ main(int argc, char *argv[])
|
|||
if (set2check && cflag && !dflag)
|
||||
eprintf("set2 can't be imaged to from a complement.\n");
|
||||
read:
|
||||
if (!efgetrune(&r, stdin, "<stdin>"))
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>"));
|
||||
if (!efgetrune(&r, stdin, "<stdin>")) {
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
return ret;
|
||||
}
|
||||
off1 = off2 = 0;
|
||||
for (i = 0; i < set1ranges; i++) {
|
||||
if (set1[i].start <= r && r <= set1[i].end) {
|
||||
|
|
|
@ -168,7 +168,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
efshut(stdin, "<stdin>");
|
||||
efshut(stdout, "<stdout>");
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
8
uniq.c
8
uniq.c
|
@ -97,7 +97,7 @@ int
|
|||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fp[2] = { stdin, stdout };
|
||||
int i;
|
||||
int ret = 0, i;
|
||||
char *fname[2] = { "<stdin>", "<stdout>" };
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -134,7 +134,7 @@ main(int argc, char *argv[])
|
|||
uniq(fp[0], fp[1]);
|
||||
uniqfinish(fp[1]);
|
||||
|
||||
efshut(fp[0], fname[0]);
|
||||
efshut(fp[1], fname[1]);
|
||||
return 0;
|
||||
ret |= fshut(fp[0], fname[0]) | fshut(fp[1], fname[1]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -228,6 +228,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
FILE *fp = NULL, *nfp = NULL;
|
||||
mode_t mode = 0;
|
||||
int ret = 0;
|
||||
char *fname, *header, *ifname, *ofname = NULL;
|
||||
void (*d) (FILE *, FILE *) = NULL;
|
||||
|
||||
|
@ -274,6 +275,8 @@ main(int argc, char *argv[])
|
|||
if (nfp != stdout && chmod(fname, mode) < 0)
|
||||
eprintf("chmod %s:", fname);
|
||||
|
||||
return !!(fshut(fp, fp == stdin ? "<stdin>" : argv[0]) +
|
||||
fshut(nfp, nfp == stdout ? "<stdout>" : fname));
|
||||
ret |= fshut(fp, (fp == stdin) ? "<stdin>" : argv[0]);
|
||||
ret |= fshut(nfp, (nfp == stdout) ? "<stdout>" : fname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
FILE *fp = NULL;
|
||||
void (*uuencode_f)(FILE *, const char *, const char *) = uuencode;
|
||||
int ret = 0;
|
||||
|
||||
ARGBEGIN {
|
||||
case 'm':
|
||||
|
@ -122,6 +123,8 @@ main(int argc, char *argv[])
|
|||
uuencode_f(fp, argv[1], argv[0]);
|
||||
}
|
||||
|
||||
return !!((fp && fshut(fp, argv[0])) + fshut(stdin, "<stdin>") +
|
||||
fshut(stdout, "<stdout>"));
|
||||
ret |= fp && fshut(fp, argv[0]);
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
4
wc.c
4
wc.c
|
@ -102,5 +102,7 @@ main(int argc, char *argv[])
|
|||
output("total", tc, tl, tw);
|
||||
}
|
||||
|
||||
return !!(fshut(stdin, "<stdin>") + fshut(stdout, "<stdout>")) || ret;
|
||||
ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
8
xargs.c
8
xargs.c
|
@ -194,7 +194,7 @@ usage(void)
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int leftover = 0, i;
|
||||
int ret = 0, leftover = 0, i;
|
||||
size_t argsz, argmaxsz;
|
||||
size_t arglen, a;
|
||||
char *arg = "";
|
||||
|
@ -272,6 +272,8 @@ main(int argc, char *argv[])
|
|||
|
||||
free(argb);
|
||||
|
||||
return (nerrors || !!(fshut(stdin, "<stdin>") +
|
||||
fshut(stdout, "<stdout>"))) ? 123 : 0;
|
||||
if (nerrors || (fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>")))
|
||||
ret = 123;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user