mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-05-19 08:51:19 +02:00
No longer include long-options.h.
Include version-etc.h instead. (PROGRAM_NAME, AUTHORS): Define. [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:
14
src/mkdir.c
14
src/mkdir.c
@@ -25,9 +25,14 @@
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "long-options.h"
|
||||
#include "makepath.h"
|
||||
#include "modechange.h"
|
||||
#include "version-etc.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "mkdir"
|
||||
|
||||
#define AUTHORS "David MacKenzie"
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
@@ -40,6 +45,8 @@ static struct option const longopts[] =
|
||||
{"mode", required_argument, NULL, 'm'},
|
||||
{"parents", no_argument, NULL, 'p'},
|
||||
{"verbose", no_argument, NULL, 2},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -82,9 +89,6 @@ main (int argc, char **argv)
|
||||
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)
|
||||
@@ -102,6 +106,8 @@ main (int argc, char **argv)
|
||||
case 2: /* --verbose */
|
||||
verbose_fmt_string = _("created directory `%s'");
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
default:
|
||||
usage (1);
|
||||
}
|
||||
|
||||
14
src/mknod.c
14
src/mknod.c
@@ -35,9 +35,14 @@
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "long-options.h"
|
||||
#include "modechange.h"
|
||||
#include "xstrtol.h"
|
||||
#include "version-etc.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "mknod"
|
||||
|
||||
#define AUTHORS "David MacKenzie"
|
||||
|
||||
/* The name this program was run with. */
|
||||
char *program_name;
|
||||
@@ -45,6 +50,8 @@ char *program_name;
|
||||
static struct option const longopts[] =
|
||||
{
|
||||
{"mode", required_argument, NULL, 'm'},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -92,9 +99,6 @@ main (int argc, char **argv)
|
||||
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)
|
||||
@@ -106,6 +110,8 @@ main (int argc, char **argv)
|
||||
case 'm':
|
||||
symbolic_mode = optarg;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
default:
|
||||
usage (1);
|
||||
}
|
||||
|
||||
16
src/mv.c
16
src/mv.c
@@ -35,7 +35,7 @@
|
||||
-V, --version-control
|
||||
Backup file creation.
|
||||
|
||||
Written by Mike Parker and David MacKenzie */
|
||||
Written by Mike Parker, David MacKenzie, and Jim Meyering */
|
||||
|
||||
#ifdef _AIX
|
||||
#pragma alloca
|
||||
@@ -53,9 +53,14 @@
|
||||
#include "copy.h"
|
||||
#include "cp-hash.h"
|
||||
#include "error.h"
|
||||
#include "long-options.h"
|
||||
#include "path-concat.h"
|
||||
#include "remove.h"
|
||||
#include "version-etc.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "mv"
|
||||
|
||||
#define AUTHORS "Mike Parker, David MacKenzie, and Jim Meyering"
|
||||
|
||||
/* Initial number of entries in each hash table entry's table of inodes. */
|
||||
#define INITIAL_HASH_MODULE 100
|
||||
@@ -84,6 +89,8 @@ static struct option const long_options[] =
|
||||
{"update", no_argument, NULL, 'u'},
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
{"version-control", required_argument, NULL, 'V'},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -368,9 +375,6 @@ main (int argc, char **argv)
|
||||
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
|
||||
@@ -411,6 +415,8 @@ main (int argc, char **argv)
|
||||
case 'V':
|
||||
version = optarg;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
default:
|
||||
usage (1);
|
||||
}
|
||||
|
||||
16
src/rm.c
16
src/rm.c
@@ -52,9 +52,15 @@
|
||||
#include "system.h"
|
||||
#include "closeout.h"
|
||||
#include "error.h"
|
||||
#include "long-options.h"
|
||||
#include "remove.h"
|
||||
#include "save-cwd.h"
|
||||
#include "version-etc.h"
|
||||
|
||||
/* The official name of this program (e.g., no `g' prefix). */
|
||||
#define PROGRAM_NAME "rm"
|
||||
|
||||
#define AUTHORS \
|
||||
"Paul Rubin, David MacKenzie, Richard Stallman, and Jim Meyering"
|
||||
|
||||
void strip_trailing_slashes ();
|
||||
|
||||
@@ -68,6 +74,8 @@ static struct option const long_opts[] =
|
||||
{"interactive", no_argument, NULL, 'i'},
|
||||
{"recursive", no_argument, NULL, 'r'},
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -120,10 +128,6 @@ main (int argc, char **argv)
|
||||
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)
|
||||
@@ -150,6 +154,8 @@ main (int argc, char **argv)
|
||||
case 'v':
|
||||
x.verbose = 1;
|
||||
break;
|
||||
case_GETOPT_HELP_CHAR;
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
|
||||
default:
|
||||
usage (1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user