paste: No need to make an exception for stdin, just close it at the end
This commit is contained in:
parent
1c6298103e
commit
0779d69df7
8
paste.c
8
paste.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user