Module Name: src Committed By: christos Date: Tue Nov 16 02:53:49 UTC 2010
Modified Files: src/usr.bin/env: env.c Log Message: minor KNF nits. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/usr.bin/env/env.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/env/env.c diff -u src/usr.bin/env/env.c:1.19 src/usr.bin/env/env.c:1.20 --- src/usr.bin/env/env.c:1.19 Sat Oct 16 07:13:52 2010 +++ src/usr.bin/env/env.c Mon Nov 15 21:53:49 2010 @@ -35,7 +35,7 @@ #ifndef lint /*static char sccsid[] = "@(#)env.c 8.3 (Berkeley) 4/2/94";*/ -__RCSID("$NetBSD: env.c,v 1.19 2010/10/16 11:13:52 njoly Exp $"); +__RCSID("$NetBSD: env.c,v 1.20 2010/11/16 02:53:49 christos Exp $"); #endif /* not lint */ #include <err.h> @@ -46,8 +46,7 @@ #include <locale.h> #include <errno.h> -int main(int, char **); -static void usage(void); +static void usage(void) __attribute__((__noreturn__)); extern char **environ; @@ -58,7 +57,8 @@ char *cleanenv[1]; int ch; - setlocale(LC_ALL, ""); + setprogname(*argv); + (void)setlocale(LC_ALL, ""); while ((ch = getopt(argc, argv, "-i")) != -1) switch((char)ch) { @@ -79,7 +79,7 @@ /* return 127 if the command to be run could not be found; 126 if the command was found but could not be invoked */ - execvp(*argv, argv); + (void)execvp(*argv, argv); err((errno == ENOENT) ? 127 : 126, "%s", *argv); /* NOTREACHED */ } @@ -93,6 +93,7 @@ static void usage(void) { - (void)fprintf(stderr, "usage: env [-i] [name=value ...] [command]\n"); + (void)fprintf(stderr, "Usage: %s [-i] [name=value ...] [command]\n", + getprogname()); exit(1); }