'official' patch from Ozan S. Yigit <oz@ursa.sis.yorku.ca>:

bug:if there are multiple files on the command line, file index is not
reset properly, ie. it falls off the side. sigh. also, somewhere along
the line, i again lost the proper m4wrap/autodiversion semantics
[sorry, eric. :-|] but fixed with this patch.
This commit is contained in:
cgd 1993-11-03 05:16:21 +00:00
parent 25d572fb12
commit 402e6e1c32

View File

@ -863,9 +863,11 @@ int main(argc, argv)
} else /* file names in commandline */
for (; optind < argc; optind++) {
char *name = argv[optind]; /* next file name */
ilevel = 0;
infile[0] = fopen(name, "r");
if (!infile[0]) cantread(name);
sp = -1; /* stack pointer initialized */
fp = 0; /* frame pointer initialized */
ilevel = 0; /* reset input file stack ptr*/
#ifndef NO__FILE
dodefine("__FILE__", name);
#endif
@ -878,11 +880,14 @@ int main(argc, argv)
putback(EOF); /* eof is a must !! */
pbstr(m4wraps); /* user-defined wrapup act */
macro(); /* last will and testament */
} else { /* default wrap-up: undivert */
for (n = 1; n < MAXOUT; n++)
if (outfile[n] != NULL) getdiv(n);
}
if (active != stdout)
active = stdout; /* reset output just in case */
for (n = 1; n < MAXOUT; n++) /* default wrap-up: undivert */
if (outfile[n] != NULL) getdiv(n);
if (outfile[0] != NULL) { /* remove bitbucket if used */
(void) fclose(outfile[0]);
m4temp[UNIQUE] = '0';