Module Name: src
Committed By: njoly
Date: Sat Oct 16 11:13:52 UTC 2010
Modified Files:
src/usr.bin/env: env.c
Log Message:
Do use putenv(3) to handle the provided strings directly, instead of
setenv(3) which need string splitting and later reassembly.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.18 src/usr.bin/env/env.c:1.19
--- src/usr.bin/env/env.c:1.18 Fri Oct 15 19:35:08 2010
+++ src/usr.bin/env/env.c Sat Oct 16 11:13:52 2010
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "@(#)env.c 8.3 (Berkeley) 4/2/94";*/
-__RCSID("$NetBSD: env.c,v 1.18 2010/10/15 19:35:08 jschauma Exp $");
+__RCSID("$NetBSD: env.c,v 1.19 2010/10/16 11:13:52 njoly Exp $");
#endif /* not lint */
#include <err.h>
@@ -54,7 +54,7 @@
int
main(int argc, char **argv)
{
- char **ep, *p;
+ char **ep;
char *cleanenv[1];
int ch;
@@ -72,8 +72,8 @@
usage();
}
- for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv)
- (void)setenv(*argv, ++p, 1);
+ for (argv += optind; *argv && strchr(*argv, '=') != NULL; ++argv)
+ (void)putenv(*argv);
if (*argv) {
/* return 127 if the command to be run could not be found; 126