No longer include long-options.h.
authorJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 14:23:59 +0000 (14:23 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 14:23:59 +0000 (14:23 +0000)
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.

src/mkdir.c
src/mknod.c
src/mv.c
src/rm.c

index e201a7e..ba2e1eb 100644 (file)
 #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);
        }
index 96bc4be..ac5be3d 100644 (file)
 #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);
        }
index b56d4d4..fe9c865 100644 (file)
--- a/src/mv.c
+++ b/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
 #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);
        }
index 1dbdfbb..2a584a6 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
 #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);
        }