[long_options]: Remove the "help" and "version" entries.
(main): Use parse_long_options, including author name(s).
Remove the show_version and show_help blocks.
#include <getopt.h>
#include "system.h"
-#include "xstrtoul.h"
#include "closeout.h"
#include "error.h"
-#include "savedir.h"
#include "group-member.h"
+#include "long-options.h"
+#include "savedir.h"
+#include "xstrtoul.h"
/* MAXUID may come from limits.h *or* sys/params.h (via system.h) above. */
#ifndef MAXUID
This file must exist. */
static char *reference_file;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"quiet", no_argument, 0, 'f'},
{"reference", required_argument, 0, CHAR_MAX + 1},
{"verbose", no_argument, 0, 'v'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "chgrp", GNU_PACKAGE, VERSION,
+ "David MacKenzie", usage);
+
recurse = force_silent = 0;
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1)
}
}
- if (show_version)
- {
- printf ("chgrp (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (argc - optind + (reference_file ? 1 : 0) <= 1)
{
error (0, 0, _("too few arguments"));
#include <getopt.h>
#include <sys/types.h>
-#include "modechange.h"
#include "system.h"
#include "closeout.h"
#include "error.h"
-#include "savedir.h"
#include "filemode.h"
+#include "long-options.h"
+#include "modechange.h"
+#include "savedir.h"
enum Change_status
{
of this file. This file must exist. */
static char *reference_file;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"quiet", no_argument, 0, 'f'},
{"reference", required_argument, 0, CHAR_MAX + 1},
{"verbose", no_argument, 0, 'v'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "chmod", GNU_PACKAGE, VERSION,
+ "David MacKenzie", usage);
+
recurse = force_silent = 0;
while (1)
}
}
- if (show_version)
- {
- printf ("chmod (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (modeind == 0 && reference_file == NULL)
modeind = optind++;
#include "system.h"
#include "closeout.h"
#include "error.h"
-#include "savedir.h"
+#include "long-options.h"
#include "lchown.h"
+#include "savedir.h"
#ifndef _POSIX_VERSION
struct passwd *getpwnam ();
of this file. This file must exist. */
static char *reference_file;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_options[] =
{
{"recursive", no_argument, 0, 'R'},
{"silent", no_argument, 0, 'f'},
{"reference", required_argument, 0, CHAR_MAX + 1},
{"verbose", no_argument, 0, 'v'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "chown", GNU_PACKAGE, VERSION,
+ "David MacKenzie", usage);
+
recurse = force_silent = 0;
while ((optc = getopt_long (argc, argv, "Rcfhv", long_options, NULL)) != -1)
}
}
- if (show_version)
- {
- printf ("chown (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (argc - optind + (reference_file ? 1 : 0) <= 1)
{
error (0, 0, _("too few arguments"));
#include <getopt.h>
#include "system.h"
-#include "backupfile.h"
#include "argmatch.h"
-#include "path-concat.h"
+#include "backupfile.h"
#include "closeout.h"
-#include "cp-hash.h"
#include "copy.h"
+#include "cp-hash.h"
#include "error.h"
#include "dirname.h"
+#include "long-options.h"
+#include "path-concat.h"
#ifndef _POSIX_VERSION
uid_t geteuid ();
/* The error code to return to the system. */
static int exit_status = 0;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_opts[] =
{
{"archive", no_argument, NULL, 'a'},
{"update", no_argument, NULL, 'u'},
{"verbose", no_argument, NULL, 'v'},
{"version-control", required_argument, NULL, 'V'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "cp", GNU_PACKAGE, VERSION,
+ "Torbjorn Granlund, David MacKenzie, and Jim Meyering",
+ usage);
+
cp_option_init (&x);
/* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
}
}
- if (show_version)
- {
- printf ("cp (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (x.hard_link && x.symbolic_link)
{
error (0, 0, _("cannot make both hard and symbolic links"));
#include <signal.h>
#include <getopt.h>
-#include "human.h"
#include "system.h"
#include "closeout.h"
#include "error.h"
+#include "human.h"
+#include "long-options.h"
#include "safe-read.h"
#ifndef SIGINFO
070, 071, 0372, 0373, 0374, 0375, 0376, 0377
};
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_options[] =
{
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "dd", GNU_PACKAGE, VERSION,
+ "Paul Rubin, David MacKenzie, and Stuart Kemp", usage);
+
/* Initialize translation table to identity translation. */
for (i = 0; i < 256; i++)
trans_table[i] = i;
/* Decode arguments. */
scanargs (argc, argv);
- if (show_version)
- {
- printf ("dd (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
apply_translations ();
if (input_file != NULL)
#include <getopt.h>
#include <assert.h>
-#include "mountlist.h"
-#include "fsusage.h"
#include "system.h"
-#include "save-cwd.h"
#include "closeout.h"
+#include "dirname.h"
#include "error.h"
+#include "fsusage.h"
#include "human.h"
-#include "dirname.h"
+#include "long-options.h"
+#include "mountlist.h"
+#include "save-cwd.h"
void strip_trailing_slashes ();
char *xstrdup ();
/* Linked list of mounted filesystems. */
static struct mount_entry *mount_list;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
/* If nonzero, print filesystem type as well. */
static int print_type;
{"no-sync", no_argument, NULL, CHAR_MAX + 2},
{"type", required_argument, NULL, 't'},
{"exclude-type", required_argument, NULL, 'x'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "df", GNU_PACKAGE, VERSION,
+ "Torbjorn Granlund, David MacKenzie, Larry McVoy, and Paul Eggert",
+ usage);
+
fs_select_list = NULL;
fs_exclude_list = NULL;
inode_format = 0;
}
}
- if (show_version)
- {
- printf ("df (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
/* Fail if the same file system type was both selected and excluded. */
{
int match = 0;
#include "long-options.h"
#include "closeout.h"
#include "error.h"
+#include "long-options.h"
#include "obstack.h"
#include "dircolors.h"
{"sh", no_argument, NULL, 'b'},
{"csh", no_argument, NULL, 'c'},
{"c-shell", no_argument, NULL, 'c'},
- {"help", no_argument, NULL, 'h'},
{"print-database", no_argument, NULL, 'p'},
- {"version", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, "dircolors", GNU_PACKAGE, VERSION, usage);
+ parse_long_options (argc, argv, "dircolors", GNU_PACKAGE, VERSION,
+ "H. Peter Anvin", usage);
while ((optc = getopt_long (argc, argv, "bcp", long_options, NULL)) != -1)
switch (optc)
#include <sys/types.h>
#include <assert.h>
-#include "exclude.h"
#include "system.h"
-#include "save-cwd.h"
#include "closeout.h"
#include "error.h"
+#include "exclude.h"
#include "human.h"
-#include "xstrtol.h"
+#include "long-options.h"
+#include "save-cwd.h"
#include "savedir.h"
+#include "xstrtol.h"
/* Initial number of entries in each hash table entry's table of inodes. */
#define INITIAL_HASH_MODULE 100
/* The exit status to use if we don't get any fatal errors. */
static int exit_status;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
/* File name patterns to exclude. */
static struct exclude *exclude;
{"separate-dirs", no_argument, NULL, 'S'},
{"summarize", no_argument, NULL, 's'},
{"total", no_argument, NULL, 'c'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
void
-usage (int status, char *reason)
+usage (int status)
{
- if (reason != NULL)
- fprintf (status == 0 ? stdout : stderr, "%s: %s\n",
- program_name, reason);
-
if (status != 0)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "du", GNU_PACKAGE, VERSION,
+ "Torbjorn Granlund, David MacKenzie, Larry McVoy, and Paul Eggert",
+ usage);
+
exclude = new_exclude ();
xstat = lstat;
break;
default:
- usage (1, (char *) 0);
+ usage (1);
}
}
- if (show_version)
+ if (opt_all && opt_summarize_only)
{
- printf ("du (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
+ error (0, 0, _("cannot both summarize and show all entries"));
+ usage (1);
}
- if (show_help)
- usage (0, NULL);
-
- if (opt_all && opt_summarize_only)
- usage (1, _("cannot both summarize and show all entries"));
-
if (opt_summarize_only && max_depth_specified && max_depth == 0)
{
error (0, 0,
error (0, 0,
_("warning: summarizing conflicts with --max-depth=%d"),
max_depth);
- usage (1, NULL);
+ usage (1);
}
if (opt_summarize_only)
#include "system.h"
#include "backupfile.h"
-#include "modechange.h"
-#include "makepath.h"
#include "closeout.h"
#include "error.h"
-#include "xstrtol.h"
-#include "path-concat.h"
#include "cp-hash.h"
#include "copy.h"
#include "dirname.h"
+#include "long-options.h"
+#include "makepath.h"
+#include "modechange.h"
+#include "path-concat.h"
+#include "xstrtol.h"
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
/* If nonzero, install a directory instead of a regular file. */
static int dir_arg;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_options[] =
{
{"strip", no_argument, NULL, 's'},
{"suffix", required_argument, NULL, 'S'},
{"version-control", required_argument, NULL, 'V'},
{"verbose", no_argument, NULL, 'v'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "install", GNU_PACKAGE, VERSION,
+ "David MacKenzie", usage);
+
cp_option_init (&x);
owner_name = NULL;
}
}
- if (show_version)
- {
- printf ("install (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
/* Check for invalid combinations of arguments. */
if (dir_arg && strip_files)
error (1, 0,
#include "system.h"
#include "backupfile.h"
#include "closeout.h"
-#include "error.h"
#include "dirname.h"
+#include "error.h"
+#include "long-options.h"
int link (); /* Some systems don't declare this anywhere. */
symlink-to-dir before creating the new link. */
static int dereference_dest_dir_symlinks = 1;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_options[] =
{
{"backup", no_argument, NULL, 'b'},
{"symbolic", no_argument, NULL, 's'},
{"verbose", no_argument, NULL, 'v'},
{"version-control", required_argument, NULL, 'V'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "ln", GNU_PACKAGE, VERSION,
+ "Mike Parker and David MacKenzie", usage);
+
/* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
we'll actually use simple_backup_suffix. */
version = getenv ("SIMPLE_BACKUP_SUFFIX");
}
}
- if (show_version)
- {
- printf ("ln (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (optind == argc)
{
error (0, 0, _("missing file argument"));
#include "system.h"
#include <fnmatch.h>
-#include "obstack.h"
-#include "ls.h"
+#include "argmatch.h"
#include "closeout.h"
#include "error.h"
#include "human.h"
-#include "argmatch.h"
-#include "xstrtol.h"
-#include "strverscmp.h"
-#include "quotearg.h"
#include "filemode.h"
+#include "long-options.h"
+#include "ls.h"
+#include "obstack.h"
#include "path-concat.h"
+#include "quotearg.h"
+#include "strverscmp.h"
+#include "xstrtol.h"
#define obstack_chunk_alloc malloc
#define obstack_chunk_free free
static int exit_status;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_options[] =
{
{"all", no_argument, 0, 'a'},
{"sort", required_argument, 0, 10},
{"tabsize", required_argument, 0, 'T'},
{"time", required_argument, 0, 11},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{"color", optional_argument, 0, 13},
{"block-size", required_argument, 0, 17},
{NULL, 0, NULL, 0}
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+#define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
+ : (ls_mode == LS_MULTI_COL \
+ ? "dir" : "vdir"))
+
+ parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
+ "Richard Stallman and David MacKenzie", usage);
+
exit_status = 0;
dir_defaulted = 1;
print_dir_name = 1;
i = decode_switches (argc, argv);
- if (show_version)
- {
- printf ("%s (%s) %s\n",
- (ls_mode == LS_LS ? "ls"
- : (ls_mode == LS_MULTI_COL ? "dir" : "vdir")),
- GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (EXIT_SUCCESS);
- }
-
- if (show_help)
- usage (EXIT_SUCCESS);
-
if (print_with_color)
{
parse_ls_color ();
#include <sys/types.h>
#include "system.h"
-#include "modechange.h"
-#include "makepath.h"
#include "closeout.h"
#include "error.h"
+#include "long-options.h"
+#include "makepath.h"
+#include "modechange.h"
/* The name this program was run with. */
char *program_name;
/* If nonzero, ensure that all parents of the specified directory exist. */
static int path_mode;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
{"parents", no_argument, NULL, 'p'},
- {"help", no_argument, &show_help, 1},
{"verbose", no_argument, NULL, 2},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "mkdir", GNU_PACKAGE, VERSION,
+ "David MacKenzie", usage);
+
path_mode = 0;
while ((optc = getopt_long (argc, argv, "pm:", longopts, NULL)) != -1)
}
}
- if (show_version)
- {
- printf ("mkdir (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (optind == argc)
{
error (0, 0, _("too few arguments"));
#include <sys/types.h>
#include "system.h"
-#include "modechange.h"
#include "closeout.h"
#include "error.h"
+#include "long-options.h"
+#include "modechange.h"
/* The name this program was run with. */
char *program_name;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "mkfifo", GNU_PACKAGE, VERSION,
+ "David MacKenzie", usage);
+
symbolic_mode = NULL;
#ifndef S_ISFIFO
}
}
- if (show_version)
- {
- printf ("mkfifo (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (optind == argc)
{
error (0, 0, _("too few arguments"));
#include <sys/types.h>
#include "system.h"
-#include "modechange.h"
#include "closeout.h"
#include "error.h"
+#include "long-options.h"
+#include "modechange.h"
#include "xstrtol.h"
/* The name this program was run with. */
char *program_name;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "mknod", GNU_PACKAGE, VERSION,
+ "David MacKenzie", usage);
+
symbolic_mode = NULL;
while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
}
}
- if (show_version)
- {
- printf ("mknod (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
newmode = 0666 & ~umask (0);
if (symbolic_mode)
{
#include <assert.h>
#include "system.h"
-#include "path-concat.h"
#include "backupfile.h"
#include "closeout.h"
-#include "cp-hash.h"
#include "copy.h"
-#include "remove.h"
+#include "cp-hash.h"
#include "error.h"
+#include "long-options.h"
+#include "path-concat.h"
+#include "remove.h"
/* Initial number of entries in each hash table entry's table of inodes. */
#define INITIAL_HASH_MODULE 100
/* If nonzero, stdin is a tty. */
static int stdin_tty;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_options[] =
{
{"backup", no_argument, NULL, 'b'},
{"update", no_argument, NULL, 'u'},
{"verbose", no_argument, NULL, 'v'},
{"version-control", required_argument, NULL, 'V'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "mv", GNU_PACKAGE, VERSION,
+ "Mike Parker, David MacKenzie, and Jim Meyering", usage);
+
cp_option_init (&x);
/* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
}
}
- if (show_version)
- {
- printf ("mv (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (argc < optind + 2)
{
error (0, 0, "%s", (argc == optind
#include <sys/types.h>
#include <assert.h>
-#include "save-cwd.h"
#include "system.h"
#include "closeout.h"
#include "error.h"
+#include "long-options.h"
#include "remove.h"
+#include "save-cwd.h"
void strip_trailing_slashes ();
/* Name this program was run with. */
char *program_name;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_opts[] =
{
{"directory", no_argument, NULL, 'd'},
{"interactive", no_argument, NULL, 'i'},
{"recursive", no_argument, NULL, 'r'},
{"verbose", no_argument, NULL, 'v'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "rm", GNU_PACKAGE, VERSION,
+ "Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering",
+ usage);
+
rm_option_init (&x);
while ((c = getopt_long (argc, argv, "dfirvR", long_opts, NULL)) != -1)
}
}
- if (show_version)
- {
- printf ("rm (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (optind == argc)
{
if (x.ignore_missing_files)
#include "system.h"
#include "closeout.h"
#include "error.h"
+#include "long-options.h"
#ifndef EEXIST
# define EEXIST 0
/* If nonzero, output a diagnostic for every directory processed. */
static int verbose;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const longopts[] =
{
/* Don't name this `--force' because it's not close enough in meaning
{"path", no_argument, NULL, 'p'},
{"parents", no_argument, NULL, 'p'},
{"verbose", no_argument, NULL, 14},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "rmdir", GNU_PACKAGE, VERSION,
+ "David MacKenzie", usage);
+
empty_paths = 0;
while ((optc = getopt_long (argc, argv, "p", longopts, NULL)) != -1)
}
}
- if (show_version)
- {
- printf ("rmdir (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (optind == argc)
{
error (0, 0, _("too few arguments"));
#include <stdarg.h> /* Used by pferror */
#include "system.h"
-#include "xstrtoul.h"
#include "closeout.h"
#include "error.h"
+#include "long-options.h"
+#include "xstrtoul.h"
#define DEFAULT_PASSES 25 /* Default */
int zero_fill;
};
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const long_opts[] =
{
{"device", no_argument, NULL, 'd'},
{"preserve", no_argument, NULL, 'p'},
{"verbose", no_argument, NULL, 'v'},
{"zero", required_argument, NULL, 'z'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "shred", GNU_PACKAGE, VERSION,
+ "Colin Plumb", usage);
+
isaac_seed (&s);
memset (&flags, 0, sizeof flags);
}
}
- if (show_version)
- {
- printf ("shred (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
file = argv + optind;
n_files = argc - optind;
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- parse_long_options (argc, argv, "sync", GNU_PACKAGE, VERSION, usage);
+ parse_long_options (argc, argv, "sync", GNU_PACKAGE, VERSION,
+ "Jim Meyering", usage);
if (argc != 1)
error (0, 0, _("ignoring all arguments"));
#include <sys/types.h>
#include "system.h"
+#include "argmatch.h"
#include "closeout.h"
#include "error.h"
-#include "argmatch.h"
#include "getdate.h"
-#include "safe-read.h"
+#include "long-options.h"
#include "posixtm.h"
+#include "safe-read.h"
#ifndef STDC_HEADERS
time_t time ();
/* Info about the reference file. */
static struct stat ref_stats;
-/* If nonzero, display usage information and exit. */
-static int show_help;
-
-/* If nonzero, print the version on standard output and exit. */
-static int show_version;
-
static struct option const longopts[] =
{
{"time", required_argument, 0, CHAR_MAX + 1},
{"date", required_argument, 0, 'd'},
{"file", required_argument, 0, 'r'},
{"reference", required_argument, 0, 'r'},
- {"help", no_argument, &show_help, 1},
- {"version", no_argument, &show_version, 1},
{0, 0, 0, 0}
};
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ parse_long_options (argc, argv, "touch", GNU_PACKAGE, VERSION,
+ "Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith",
+ usage);
+
change_times = no_create = use_ref = posix_date = flexible_date = 0;
newtime = (time_t) -1;
}
}
- if (show_version)
- {
- printf ("touch (%s) %s\n", GNU_PACKAGE, VERSION);
- close_stdout ();
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
if (change_times == 0)
change_times = CH_ATIME | CH_MTIME;