(main): Use getopt where it suffices, not getopt_long.
/* The name this program was run with. */
char *program_name;
-static struct option const long_options[] =
-{
- {0, 0, 0, 0}
-};
-
void
usage (int status)
{
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
-
- while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
- {
- switch (c)
- {
- case 0:
- break;
-
- default:
- usage (EXIT_FAILURE);
- }
- }
+ if (getopt (argc, argv, "") != -1)
+ usage (EXIT_FAILURE);
if (optind < argc)
{
/* The name this program was run with. */
char *program_name;
-static struct option const long_options[] =
-{
- {0, 0, 0, 0}
-};
-
extern char **environ;
void
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
-
- while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
- {
- switch (c)
- {
- case 0:
- break;
-
- default:
- usage (PRINTENV_FAILURE);
- }
- }
+ if (getopt (argc, argv, "+") != -1)
+ usage (PRINTENV_FAILURE);
if (optind >= argc)
{
/* The name by which this program was run. */
char *program_name;
-static struct option const long_options[] =
-{
- {0, 0, 0, 0}
-};
-
void
usage (int status)
{
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
-
- while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
- {
- switch (c)
- {
- case 0:
- break;
-
- default:
- usage (EXIT_FAILURE);
- }
- }
+ if (getopt (argc, argv, "") != -1)
+ usage (EXIT_FAILURE);
if (argc == 1)
{
/* The number of strings to sort. */
static size_t n_strings = 0;
-
-static struct option const long_options[] =
-{
- { NULL, 0, NULL, 0}
-};
\f
void
usage (int status)
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
-
- while ((opt = getopt_long (argc, argv, "", long_options, NULL)) != -1)
- switch (opt)
- {
- case 0: /* long option */
- break;
- default:
- usage (EXIT_FAILURE);
- }
+ if (getopt (argc, argv, "") != -1)
+ usage (EXIT_FAILURE);
have_read_stdin = false;
/* The name this program was run with. */
char *program_name;
-static struct option const longopts[] =
-{
- {NULL, 0, NULL, 0}
-};
-
static void
print_uptime (size_t n, const STRUCT_UTMP *this)
{
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
-
- while ((optc = getopt_long (argc, argv, "", longopts, NULL)) != -1)
- {
- switch (optc)
- {
- case 0:
- break;
-
- default:
- usage (EXIT_FAILURE);
- }
- }
+ if (getopt (argc, argv, "") != -1)
+ usage (EXIT_FAILURE);
switch (argc - optind)
{
/* The name this program was run with. */
char *program_name;
-static struct option const longopts[] =
-{
- {NULL, 0, NULL, 0}
-};
-
static int
userid_compare (const void *v_a, const void *v_b)
{
int
main (int argc, char **argv)
{
- int optc;
initialize_main (&argc, &argv);
program_name = argv[0];
setlocale (LC_ALL, "");
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
-
- while ((optc = getopt_long (argc, argv, "", longopts, NULL)) != -1)
- {
- switch (optc)
- {
- case 0:
- break;
-
- default:
- usage (EXIT_FAILURE);
- }
- }
+ if (getopt (argc, argv, "") != -1)
+ usage (EXIT_FAILURE);
switch (argc - optind)
{
/* The name this program was run with. */
char *program_name;
-static struct option const long_options[] =
-{
- {0, 0, 0, 0}
-};
-
void
usage (int status)
{
{
register struct passwd *pw;
register uid_t uid;
- int c;
initialize_main (&argc, &argv);
program_name = argv[0];
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
-
- while ((c = getopt_long (argc, argv, "", long_options, NULL)) != -1)
- {
- switch (c)
- {
- case 0:
- break;
-
- default:
- usage (EXIT_FAILURE);
- }
- }
+ if (getopt (argc, argv, "") != -1)
+ usage (EXIT_FAILURE);
if (optind != argc)
{