(usage): Use EXIT_SUCCESS, not 0, for clarity.

(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.
This commit is contained in:
Jim Meyering committed 2004-01-21 23:31:33 +00:00
1 parent d2e7cd3b7a
commit cdc257accd
1 file changed
+5 -9
+5 -9
View 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
@@ -36,10 +36,7 @@
/* 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: