SCCS-vsn: usr.bin/make/main.c 5.20
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.20 (Berkeley) %G%";
#endif /* not lint */
/*-
#endif /* not lint */
/*-
register char *cp;
char c;
register char *cp;
char c;
- while((c = getopt(argc, argv, "D:I:d:ef:ij:knqrst")) != -1) {
+rearg: while((c = getopt(argc, argv, "D:I:d:ef:ij:knqrst")) != -1) {
switch(c) {
case 'D':
Var_Set(optarg, "1", VAR_GLOBAL);
switch(c) {
case 'D':
Var_Set(optarg, "1", VAR_GLOBAL);
* perform them if so. Else take them to be targets and stuff them
* on the end of the "create" list.
*/
* perform them if so. Else take them to be targets and stuff them
* on the end of the "create" list.
*/
- for (argv += optind; *argv; ++argv)
+ for (argv += optind, argc -= optind; *argv; ++argv, --argc)
if (Parse_IsVar(*argv))
Parse_DoVar(*argv, VAR_CMD);
else {
if (!**argv)
Punt("illegal (null) argument.");
if (Parse_IsVar(*argv))
Parse_DoVar(*argv, VAR_CMD);
else {
if (!**argv)
Punt("illegal (null) argument.");
+ if (**argv == '-') {
+ optind = 0;
+ goto rearg;
+ }
(void)Lst_AtEnd(create, (ClientData)*argv);
}
}
(void)Lst_AtEnd(create, (ClientData)*argv);
}
}