From ddc5610b887020e33838ed0d7ef54a952684e4e9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 10 May 2003 14:54:23 +0000 Subject: (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. --- src/readlink.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3-70-g09d2