1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 10:51:48 +02:00

No longer include long-options.h.

[long_options]: Add entries for --help and --version.
Remove parse_long_options call.
(main) [getopt switch]: Add a case for each of --help and --version.
This commit is contained in:
Jim Meyering
1999-03-31 05:52:46 +00:00
parent 419aa42181
commit fdd07e3d2b
10 changed files with 54 additions and 40 deletions

View File

@@ -27,7 +27,6 @@
#include "error.h"
#include "getdate.h"
#include "getline.h"
#include "long-options.h"
#include "posixtm.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -66,6 +65,8 @@ static struct option const long_options[] =
{"uct", no_argument, NULL, 'u'},
{"utc", no_argument, NULL, 'u'},
{"universal", no_argument, NULL, 'u'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -285,9 +286,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
while ((optc = getopt_long (argc, argv, "d:f:r:Rs:u", long_options, NULL))
!= -1)
switch (optc)
@@ -313,6 +311,8 @@ main (int argc, char **argv)
case 'u':
universal_time = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}

View File

@@ -85,7 +85,6 @@
#include "system.h"
#include "error.h"
#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "env"
@@ -103,6 +102,8 @@ static struct option const longopts[] =
{
{"ignore-environment", no_argument, NULL, 'i'},
{"unset", required_argument, NULL, 'u'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -144,9 +145,6 @@ main (register int argc, register char **argv, char **envp)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
while ((optc = getopt_long (argc, argv, "+iu:", longopts, NULL)) != -1)
{
switch (optc)
@@ -158,6 +156,8 @@ main (register int argc, register char **argv, char **envp)
break;
case 'u':
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (2);
}

View File

@@ -28,7 +28,6 @@
#include "system.h"
#include "error.h"
#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "id"
@@ -83,6 +82,8 @@ static struct option const longopts[] =
{"name", no_argument, NULL, 'n'},
{"real", no_argument, NULL, 'r'},
{"user", no_argument, NULL, 'u'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -124,9 +125,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
while ((optc = getopt_long (argc, argv, "agnruG", longopts, NULL)) != -1)
{
switch (optc)
@@ -151,6 +149,8 @@ main (int argc, char **argv)
case 'G':
just_group_list = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}

View File

@@ -24,7 +24,6 @@
#include "system.h"
#include "error.h"
#include "long-options.h"
#include "readutmp.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -77,6 +76,8 @@ static int include_where = 1;
static struct option const longopts[] =
{
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -440,9 +441,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
while ((optc = getopt_long (argc, argv, "sfwiqbhlp", longopts, &longind))
!= -1)
{
@@ -494,6 +492,10 @@ main (int argc, char **argv)
include_home_and_shell = 0;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}

View File

@@ -25,7 +25,6 @@
#include "system.h"
#include "error.h"
#include "long-options.h"
#include "xstrtod.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -69,6 +68,8 @@ static struct option const long_options[] =
{ "equal-width", no_argument, NULL, 'w'},
{ "format", required_argument, NULL, 'f'},
{ "separator", required_argument, NULL, 's'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{ NULL, 0, NULL, 0}
};
@@ -117,9 +118,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
equal_width = 0;
format_str = NULL;
separator = "\n";
@@ -157,6 +155,10 @@ main (int argc, char **argv)
equal_width = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
/* NOTREACHED */

View File

@@ -82,7 +82,6 @@
#define getusershell _getusershell_sys_proto_
#include "system.h"
#include "long-options.h"
#undef getusershell
@@ -174,6 +173,8 @@ static struct option const longopts[] =
{"login", no_argument, NULL, 'l'},
{"preserve-environment", no_argument, &change_environment, 0},
{"shell", required_argument, 0, 's'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{0, 0, 0, 0}
};
@@ -465,9 +466,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
fast_startup = 0;
simulate_login = 0;
change_environment = 1;
@@ -500,6 +498,10 @@ main (int argc, char **argv)
shell = optarg;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}

View File

@@ -26,7 +26,6 @@
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "tee"
@@ -50,6 +49,8 @@ static struct option const long_options[] =
{
{"append", no_argument, NULL, 'a'},
{"ignore-interrupts", no_argument, NULL, 'i'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -86,9 +87,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
append = 0;
ignore_interrupts = 0;
@@ -107,6 +105,10 @@ main (int argc, char **argv)
ignore_interrupts = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}

View File

@@ -30,7 +30,6 @@
#include "system.h"
#include "closeout.h"
#include "error.h"
#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "tty"
@@ -47,6 +46,8 @@ static struct option const longopts[] =
{
{"silent", no_argument, NULL, 's'},
{"quiet", no_argument, NULL, 's'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -82,9 +83,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
silent = 0;
while ((optc = getopt_long (argc, argv, "s", longopts, NULL)) != -1)
@@ -98,6 +96,10 @@ main (int argc, char **argv)
silent = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (2);
}

View File

@@ -40,7 +40,6 @@
#include "system.h"
#include "error.h"
#include "long-options.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "uname"
@@ -82,6 +81,8 @@ static struct option const long_options[] =
{"sysname", no_argument, NULL, 's'},
{"processor", no_argument, NULL, 'p'},
{"all", no_argument, NULL, 'a'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -123,9 +124,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
toprint = 0;
while ((c = getopt_long (argc, argv, "snrvpma", long_options, NULL)) != -1)
@@ -164,6 +162,10 @@ main (int argc, char **argv)
PRINT_PROCESSOR | PRINT_VERSION | PRINT_MACHINE);
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}

View File

@@ -29,7 +29,6 @@
#include <stdio.h>
#include "error.h"
#include "long-options.h"
#include "readutmp.h"
#include "system.h"
@@ -81,6 +80,8 @@ static struct option const longopts[] =
{"message", no_argument, NULL, 'T'},
{"mesg", no_argument, NULL, 'T'},
{"writable", no_argument, NULL, 'T'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
@@ -388,9 +389,6 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
AUTHORS, usage);
while ((optc = getopt_long (argc, argv, "ilmqsuwHT", longopts, &longind))
!= -1)
{
@@ -428,6 +426,10 @@ main (int argc, char **argv)
include_mesg = 1;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (1);
}