diff options
author | Jim Meyering <jim@meyering.net> | 1999-03-04 05:36:10 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-03-04 05:36:10 +0000 |
commit | 88cbad981787d34f3dc8118bde16416c12a50421 (patch) | |
tree | 1a8993c9e22726767a534efd76dd619bfc80752d /src/sum.c | |
parent | 0ae96f236175101ddc6c8f0eaf46d08f88173486 (diff) | |
download | coreutils-88cbad981787d34f3dc8118bde16416c12a50421.tar.xz |
Include long-options.h
[long_options]: Remove the "help" and "version" entries.
Remove declarations of show_help and show_version.
(main): Use parse_long_options, including author name(s).
Remove the show_version and show_help blocks.
Diffstat (limited to 'src/sum.c')
-rw-r--r-- | src/sum.c | 21 |
1 files changed, 4 insertions, 17 deletions
@@ -26,6 +26,7 @@ #include <getopt.h> #include "system.h" #include "error.h" +#include "long-options.h" #include "safe-read.h" /* The name this program was run with. */ @@ -37,17 +38,9 @@ static int have_read_stdin; /* Right-rotate 32-bit integer variable C. */ #define ROTATE_RIGHT(c) if ((c) & 01) (c) = ((c) >>1) + 0x8000; else (c) >>= 1; -/* If nonzero, display usage information and exit. */ -static int show_help; - -/* If nonzero, print the version on standard output then exit. */ -static int show_version; - static struct option const longopts[] = { {"sysv", no_argument, NULL, 's'}, - {"help", no_argument, &show_help, 1}, - {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -216,6 +209,9 @@ main (int argc, char **argv) have_read_stdin = 0; + parse_long_options (argc, argv, "sum", GNU_PACKAGE, VERSION, + "Kayvan Aghaiepour and David MacKenzie", usage); + while ((optc = getopt_long (argc, argv, "rs", longopts, NULL)) != -1) { switch (optc) @@ -236,15 +232,6 @@ main (int argc, char **argv) } } - if (show_version) - { - printf ("sum (%s) %s\n", GNU_PACKAGE, VERSION); - exit (EXIT_SUCCESS); - } - - if (show_help) - usage (0); - files_given = argc - optind; if (files_given == 0) { |