]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
No longer include long-options.h.
authorJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 14:22:51 +0000 (14:22 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 14:22:51 +0000 (14:22 +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/du.c
src/install.c
src/ln.c
src/mkfifo.c

index dfa4bd5a648bfccb321af35b51cbd65f8f0978c9..526f9b08d3090abe2865f7fd12497c31f6472a87 100644 (file)
--- a/src/du.c
+++ b/src/du.c
 #include "error.h"
 #include "exclude.h"
 #include "human.h"
-#include "long-options.h"
 #include "save-cwd.h"
 #include "savedir.h"
+#include "version-etc.h"
 #include "xstrtol.h"
 
+/* The official name of this program (e.g., no `g' prefix).  */
+#define PROGRAM_NAME "du"
+
+#define AUTHORS \
+  "Torbjorn Granlund, David MacKenzie, Larry McVoy, and Paul Eggert"
+
 /* Initial number of entries in each hash table entry's table of inodes.  */
 #define INITIAL_HASH_MODULE 100
 
@@ -189,6 +195,8 @@ static struct option const long_options[] =
   {"separate-dirs", no_argument, NULL, 'S'},
   {"summarize", no_argument, NULL, 's'},
   {"total", no_argument, NULL, 'c'},
+  {GETOPT_HELP_OPTION_DECL},
+  {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
 };
 
@@ -251,10 +259,6 @@ main (int argc, char **argv)
   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;
 
@@ -343,6 +347,10 @@ main (int argc, char **argv)
          human_block_size (optarg, 1, &output_block_size);
          break;
 
+       case_GETOPT_HELP_CHAR;
+
+       case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
        default:
          usage (1);
        }
index 71de8e41b9b6010afbf24c4b967d672706bb52a7..140a9d966a1ae1232b566d7fcf51b5cfb5c9e58e 100644 (file)
 #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 "version-etc.h"
 #include "xstrtol.h"
 
+/* The official name of this program (e.g., no `g' prefix).  */
+#define PROGRAM_NAME "install"
+
+#define AUTHORS "David MacKenzie"
+
 #if HAVE_SYS_WAIT_H
 # include <sys/wait.h>
 #endif
@@ -178,6 +183,8 @@ static struct option const long_options[] =
   {"suffix", required_argument, NULL, 'S'},
   {"version-control", required_argument, NULL, 'V'},
   {"verbose", no_argument, NULL, 'v'},
+  {GETOPT_HELP_OPTION_DECL},
+  {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
 };
 
@@ -235,9 +242,6 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  parse_long_options (argc, argv, "install", GNU_PACKAGE, VERSION,
-                     "David MacKenzie", usage);
-
   cp_option_init (&x);
 
   owner_name = NULL;
@@ -295,6 +299,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 9f3fd8e8fb84ff03add258cead4de399fdfcf786..57f4b315237fe1fdd3e2fa40737c4ef0f01adf74 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
 #include "closeout.h"
 #include "dirname.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 "ln"
+
+#define AUTHORS "Mike Parker and David MacKenzie"
 
 int link ();                   /* Some systems don't declare this anywhere. */
 
@@ -109,6 +114,8 @@ static struct option const long_options[] =
   {"symbolic", no_argument, NULL, 's'},
   {"verbose", no_argument, NULL, 'v'},
   {"version-control", required_argument, NULL, 'V'},
+  {GETOPT_HELP_OPTION_DECL},
+  {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
 };
 
@@ -379,9 +386,6 @@ main (int argc, char **argv)
   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");
@@ -434,6 +438,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);
          break;
index 09c05e37231c2dc63c72fa247de6639af8a1c4b2..f933e7750852a2b7368154edcc410e92a3224ee6 100644 (file)
 #include "system.h"
 #include "closeout.h"
 #include "error.h"
-#include "long-options.h"
 #include "modechange.h"
+#include "version-etc.h"
+
+/* The official name of this program (e.g., no `g' prefix).  */
+#define PROGRAM_NAME "mkfifo"
+
+#define AUTHORS "David MacKenzie"
 
 /* The name this program was run with. */
 char *program_name;
@@ -39,6 +44,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}
 };
 
@@ -80,9 +87,6 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-  parse_long_options (argc, argv, "mkfifo", GNU_PACKAGE, VERSION,
-                     "David MacKenzie", usage);
-
   symbolic_mode = NULL;
 
 #ifndef S_ISFIFO
@@ -97,6 +101,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);
        }