diff options
author | Roland McGrath <roland@redhat.com> | 1992-09-30 01:26:59 +0000 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 1992-09-30 01:26:59 +0000 |
commit | b0cafff1bfb7d3b79ca06fec15feea5155645aa5 (patch) | |
tree | 114cac858d69d7460e12ccbae166a6c609b82a6a | |
parent | f683e78f53bc2de6edcfef6debb62ba7c26715c5 (diff) | |
download | gunmake-b0cafff1bfb7d3b79ca06fec15feea5155645aa5.tar.gz |
Formerly main.c.~59~
-rw-r--r-- | main.c | 32 |
1 files changed, 26 insertions, 6 deletions
@@ -237,7 +237,7 @@ static struct command_switch switches[] = { 'h', usage_and_exit, 0, 0, 0, 0, 0, 0, "help", 0, - "Print this message and exit." }, + "Print this message and exit" }, { 'i', flag, (char *) &ignore_errors_flag, 1, 1, 0, 0, 0, "ignore-errors", 0, "Ignore errors from commands" }, @@ -311,6 +311,12 @@ static struct option long_option_aliases[] = { "makefile", required_argument, 0, 'f' }, }; +/* The usage message prints the descriptions of options starting in + this column. Make sure it leaves enough room for the longest + description to fit in less than 80 characters. */ + +#define DESCRIPTION_COLUMN 30 + /* List of non-switch arguments. */ struct stringlist *other_args = 0; @@ -1174,7 +1180,12 @@ positive integral argument", if (bad) { /* Print a nice usage message. */ + + if (print_version_flag) + print_version (); + fprintf (stderr, "Usage: %s [options] [target] ...\n", program); + fputs ("Options:\n", stderr); for (cs = switches; cs->c != '\0'; ++cs) { @@ -1231,13 +1242,18 @@ positive integral argument", } } - if (p - buf >= 30) + if (p - buf > DESCRIPTION_COLUMN - 2) + /* The list of option names is too long to fit on the same + line with the description, leaving at least two spaces. + Print it on its own line instead. */ { fprintf (stderr, "%s\n", buf); buf[0] = '\0'; } - fprintf (stderr, "%-30s%s.\n", buf, cs->description); + fprintf (stderr, "%*s%s.\n", + - DESCRIPTION_COLUMN, + buf, cs->description); } die (1); @@ -1393,16 +1409,20 @@ define_makeflags (pf, makefile) (void) define_variable ("MFLAGS", 6, flags, o_env, 0); } -static int printed_version = 0; - /* Print version information. */ static void print_version () { + static int printed_version = 0; + extern char *remote_description; char *precede = print_data_base_flag ? "# " : ""; + if (printed_version) + /* Do it only once. */ + return; + printf ("%sGNU Make version %s", precede, version_string); if (remote_description != 0 && *remote_description != '\0') printf ("-%s", remote_description); @@ -1455,7 +1475,7 @@ die (status) dying = 1; - if (print_version_flag && !printed_version) + if (print_version_flag) print_version (); /* Wait for children to die. */ |