]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Set program_name before first use.
authorJim Meyering <jim@meyering.net>
Sat, 10 May 2003 14:54:23 +0000 (14:54 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 10 May 2003 14:54:23 +0000 (14:54 +0000)
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

index 96e5a0aeaefdc52ddacdc0d323a89b61fce27724..0f34bebb809b236d9446f47f8c2f009f4c02cd7a 100644 (file)
@@ -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;
 }