Back out my minorly disputed and possibly not well thought out changes to how
arguments are processed, at least temporarily.
This commit is contained in:
parent
c9b544afdb
commit
e9a7c53895
@ -83,12 +83,11 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct openfile *ip;
|
struct openfile *ip;
|
||||||
|
|
||||||
if (argc > MAXOFILES)
|
if (argc == 1)
|
||||||
errx(1, "too many input files");
|
|
||||||
else if (argc == 1)
|
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
getargs(argv);
|
getargs(argv);
|
||||||
|
if (!morefiles)
|
||||||
|
usage();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
linep = line;
|
linep = line;
|
||||||
for (ip = input; ip->fp != NULL; ip++)
|
for (ip = input; ip->fp != NULL; ip++)
|
||||||
@ -114,10 +113,11 @@ getargs(char *av[])
|
|||||||
P = S = F = T = 0; /* capitalized options */
|
P = S = F = T = 0; /* capitalized options */
|
||||||
while ((p = *++av) != NULL) {
|
while ((p = *++av) != NULL) {
|
||||||
if (*p != '-' || !p[1]) {
|
if (*p != '-' || !p[1]) {
|
||||||
morefiles++;
|
if (++morefiles >= MAXOFILES)
|
||||||
if (*p == '-') {
|
errx(1, "too many input files");
|
||||||
|
if (*p == '-')
|
||||||
ip->fp = stdin;
|
ip->fp = stdin;
|
||||||
} else if ((ip->fp = fopen(p, "r")) == NULL) {
|
else if ((ip->fp = fopen(p, "r")) == NULL) {
|
||||||
err(1, "%s", p);
|
err(1, "%s", p);
|
||||||
}
|
}
|
||||||
ip->pad = P;
|
ip->pad = P;
|
||||||
|
Loading…
Reference in New Issue
Block a user