summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--src/actions.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 80738db..71385de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-29 Shawn Betts <sabetts@vcn.bc.ca>
+
+ * src/actions.c (cmd_getenv): return an empty string for
+ nonexistant env vars.
+
2006-04-21 Shawn Betts <sabetts@vcn.bc.ca>
* src/main.c (print_version): print build date
diff --git a/src/actions.c b/src/actions.c
index 8f57d7c..216432c 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -3743,7 +3743,10 @@ cmd_getenv (int interactive, struct cmdarg **args)
char *value;
value = getenv (ARG_STRING(0));
- return cmdret_new (RET_SUCCESS, "%s", value);
+ if (value)
+ return cmdret_new (RET_SUCCESS, "%s", value);
+ else
+ return cmdret_new (RET_SUCCESS, "");
}
/* Thanks to Gergely Nagy <algernon@debian.org> for the original