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:
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user