summaryrefslogtreecommitdiff
path: root/usr/src/cmd/env/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/env/env.c')
-rw-r--r--usr/src/cmd/env/env.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/usr/src/cmd/env/env.c b/usr/src/cmd/env/env.c
index bbd146bc62..ff2b2c4b31 100644
--- a/usr/src/cmd/env/env.c
+++ b/usr/src/cmd/env/env.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,23 +18,22 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
- * All Rights Reserved
+ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
+ * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
+ * All Rights Reserved
*/
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5 */
-
/*
* env [ - ] [ name=value ]... [command arg...]
* set environment, then execute command (or print environment)
* - says start fresh, otherwise merge with inherited environment
*/
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -49,7 +47,6 @@
static void Usage();
-static char *nullp = NULL;
extern char **environ;
@@ -70,7 +67,7 @@ main(int argc, char **argv)
/* check for non-standard "-" option */
if ((argc > 1) && (strcmp(argv[1], "-")) == 0) {
- environ = &nullp;
+ (void) clearenv();
for (i = 1; i < argc; i++)
argv[i] = argv[i+1];
argc--;
@@ -80,7 +77,7 @@ main(int argc, char **argv)
while ((opt = getopt(argc, argv, "i")) != EOF) {
switch (opt) {
case 'i':
- environ = &nullp;
+ (void) clearenv();
break;
default: