Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/env minor KNF nits.
details: https://anonhg.NetBSD.org/src/rev/95ef5a8d23d8
branches: trunk
changeset: 758811:95ef5a8d23d8
user: christos <christos%NetBSD.org@localhost>
date: Tue Nov 16 02:53:49 2010 +0000
description:
minor KNF nits.
diffstat:
usr.bin/env/env.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diffs (50 lines):
diff -r 0e684c423a1c -r 95ef5a8d23d8 usr.bin/env/env.c
--- a/usr.bin/env/env.c Tue Nov 16 02:53:02 2010 +0000
+++ b/usr.bin/env/env.c Tue Nov 16 02:53:49 2010 +0000
@@ -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);
}
Home |
Main Index |
Thread Index |
Old Index