From 695cdd6f6abb7a2a8243ce7e1ad624b16a6e0032 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 26 Mar 1999 14:26:18 +0000 Subject: [PATCH] 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. --- src/dircolors.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/dircolors.c b/src/dircolors.c index f69e931cf3..bc9012465b 100644 --- a/src/dircolors.c +++ b/src/dircolors.c @@ -26,13 +26,15 @@ #include #include "system.h" -#include "getline.h" -#include "long-options.h" #include "closeout.h" +#include "dircolors.h" #include "error.h" -#include "long-options.h" +#include "getline.h" #include "obstack.h" -#include "dircolors.h" +#include "version-etc.h" + +/* The official name of this program (e.g., no `g' prefix). */ +#define PROGRAM_NAME "dircolors" #define obstack_chunk_alloc malloc #define obstack_chunk_free free @@ -84,6 +86,8 @@ static struct option const long_options[] = {"csh", no_argument, NULL, 'c'}, {"c-shell", no_argument, NULL, 'c'}, {"print-database", no_argument, NULL, 'p'}, + {GETOPT_HELP_OPTION_DECL}, + {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} }; @@ -427,9 +431,6 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - parse_long_options (argc, argv, "dircolors", GNU_PACKAGE, VERSION, - "H. Peter Anvin", usage); - while ((optc = getopt_long (argc, argv, "bcp", long_options, NULL)) != -1) switch (optc) { @@ -445,6 +446,10 @@ main (int argc, char **argv) print_database = 1; break; + case_GETOPT_HELP_CHAR; + + case_GETOPT_VERSION_CHAR (PROGRAM_NAME, "H. Peter Anvin"); + default: usage (1); } -- 2.47.3