summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c14
-rw-r--r--Src/params.c4
-rw-r--r--Src/utils.c8
-rw-r--r--Src/zsh.h1
4 files changed, 19 insertions, 8 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 11c1ab3a4..d99802f5f 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2240,7 +2240,8 @@ typeset_single(char *cname, char *pname, Param pm, int func,
paramtab->printnode(&pm->node, PRINT_TYPESET);
else if (!OPT_ISSET(ops,'g') &&
(unset(TYPESETSILENT) || OPT_ISSET(ops,'m')))
- paramtab->printnode(&pm->node, PRINT_INCLUDEVALUE);
+ paramtab->printnode(&pm->node,
+ PRINT_INCLUDEVALUE|PRINT_WITH_NAMESPACE);
return pm;
}
if ((pm->node.flags & PM_RESTRICTED) && isset(RESTRICTED)) {
@@ -2274,7 +2275,7 @@ typeset_single(char *cname, char *pname, Param pm, int func,
}
}
if (OPT_ISSET(ops,'p')) {
- paramtab->printnode(&pm->node, PRINT_TYPESET);
+ paramtab->printnode(&pm->node, PRINT_TYPESET|PRINT_WITH_NAMESPACE);
return pm;
}
if (usepm == 2) /* do not change the PM_UNSET flag */
@@ -2662,7 +2663,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
char *optstr = TYPESET_OPTSTR;
int on = 0, off = 0, roff, bit = PM_ARRAY;
int i;
- int returnval = 0, printflags = 0;
+ int returnval = 0, printflags = PRINT_WITH_NAMESPACE;
int hasargs = *argv != NULL || (assigns && firstnode(assigns));
/* POSIXBUILTINS is set for bash/ksh and both ignore -p with args */
@@ -2730,7 +2731,6 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
queue_signals();
- /* Given no arguments, list whatever the options specify. */
if (OPT_ISSET(ops,'p')) {
if (isset(POSIXBUILTINS) && SHELL_EMULATION() != EMULATE_KSH) {
@@ -2756,8 +2756,14 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
/* -p0 treated as -p for consistency */
}
}
+
+ /* Given no arguments, list whatever the options specify. */
if (!hasargs) {
int exclude = 0;
+
+ if (!OPT_ISSET(ops,'m'))
+ printflags &= ~PRINT_WITH_NAMESPACE;
+
if (!OPT_ISSET(ops,'p')) {
if (!(on|roff))
printflags |= PRINT_TYPE;
diff --git a/Src/params.c b/Src/params.c
index 85eaee609..021d341e8 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -5966,6 +5966,10 @@ printparamnode(HashNode hn, int printflags)
Param p = (Param) hn;
Param peer = NULL;
+ if (!(p->node.flags & PM_HASHELEM) &&
+ !(printflags & PRINT_WITH_NAMESPACE) && *(p->node.nam) == '.')
+ return;
+
if (p->node.flags & PM_UNSET) {
if ((printflags & (PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT) &&
p->node.flags & (PM_READONLY|PM_EXPORTED)) ||
diff --git a/Src/utils.c b/Src/utils.c
index 8ce9a175d..14ff0ed47 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -4319,13 +4319,13 @@ itype_end(const char *ptr, int itype, int once)
{
if (itype == INAMESPC) {
itype = IIDENT;
- if (once == 0 && (!isset(POSIXIDENTIFIERS) || EMULATION(EMULATE_KSH))) {
+ if (!isset(POSIXIDENTIFIERS) || EMULATION(EMULATE_KSH)) {
/* Special case for names containing ".", ksh93 namespaces */
char *t = itype_end(ptr + (*ptr == '.'), itype, 0);
- if (t > ptr+1) {
+ if (t > ptr + (*ptr == '.')) {
if (*t == '.')
- return itype_end(t+1, itype, 0);
- else
+ ptr = t + 1; /* Fall through */
+ else if (!once)
return t;
}
}
diff --git a/Src/zsh.h b/Src/zsh.h
index f3a777045..a0243e98e 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -2184,6 +2184,7 @@ typedef groupset *Groupset;
#define PRINT_LINE (1<<6)
#define PRINT_POSIX_EXPORT (1<<7)
#define PRINT_POSIX_READONLY (1<<8)
+#define PRINT_WITH_NAMESPACE (1<<9)
/* flags for printing for the whence builtin */
#define PRINT_WHENCE_CSH (1<<7)