From 055d961f84fcfb430aceb40bdb7932d962b143e9 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 12 Jun 2000 09:27:09 +0000 Subject: 11867: restrict typeset -H application --- ChangeLog | 6 ++++++ Doc/Zsh/builtins.yo | 8 +++++--- Src/builtin.c | 2 +- Src/params.c | 3 ++- Src/zsh.h | 1 + 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1766e856..90fe5e90e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-06-12 Peter Stephenson + + * 11867: Src/builtin.c, Src/params.c, Src/zsh.h, + Doc/Zsh/builtins.yo: don't use -H flag for parameters mentioned + explicitly or by pattern. + 2000-06-11 Bart Schaefer * 11866: Functions/Misc/colors, Functions/Prompts/promptinit: Set diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 7bb4cf8e1..fb97cf56d 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -1132,9 +1132,11 @@ item(tt(-H))( Hide value: specifies that tt(typeset) will not display the value of the parameter when listing parameters; the display for such parameters is always as if the `tt(PLUS())' flag had been given. Use of the parameter is -in other respects normal. This is on by default for the parameters in the -tt(zsh/parameter) and tt(zsh/mapfile) modules. Note, however, that unlike -the tt(-h) flag this is also useful for non-special parameters. +in other respects normal, and the option does not apply if the parameter is +specified by name, or by pattern with the tt(-m) option. This is on by +default for the parameters in the tt(zsh/parameter) and tt(zsh/mapfile) +modules. Note, however, that unlike the tt(-h) flag this is also useful +for non-special parameters. ) item(tt(-i))( Use an internal integer representation. If var(n) is nonzero it diff --git a/Src/builtin.c b/Src/builtin.c index 950595c72..8ea88862f 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -1598,7 +1598,7 @@ typeset_single(char *cname, char *pname, Param pm, int func, if (usepm) { on &= ~PM_LOCAL; if (!on && !roff && !value) { - paramtab->printnode((HashNode)pm, 0); + paramtab->printnode((HashNode)pm, PRINT_INCLUDEVALUE); return pm; } if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) { diff --git a/Src/params.c b/Src/params.c index f57173495..2768c273d 100644 --- a/Src/params.c +++ b/Src/params.c @@ -3181,7 +3181,8 @@ printparamnode(HashNode hn, int printflags) printf("exported "); } - if ((printflags & PRINT_NAMEONLY) || (p->flags & PM_HIDEVAL)) { + if ((printflags & PRINT_NAMEONLY) || + ((p->flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE))) { zputs(p->nam, stdout); putchar('\n'); return; diff --git a/Src/zsh.h b/Src/zsh.h index 49f434691..d4f521f48 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1213,6 +1213,7 @@ struct nameddir { #define PRINT_TYPE (1<<1) #define PRINT_LIST (1<<2) #define PRINT_KV_PAIR (1<<3) +#define PRINT_INCLUDEVALUE (1<<4) /* flags for printing for the whence builtin */ #define PRINT_WHENCE_CSH (1<<4) -- cgit 1.4.1