summaryrefslogtreecommitdiff
path: root/src/env.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-17 03:57:04 +0000
committerJim Meyering <jim@meyering.net>1993-10-17 03:57:04 +0000
commitfa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8 (patch)
treeffc67e10bcf805a9ee5b8243a5103f5bdb4fb90a /src/env.c
parent6e1a4cca6862fa1fb40b4c38b73fa30ebb61344b (diff)
downloadcoreutils-fa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8.tar.gz
coreutils-fa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8.tar.bz2
coreutils-fa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8.zip
merge with 1.8.1g
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/env.c b/src/env.c
index 0871ba0c4..2f448c7b1 100644
--- a/src/env.c
+++ b/src/env.c
@@ -145,7 +145,7 @@ main (argc, argv, envp)
case 'u':
break;
default:
- usage ();
+ usage (2);
}
}
@@ -156,7 +156,7 @@ main (argc, argv, envp)
}
if (show_help)
- usage ();
+ usage (0);
if (optind != argc && !strcmp (argv[optind], "-"))
ignore_environment = 1;
@@ -192,11 +192,28 @@ main (argc, argv, envp)
}
static void
-usage ()
+usage (status)
+ int status;
{
- fprintf (stderr, "\
-Usage: %s [{--help,--version}] [-] [-i] [-u name] [--ignore-environment]\n\
- [--unset=name] [name=value]... [command [args...]]\n",
+ fprintf (status == 0 ? stdout : stderr, "\
+Usage: %s [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]\n\
+",
program_name);
- exit (2);
+
+ if (status != 0)
+ fprintf (stderr, "\nTry `%s --help' for more information.\n",
+ program_name);
+ else
+
+ printf ("\
+\n\
+ -u, --unset NAME remove variable from the environment\n\
+ -i, --ignore-environment start with an empty environment\n\
+ --help display this help and exit\n\
+ --version output version information and exit\n\
+\n\
+A mere - implies -i. If no COMMAND, print the resulting environment.\n\
+");
+
+ exit (status);
}