aboutsummaryrefslogtreecommitdiff
path: root/coreutils/printenv.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-03-22 13:56:39 +0000
committerRon Yorston <rmy@pobox.com>2012-03-22 13:56:39 +0000
commit811c449748d5bd0505f8510e5582892f94ac0cda (patch)
tree2640249cb2a9605c7cd59467b9861b205e9bcc8a /coreutils/printenv.c
parentc0d4367d6b581eb5989c02815880cf0fa2851ae8 (diff)
parent19311bfa7b8e8c6effa9c375de9b0eb4338bee12 (diff)
downloadbusybox-w32-811c449748d5bd0505f8510e5582892f94ac0cda.tar.gz
busybox-w32-811c449748d5bd0505f8510e5582892f94ac0cda.tar.bz2
busybox-w32-811c449748d5bd0505f8510e5582892f94ac0cda.zip
Merge commit '19311bfa7b8e8c6effa9c375de9b0eb4338bee12' into merge
Conflicts: coreutils/ls.c shell/ash.c
Diffstat (limited to 'coreutils/printenv.c')
-rw-r--r--coreutils/printenv.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/coreutils/printenv.c b/coreutils/printenv.c
index 33be5c096..d0fb71636 100644
--- a/coreutils/printenv.c
+++ b/coreutils/printenv.c
@@ -19,9 +19,14 @@ int printenv_main(int argc UNUSED_PARAM, char **argv)
19 19
20 /* no variables specified, show whole env */ 20 /* no variables specified, show whole env */
21 if (!argv[1]) { 21 if (!argv[1]) {
22 int e = 0; 22 char **e = environ;
23 while (environ[e]) 23
24 puts(environ[e++]); 24 /* environ can be NULL! (for example, after clearenv())
25 * Check for that:
26 */
27 if (e)
28 while (*e)
29 puts(*e++);
25 } else { 30 } else {
26 /* search for specified variables and print them out if found */ 31 /* search for specified variables and print them out if found */
27 char *arg, *env; 32 char *arg, *env;