diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-09-21 22:01:50 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-09-21 22:01:50 +0000 |
commit | 4fa016cbc9907ef9da5272c5dcfa76f8ade216f1 (patch) | |
tree | 04e1e2f72b4a504957d92701df36c278df2f8a13 /src/pwd.c | |
parent | 0d219ee57d8cab4a78432c97754e22dd9248951e (diff) | |
download | coreutils-4fa016cbc9907ef9da5272c5dcfa76f8ade216f1.tar.xz |
Include <getopt.h>.
(main): Reject unknown options.
Diffstat (limited to 'src/pwd.c')
-rw-r--r-- | src/pwd.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -16,6 +16,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <config.h> +#include <getopt.h> #include <stdio.h> #include <sys/types.h> @@ -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 (); |