diff options
| author | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
|---|---|---|
| committer | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 |
| commit | a16f65c7d117419bd266c28a1901ef129a337569 (patch) | |
| tree | 2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /usr.bin/env/env.c | |
| parent | 8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff) | |
Diffstat (limited to 'usr.bin/env/env.c')
| -rw-r--r-- | usr.bin/env/env.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c index 7583a696bc55..6db59920db4d 100644 --- a/usr.bin/env/env.c +++ b/usr.bin/env/env.c @@ -38,15 +38,21 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)env.c 5.3 (Berkeley) 6/1/90"; +/*static char sccsid[] = "from: @(#)env.c 5.3 (Berkeley) 6/1/90";*/ +static char rcsid[] = "$Id: env.c,v 1.3 1993/11/23 00:32:59 jtc Exp $"; #endif /* not lint */ #include <stdio.h> +#include <stdlib.h> #include <string.h> +#include <locale.h> #include <errno.h> +#include <unistd.h> +#include <err.h> static void usage(); +int main(argc, argv) int argc; char **argv; @@ -57,7 +63,9 @@ main(argc, argv) char *cleanenv[1]; int ch; - while ((ch = getopt(argc, argv, "-i")) != EOF) + setlocale(LC_ALL, ""); + + while ((ch = getopt(argc, argv, "-i")) != -1) switch((char)ch) { case '-': /* obsolete */ case 'i': @@ -75,12 +83,10 @@ main(argc, argv) if (*argv) { /* return 127 if the command to be run could not be found; 126 if the command was was found but could not be invoked */ - int status; execvp(*argv, argv); - status = (errno == ENOENT) ? 127 : 126; - (void)fprintf(stderr, "env: %s: %s\n", *argv, strerror(errno)); - exit(status); + err((errno == ENOENT) ? 127 : 126, "%s", *argv); + /* NOTREACHED */ } for (ep = environ; *ep; ep++) |
