]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
No longer include long-options.h.
authorJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 04:23:55 +0000 (04:23 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 26 Mar 1999 04:23:55 +0000 (04:23 +0000)
Include version-etc.h instead.
(PROGRAM_NAME): 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/ls.c

index e985a4b4c39b1505c51442f434f7fad0c4d67f7a..26e871b50bdd5879e1d7b03e4d0c2fce605b6c90 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
 #include "error.h"
 #include "human.h"
 #include "filemode.h"
-#include "long-options.h"
 #include "ls.h"
 #include "obstack.h"
 #include "path-concat.h"
 #include "quotearg.h"
 #include "strverscmp.h"
+#include "version-etc.h"
 #include "xstrtol.h"
 
+#define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
+                     : (ls_mode == LS_MULTI_COL \
+                        ? "dir" : "vdir"))
+
 #define obstack_chunk_alloc malloc
 #define obstack_chunk_free free
 
@@ -569,6 +573,8 @@ static struct option const long_options[] =
   {"time", required_argument, 0, 11},
   {"color", optional_argument, 0, 13},
   {"block-size", required_argument, 0, 17},
+  {GETOPT_HELP_OPTION_DECL},
+  {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0}
 };
 
@@ -718,13 +724,6 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
-#define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
-                     : (ls_mode == LS_MULTI_COL \
-                        ? "dir" : "vdir"))
-
-  parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
-                     "Richard Stallman and David MacKenzie", usage);
-
   exit_status = 0;
   dir_defaulted = 1;
   print_dir_name = 1;
@@ -1175,6 +1174,11 @@ decode_switches (int argc, char **argv)
          human_block_size (optarg, 1, &output_block_size);
          break;
 
+       case_GETOPT_HELP_CHAR;
+
+       case_GETOPT_VERSION_CHAR (PROGRAM_NAME,
+                                 "Richard Stallman and David MacKenzie");
+
        default:
          usage (EXIT_FAILURE);
        }