summaryrefslogtreecommitdiff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 742527e00..c62664e26 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1858,7 +1858,7 @@ bin_typeset(char *name, char **argv, char *ops, int func)
return 0;
}
- if ((!ops['g'] && !ops['x']) || ops['g'] == 2 || *name == 'l' ||
+ if (!(ops['g'] || ops['x'] || ops['m']) || ops['g'] == 2 || *name == 'l' ||
!isset(GLOBALEXPORT))
on |= PM_LOCAL;
@@ -1942,7 +1942,11 @@ bin_typeset(char *name, char **argv, char *ops, int func)
/* With the -m option, treat arguments as glob patterns */
if (ops['m']) {
- on &= ~PM_LOCAL;
+ if (!(on|roff))
+ printflags |= PRINT_TYPE;
+ if (!on)
+ printflags |= PRINT_NAMEONLY;
+
while ((asg = getasg(*argv++))) {
LinkList pmlist = newlinklist();
LinkNode pmnode;
@@ -1954,6 +1958,11 @@ bin_typeset(char *name, char **argv, char *ops, int func)
returnval = 1;
continue;
}
+ if (ops['m'] == 2 && !asg->value) {
+ scanmatchtable(paramtab, pprog, on|roff, 0,
+ paramtab->printnode, printflags);
+ continue;
+ }
/*
* Search through the parameter table and change all parameters
* matching the glob pattern to have these flags and/or value.