diff options
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++) |
