paste: No need to make an exception for stdin, just close it at the end

This commit is contained in:
sin 2015-02-10 12:08:06 +00:00
parent 1c6298103e
commit 0779d69df7
1 changed files with 2 additions and 6 deletions

View File

@ -120,10 +120,8 @@ main(int argc, char *argv[])
dsc[i].fp = stdin; dsc[i].fp = stdin;
else else
dsc[i].fp = fopen(argv[i], "r"); dsc[i].fp = fopen(argv[i], "r");
if (!dsc[i].fp) if (!dsc[i].fp)
eprintf("fopen %s:", argv[i]); eprintf("fopen %s:", argv[i]);
dsc[i].name = argv[i]; dsc[i].name = argv[i];
} }
@ -132,10 +130,8 @@ main(int argc, char *argv[])
else else
parallel(dsc, argc, delim, len); parallel(dsc, argc, delim, len);
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++)
if (dsc[i].fp != stdin) fclose(dsc[i].fp);
(void)fclose(dsc[i].fp);
}
return 0; return 0;
} }