diff options
author | Jim Meyering <jim@meyering.net> | 2003-05-10 14:54:23 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-05-10 14:54:23 +0000 |
commit | ddc5610b887020e33838ed0d7ef54a952684e4e9 (patch) | |
tree | b2b4dd540697dcf64f1417b7a010a2eedaf033fb | |
parent | ea67851e7e41fbe9f0533aeb89eb498c7e713ed0 (diff) | |
download | coreutils-ddc5610b887020e33838ed0d7ef54a952684e4e9.tar.xz |
(main): Set program_name before first use.
Remove that (redundant) first use.
Don't exit successfully just because --verbose was specified.
Pass 0, not EXIT_SUCCESS, as first argument to error; when that
parameter is 0, error does not exit.
-rw-r--r-- | src/readlink.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/readlink.c b/src/readlink.c index 96e5a0aea..0f34bebb8 100644 --- a/src/readlink.c +++ b/src/readlink.c @@ -91,17 +91,13 @@ main (int argc, char *const argv[]) char *value; int optc; + program_name = argv[0]; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); atexit (close_stdout); - if (argc < 1) - error (EXIT_FAILURE, 0, _("too few arguments")); - - program_name = argv[0]; - while ((optc = getopt_long (argc, argv, "fnqsv", longopts, NULL)) != -1) { switch (optc) @@ -130,7 +126,7 @@ main (int argc, char *const argv[]) if (optind >= argc) { - error (EXIT_SUCCESS, 0, _("too few arguments")); + error (0, 0, _("too few arguments")); usage (EXIT_FAILURE); } @@ -138,7 +134,7 @@ main (int argc, char *const argv[]) if (optind < argc) { - error (EXIT_SUCCESS, 0, _("too many arguments")); + error (0, 0, _("too many arguments")); usage (EXIT_FAILURE); } @@ -151,7 +147,7 @@ main (int argc, char *const argv[]) } if (verbose) - error (EXIT_SUCCESS, errno, "%s", fname); + error (EXIT_FAILURE, errno, "%s", fname); return EXIT_FAILURE; } |