From 288994697f3ae979c5d7f4d781b7ab637addcf0a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 21 Sep 2004 22:11:28 +0000 Subject: (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. --- src/pathchk.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/pathchk.c') 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); } -- cgit v1.2.3-54-g00ecf