commit 0779d69df77f3f05c1df1da13b6e4705a1af1288
parent 1c6298103eb46573e62d63e61c207efa2b24b614
Author: sin <sin@2f30.org>
Date: Tue, 10 Feb 2015 12:08:06 +0000
paste: No need to make an exception for stdin, just close it at the end
Diffstat:
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/paste.c b/paste.c
@@ -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];
}
@@ -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;
}