diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-09-21 22:11:28 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-09-21 22:11:28 +0000 |
commit | 288994697f3ae979c5d7f4d781b7ab637addcf0a (patch) | |
tree | 5bca9b56a2b90d49e1d6b060af2c245c1dc51db4 /src/pathchk.c | |
parent | ca316df53ceaf37dce92fdb0c2c156534dc0fce3 (diff) | |
download | coreutils-288994697f3ae979c5d7f4d781b7ab637addcf0a.tar.xz |
(longopts): Add --help, --version.
(main): Use longopts rather than parse_long_options.
(main): Don't reorder arguments, so that we can check weird file names.
Diffstat (limited to 'src/pathchk.c')
-rw-r--r-- | src/pathchk.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/pathchk.c b/src/pathchk.c index 5692509cf..6f6f8ac29 100644 --- a/src/pathchk.c +++ b/src/pathchk.c @@ -46,7 +46,6 @@ #include "system.h" #include "error.h" #include "euidaccess.h" -#include "long-options.h" /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "pathchk" @@ -108,6 +107,8 @@ char *program_name; static struct option const longopts[] = { {"portability", no_argument, NULL, 'p'}, + {GETOPT_HELP_OPTION_DECL}, + {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} }; @@ -166,20 +167,18 @@ main (int argc, char **argv) atexit (close_stdout); - parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION, - usage, AUTHORS, (char const *) NULL); - - while ((optc = getopt_long (argc, argv, "p", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "+p", longopts, NULL)) != -1) { switch (optc) { - case 0: - break; - case 'p': check_portability = true; break; + case_GETOPT_HELP_CHAR; + + case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); + default: usage (EXIT_FAILURE); } |