Let m4 accept a command-line argument (input file)
This unbreaks some configure scripts (reported by David Given)
This commit is contained in:
parent
5cb414f4d5
commit
f13d86f6e5
1 changed files with 13 additions and 1 deletions
|
@ -185,7 +185,7 @@ char *argv[];
|
||||||
#endif
|
#endif
|
||||||
initkwds();
|
initkwds();
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "tD:U:o:")) != EOF)
|
while ((c = getopt(argc, argv, "tD:U:o:")) != EOF) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
|
|
||||||
case 'D': /* define something..*/
|
case 'D': /* define something..*/
|
||||||
|
@ -204,8 +204,20 @@ char *argv[];
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
|
||||||
|
if(argc > 1) { usage(); }
|
||||||
infile[0] = stdin; /* default input (naturally) */
|
infile[0] = stdin; /* default input (naturally) */
|
||||||
|
if(argc == 1) {
|
||||||
|
if(!(infile[0] = fopen(argv[0], "r"))) {
|
||||||
|
perror(argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
active = stdout; /* default active output */
|
active = stdout; /* default active output */
|
||||||
m4temp = mktemp(divnam); /* filename for diversions */
|
m4temp = mktemp(divnam); /* filename for diversions */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue