From 4fa016cbc9907ef9da5272c5dcfa76f8ade216f1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 21 Sep 2004 22:01:50 +0000 Subject: Include . (main): Reject unknown options. --- src/pwd.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/pwd.c') diff --git a/src/pwd.c b/src/pwd.c index 6c64be740..4bac5bb10 100644 --- a/src/pwd.c +++ b/src/pwd.c @@ -16,6 +16,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include +#include #include #include @@ -305,16 +306,10 @@ main (int argc, char **argv) parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION, usage, AUTHORS, (char const *) NULL); + if (getopt (argc, argv, "") != -1) + usage (EXIT_FAILURE); - /* The above handles --help and --version. - Since there is no other invocation of getopt, handle `--' here. */ - if (1 < argc && STREQ (argv[1], "--")) - { - --argc; - ++argv; - } - - if (1 < argc) + if (optind < argc) error (0, 0, _("ignoring non-option arguments")); wd = xgetcwd (); -- cgit v1.2.3-54-g00ecf