No longer include long-options.h.
authorJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 14:25:30 +0000 (14:25 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 14:25:30 +0000 (14:25 +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/rmdir.c
src/shred.c
src/touch.c

index 81e437e..54605ee 100644 (file)
 #include "system.h"
 #include "closeout.h"
 #include "error.h"
-#include "long-options.h"
+#include "version-etc.h"
+
+/* The official name of this program (e.g., no `g' prefix).  */
+#define PROGRAM_NAME "rmdir"
+
+#define AUTHORS "David MacKenzie"
 
 #ifndef EEXIST
 # define EEXIST 0
@@ -64,6 +69,8 @@ static struct option const longopts[] =
   {"path", no_argument, NULL, 'p'},
   {"parents", no_argument, NULL, 'p'},
   {"verbose", no_argument, NULL, 14},
+  {GETOPT_HELP_OPTION_DECL},
+  {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
 };
 
@@ -145,9 +152,6 @@ main (int argc, char **argv)
   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)
@@ -165,6 +169,8 @@ main (int argc, char **argv)
        case 14:
          verbose = 1;
          break;
+       case_GETOPT_HELP_CHAR;
+       case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
        default:
          usage (1);
        }
index 6746286..7489255 100644 (file)
 #include "system.h"
 #include "closeout.h"
 #include "error.h"
-#include "long-options.h"
 #include "xstrtoul.h"
+#include "version-etc.h"
+
+/* The official name of this program (e.g., no `g' prefix).  */
+#define PROGRAM_NAME "shred"
+
+#define AUTHORS "Colin Plumb"
 
 #define DEFAULT_PASSES 25      /* Default */
 
@@ -94,6 +99,8 @@ static struct option const long_opts[] =
   {"preserve", no_argument, NULL, 'p'},
   {"verbose", no_argument, NULL, 'v'},
   {"zero", required_argument, NULL, 'z'},
+  {GETOPT_HELP_OPTION_DECL},
+  {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
 };
 
@@ -1283,9 +1290,6 @@ main (int argc, char **argv)
   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);
@@ -1338,6 +1342,10 @@ main (int argc, char **argv)
          flags.zero_fill = 1;
          break;
 
+       case_GETOPT_HELP_CHAR;
+
+       case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
        default:
          usage (1);
        }
index b8435ce..eda5f3e 100644 (file)
 #include "closeout.h"
 #include "error.h"
 #include "getdate.h"
-#include "long-options.h"
 #include "posixtm.h"
 #include "safe-read.h"
+#include "version-etc.h"
+
+/* The official name of this program (e.g., no `g' prefix).  */
+#define PROGRAM_NAME "touch"
+
+#define AUTHORS \
+  "Paul Rubin, Arnold Robbins, Jim Kingdon, David MacKenzie, and Randy Smith"
 
 #ifndef STDC_HEADERS
 time_t time ();
@@ -81,6 +87,8 @@ static struct option const longopts[] =
   {"date", required_argument, 0, 'd'},
   {"file", required_argument, 0, 'r'},
   {"reference", required_argument, 0, 'r'},
+  {GETOPT_HELP_OPTION_DECL},
+  {GETOPT_VERSION_OPTION_DECL},
   {0, 0, 0, 0}
 };
 
@@ -230,10 +238,6 @@ main (int argc, char **argv)
   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;
 
@@ -286,6 +290,10 @@ main (int argc, char **argv)
                                     time_args, time_masks);
          break;
 
+       case_GETOPT_HELP_CHAR;
+
+       case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
        default:
          usage (1);
        }