string, /* One string per switch. */
positive_int, /* A positive integer. */
floating, /* A floating-point number (double). */
- ignore, /* Ignored. */
- usage_and_exit /* Ignored; exit after processing switches. */
+ ignore /* Ignored. */
} type;
char *value_ptr; /* Pointer to the value-holding variable. */
/* List of files given with -W switches. */
static struct stringlist *new_files = 0;
+
+/* If nonzero, we should just print usage and exit. */
+
+static int print_usage_flag = 0;
\f
/* The table of command switches. */
{ 'f', string, (char *) &makefiles, 0, 0, 0, 0, 0,
"file", "FILE",
"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,
"Print this message and exit" },
{ 'i', flag, (char *) &ignore_errors_flag, 1, 1, 0, 0, 0,
/* `make --version' is supposed to just print the version and exit. */
if (print_version_flag)
- die (1);
+ die (0);
/* Search for command line arguments that define variables,
and do the definitions. Also save up the text of these
case flag:
case flag_off:
case ignore:
- case usage_and_exit:
long_options[i].has_arg = no_argument;
break;
case ignore:
break;
- case usage_and_exit:
- bad = 1;
- break;
-
case flag:
case flag_off:
if (doit)
other_args->list[other_args->idx] = 0;
}
- if (bad && !env)
+ if (!env && (bad || print_usage_flag))
{
/* Print a nice usage message. */
buf, cs->description);
}
- die (1);
+ die (bad);
}
}