summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-01-21 22:59:14 +0000
committerJim Meyering <jim@meyering.net>2004-01-21 22:59:14 +0000
commit72cdc805d94f83d5deed1fa8cde588b41b208f98 (patch)
tree2abc39005314893e545972319aee2dd6241aff48
parent02e20fbfea39810a380d2a1c94129c0fcb050d37 (diff)
downloadcoreutils-72cdc805d94f83d5deed1fa8cde588b41b208f98.tar.xz
(usage): Use EXIT_SUCCESS, not 0, for clarity.
(main): Initialize exit_failure to EXIT_FAIL. (main): Use initialize_exit_failure rather than setting exit_failure directly; this optimizes away redundant assignments. (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE rather than roll-your-own symbols or integers. (main): Exit with status 1, not 2, on errors detected by env proper.
-rw-r--r--src/env.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/env.c b/src/env.c
index 0502220ef..263202633 100644
--- a/src/env.c
+++ b/src/env.c
@@ -1,5 +1,5 @@
/* env - run a program in a modified environment
- Copyright (C) 1986, 1991-2003 Free Software Foundation, Inc.
+ Copyright (C) 1986, 1991-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
@@ -110,7 +110,7 @@ static struct option const longopts[] =
void
usage (int status)
{
- if (status != 0)
+ if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
@@ -147,6 +147,7 @@ main (register int argc, register char **argv, char **envp)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ initialize_exit_failure (EXIT_FAIL);
atexit (close_stdout);
while ((optc = getopt_long (argc, argv, "+iu:", longopts, NULL)) != -1)
@@ -163,7 +164,7 @@ main (register int argc, register char **argv, char **envp)
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
- usage (2);
+ usage (EXIT_FAIL);
}
}
@@ -198,7 +199,7 @@ main (register int argc, register char **argv, char **envp)
execvp (argv[optind], &argv[optind]);
{
- int exit_status = (errno == ENOENT ? 127 : 126);
+ int exit_status = (errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE);
error (0, errno, "%s", argv[optind]);
exit (exit_status);
}