From: Jim Meyering Date: Sat, 10 May 2003 14:54:23 +0000 (+0000) Subject: (main): Set program_name before first use. X-Git-Tag: v5.0.1~542 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ddc5610b887020e33838ed0d7ef54a952684e4e9;p=thirdparty%2Fcoreutils.git (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. --- diff --git a/src/readlink.c b/src/readlink.c index 96e5a0aeae..0f34bebb80 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; }