]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(usage): Use EXIT_SUCCESS, not 0, for clarity.
authorJim Meyering <jim@meyering.net>
Wed, 21 Jan 2004 23:31:33 +0000 (23:31 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 21 Jan 2004 23:31:33 +0000 (23:31 +0000)
(main): Initialize exit_failure to EXIT_FAIL.
(main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
rather than roll-your-own symbols or integers.
(NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
changed to EXIT_CANNOT_INVOKE.

src/nohup.c

index 6d006f216e128973c3b290a84748254e84111bc2..d524424ec610474aebfc4f80d45fee6edba88950 100644 (file)
@@ -1,5 +1,5 @@
 /* nohup -- run a command immume to hangups, with output to a non-tty
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 /* Exit statuses.  */
 enum
   {
-    /* `nohup' found the specified command but failed to invoke it.  */
-    NOHUP_FOUND_BUT_CANNOT_INVOKE = 126,
-
-    /* `nohup' itself failed, or did not find the specified command.  */
+    /* `nohup' itself failed.  */
     NOHUP_FAILURE = 127
   };
 
@@ -48,7 +45,7 @@ char *program_name;
 void
 usage (int status)
 {
-  if (status != 0)
+  if (status != EXIT_SUCCESS)
     fprintf (stderr, _("Try `%s --help' for more information.\n"),
             program_name);
   else
@@ -83,6 +80,7 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
+  initialize_exit_failure (NOHUP_FAILURE);
   atexit (close_stdout);
 
   parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
@@ -173,9 +171,7 @@ main (int argc, char **argv)
     char **cmd = argv + 1;
 
     execvp (*cmd, cmd);
-    exit_status = (errno == ENOENT
-                  ? NOHUP_FAILURE
-                  : NOHUP_FOUND_BUT_CANNOT_INVOKE);
+    exit_status = (errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE);
     saved_errno = errno;
 
     /* The execve failed.  Output a diagnostic to stderr only if: