summaryrefslogtreecommitdiff
path: root/src/cp.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-03-04 05:09:05 +0000
committerJim Meyering <jim@meyering.net>1999-03-04 05:09:05 +0000
commit61fa70ac19d9202f6509e97e4bda1f4ab8f5d1fd (patch)
tree1fb89b9b511548ea40a899b6c60f1371cf6123f4 /src/cp.c
parentd0bdbe00ba72224915a61589a399bc0e86d74d80 (diff)
downloadcoreutils-61fa70ac19d9202f6509e97e4bda1f4ab8f5d1fd.tar.xz
Include long-options.h
[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.
Diffstat (limited to 'src/cp.c')
-rw-r--r--src/cp.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/cp.c b/src/cp.c
index 26c21f6d1..bdc399b8a 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -28,14 +28,15 @@
#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 ();
@@ -83,12 +84,6 @@ static enum Sparse_type const sparse_type[] =
/* 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'},
@@ -108,8 +103,6 @@ static struct option const long_opts[] =
{"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}
};
@@ -638,6 +631,10 @@ main (int argc, char **argv)
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
@@ -746,16 +743,6 @@ main (int argc, char **argv)
}
}
- 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"));