diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-12-11 22:16:23 -0600 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-12-13 11:46:55 -0700 |
commit | be11235ab802844e12d84921a38fd8ae4ddda080 (patch) | |
tree | 3ae5bb11aec34357c28bb46ed9ed66ad94f9f63f /lib/hashtable.c | |
parent | ec8a252cd492a7a409d6912aebeff34bb9e1e1e1 (diff) | |
download | u-boot-imx-be11235ab802844e12d84921a38fd8ae4ddda080.zip u-boot-imx-be11235ab802844e12d84921a38fd8ae4ddda080.tar.gz u-boot-imx-be11235ab802844e12d84921a38fd8ae4ddda080.tar.bz2 |
env: Hide '.' variables in env print by default
When printing all variables with env print, don't print variables that
begin with '.'. If env print is called with a '-a' switch, then
include variables that begin with '.' (just like the ls command).
Variables printed explicitly will be printed even without the -a.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'lib/hashtable.c')
-rw-r--r-- | lib/hashtable.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/hashtable.c b/lib/hashtable.c index 6861a42..7c6b96c 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -522,7 +522,7 @@ static int cmpkey(const void *p1, const void *p2) return (strcmp(e1->key, e2->key)); } -ssize_t hexport_r(struct hsearch_data *htab, const char sep, +ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag, char **resp, size_t size, int argc, char * const argv[]) { @@ -559,6 +559,9 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep, if ((argc > 0) && (found == 0)) continue; + if ((flag & H_HIDE_DOT) && ep->key[0] == '.') + continue; + list[n++] = ep; totlen += strlen(ep->key) + 2; |