[hackers] [sbase] paste: No need to make an exception for stdin, just close it at the end || sin
commit c695bd1d32fe87acb5d8262313e7cbb6a9ee15e4
Author: sin <sin_AT_2f30.org>
Date: Tue Feb 10 12:08:06 2015 +0000
paste: No need to make an exception for stdin, just close it at the end
diff --git a/paste.c b/paste.c
index 1da8c31..fd8ca77 100644
--- a/paste.c
+++ b/paste.c
_AT_@ -120,10 +120,8 @@ main(int argc, char *argv[])
dsc[i].fp = stdin;
else
dsc[i].fp = fopen(argv[i], "r");
-
if (!dsc[i].fp)
eprintf("fopen %s:", argv[i]);
-
dsc[i].name = argv[i];
}
_AT_@ -132,10 +130,8 @@ main(int argc, char *argv[])
else
parallel(dsc, argc, delim, len);
- for (i = 0; i < argc; i++) {
- if (dsc[i].fp != stdin)
- (void)fclose(dsc[i].fp);
- }
+ for (i = 0; i < argc; i++)
+ fclose(dsc[i].fp);
return 0;
}
Received on Tue Feb 10 2015 - 17:52:02 CET
This archive was generated by hypermail 2.3.0
: Tue Feb 10 2015 - 18:00:16 CET