If processing of one file fails, try to process the remaining files and

exit non-zero instead of immediately exiting. The traditional BSD
behaviour is explicitly forbidden by P1003.2.
This commit is contained in:
Tim J. Robbins 2002-05-24 06:03:12 +00:00
parent 885fbc97c1
commit a6ea32c3c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97218

View File

@ -71,7 +71,7 @@ main(argc, argv)
{
FILE *fp;
void (*fcn) (FILE *, const char *) = NULL;
int ch;
int ch, rval;
fcn = NULL;
setlocale (LC_ALL, "");
@ -115,16 +115,20 @@ main(argc, argv)
} else if (!cflag || dflag || sflag)
usage();
rval = 0;
if (*argv)
for (; *argv; ++argv) {
if (!(fp = fopen(*argv, "r")))
err(1, "%s", *argv);
if (!(fp = fopen(*argv, "r"))) {
warn("%s", *argv);
rval = 1;
continue;
}
fcn(fp, *argv);
(void)fclose(fp);
}
else
fcn(stdin, "stdin");
exit(0);
exit(rval);
}
size_t autostart, autostop, maxval;