mirror of
https://github.com/mirror/make.git
synced 2025-01-06 02:10:35 +08:00
Formerly main.c.~43~
This commit is contained in:
parent
8ed1c7446e
commit
3b69c7a484
31
main.c
31
main.c
@ -1027,8 +1027,8 @@ decode_switches (argc, argv)
|
|||||||
decode_env_switches ("MFLAGS", 6);
|
decode_env_switches ("MFLAGS", 6);
|
||||||
|
|
||||||
other_args = (struct stringlist *) xmalloc (sizeof (struct stringlist));
|
other_args = (struct stringlist *) xmalloc (sizeof (struct stringlist));
|
||||||
other_args->max = 5;
|
other_args->max = argc;
|
||||||
other_args->list = (char **) xmalloc (5 * sizeof (char *));
|
other_args->list = (char **) xmalloc (argc * sizeof (char *));
|
||||||
other_args->idx = 1;
|
other_args->idx = 1;
|
||||||
other_args->list[0] = savestring (argv[0], strlen (argv[0]));
|
other_args->list[0] = savestring (argv[0], strlen (argv[0]));
|
||||||
|
|
||||||
@ -1081,14 +1081,11 @@ decode_switches (argc, argv)
|
|||||||
else if (c == 1)
|
else if (c == 1)
|
||||||
{
|
{
|
||||||
/* This is a non-option argument. */
|
/* This is a non-option argument. */
|
||||||
if (other_args->idx == other_args->max - 1)
|
|
||||||
{
|
|
||||||
other_args->max += 5;
|
|
||||||
other_args->list = (char **)
|
|
||||||
xrealloc ((char *) other_args->list,
|
|
||||||
other_args->max * sizeof (char *));
|
|
||||||
}
|
|
||||||
other_args->list[other_args->idx++] = optarg;
|
other_args->list[other_args->idx++] = optarg;
|
||||||
|
if (getenv ("POSIXLY_CORRECT") != 0)
|
||||||
|
/* POSIX.2 says all the options must come first.
|
||||||
|
All the remaining args are non-options. */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for (cs = switches; cs->c != '\0'; ++cs)
|
for (cs = switches; cs->c != '\0'; ++cs)
|
||||||
@ -1133,6 +1130,9 @@ decode_switches (argc, argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case positive_int:
|
case positive_int:
|
||||||
|
if (optarg == 0 && argc > optind
|
||||||
|
&& isdigit (argv[optind][0]))
|
||||||
|
optarg = argv[optind++];
|
||||||
if (optarg != 0)
|
if (optarg != 0)
|
||||||
{
|
{
|
||||||
int i = atoi (optarg);
|
int i = atoi (optarg);
|
||||||
@ -1152,10 +1152,12 @@ positive integral argument",
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case floating:
|
case floating:
|
||||||
if (optarg != 0)
|
*(double *) cs->value_ptr
|
||||||
*(double *) cs->value_ptr = atof (optarg);
|
= (optarg != 0 ? atof (optarg)
|
||||||
else
|
: (optind < argc && (isdigit (argv[optind][0])
|
||||||
*(double *) cs->value_ptr = *(double *) cs->noarg_value;
|
|| argv[optind][0] == '.'))
|
||||||
|
? atof (argv[optind++])
|
||||||
|
: *(double *) cs->noarg_value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1164,7 +1166,8 @@ positive integral argument",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other_args != 0)
|
while (optind < argc)
|
||||||
|
other_args->list[other_args->idx++] = argv[optind++];
|
||||||
other_args->list[other_args->idx] = 0;
|
other_args->list[other_args->idx] = 0;
|
||||||
|
|
||||||
if (bad)
|
if (bad)
|
||||||
|
Loading…
Reference in New Issue
Block a user