mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-28 15:57:48 +00:00
Formerly main.c.~82~
This commit is contained in:
parent
f0080188b7
commit
fe92d8e656
1 changed files with 9 additions and 11 deletions
20
main.c
20
main.c
|
@ -91,8 +91,7 @@ struct command_switch
|
||||||
string, /* One string per switch. */
|
string, /* One string per switch. */
|
||||||
positive_int, /* A positive integer. */
|
positive_int, /* A positive integer. */
|
||||||
floating, /* A floating-point number (double). */
|
floating, /* A floating-point number (double). */
|
||||||
ignore, /* Ignored. */
|
ignore /* Ignored. */
|
||||||
usage_and_exit /* Ignored; exit after processing switches. */
|
|
||||||
} type;
|
} type;
|
||||||
|
|
||||||
char *value_ptr; /* Pointer to the value-holding variable. */
|
char *value_ptr; /* Pointer to the value-holding variable. */
|
||||||
|
@ -219,6 +218,10 @@ static struct stringlist *old_files = 0;
|
||||||
/* List of files given with -W switches. */
|
/* List of files given with -W switches. */
|
||||||
|
|
||||||
static struct stringlist *new_files = 0;
|
static struct stringlist *new_files = 0;
|
||||||
|
|
||||||
|
/* If nonzero, we should just print usage and exit. */
|
||||||
|
|
||||||
|
static int print_usage_flag = 0;
|
||||||
|
|
||||||
/* The table of command switches. */
|
/* The table of command switches. */
|
||||||
|
|
||||||
|
@ -239,7 +242,7 @@ static const struct command_switch switches[] =
|
||||||
{ 'f', string, (char *) &makefiles, 0, 0, 0, 0, 0,
|
{ 'f', string, (char *) &makefiles, 0, 0, 0, 0, 0,
|
||||||
"file", "FILE",
|
"file", "FILE",
|
||||||
"Read FILE as a makefile" },
|
"Read FILE as a makefile" },
|
||||||
{ 'h', usage_and_exit, 0, 0, 0, 0, 0, 0,
|
{ 'h', flag, (char *) &print_usage_flag, 0, 0, 0, 0, 0,
|
||||||
"help", 0,
|
"help", 0,
|
||||||
"Print this message and exit" },
|
"Print this message and exit" },
|
||||||
{ 'i', flag, (char *) &ignore_errors_flag, 1, 1, 0, 0, 0,
|
{ 'i', flag, (char *) &ignore_errors_flag, 1, 1, 0, 0, 0,
|
||||||
|
@ -500,7 +503,7 @@ main (argc, argv, envp)
|
||||||
|
|
||||||
/* `make --version' is supposed to just print the version and exit. */
|
/* `make --version' is supposed to just print the version and exit. */
|
||||||
if (print_version_flag)
|
if (print_version_flag)
|
||||||
die (1);
|
die (0);
|
||||||
|
|
||||||
/* Search for command line arguments that define variables,
|
/* Search for command line arguments that define variables,
|
||||||
and do the definitions. Also save up the text of these
|
and do the definitions. Also save up the text of these
|
||||||
|
@ -1085,7 +1088,6 @@ init_switches ()
|
||||||
case flag:
|
case flag:
|
||||||
case flag_off:
|
case flag_off:
|
||||||
case ignore:
|
case ignore:
|
||||||
case usage_and_exit:
|
|
||||||
long_options[i].has_arg = no_argument;
|
long_options[i].has_arg = no_argument;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1173,10 +1175,6 @@ decode_switches (argc, argv, env)
|
||||||
case ignore:
|
case ignore:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case usage_and_exit:
|
|
||||||
bad = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case flag:
|
case flag:
|
||||||
case flag_off:
|
case flag_off:
|
||||||
if (doit)
|
if (doit)
|
||||||
|
@ -1269,7 +1267,7 @@ positive integral argument",
|
||||||
other_args->list[other_args->idx] = 0;
|
other_args->list[other_args->idx] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bad && !env)
|
if (!env && (bad || print_usage_flag))
|
||||||
{
|
{
|
||||||
/* Print a nice usage message. */
|
/* Print a nice usage message. */
|
||||||
|
|
||||||
|
@ -1355,7 +1353,7 @@ positive integral argument",
|
||||||
buf, cs->description);
|
buf, cs->description);
|
||||||
}
|
}
|
||||||
|
|
||||||
die (1);
|
die (bad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue