diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-09-03 12:37:35 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-09-03 12:37:35 +0000 |
commit | 6563b9d181c1ee28db375ac1c3568cf334cf44ce (patch) | |
tree | 182f4aea3b68a049016d204203b80d52a67fd863 /Src | |
parent | e585af89d95d20f3bd42234631f40df44f2b5aab (diff) | |
download | zsh-6563b9d181c1ee28db375ac1c3568cf334cf44ce.tar.gz zsh-6563b9d181c1ee28db375ac1c3568cf334cf44ce.tar.xz zsh-6563b9d181c1ee28db375ac1c3568cf334cf44ce.zip |
zsh-workers/7636
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Modules/mapfile.c | 3 | ||||
-rw-r--r-- | Src/Modules/parameter.c | 2 | ||||
-rw-r--r-- | Src/builtin.c | 21 | ||||
-rw-r--r-- | Src/zsh.h | 21 |
4 files changed, 28 insertions, 19 deletions
diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c index a3386ed2e..cd9c0120d 100644 --- a/Src/Modules/mapfile.c +++ b/Src/Modules/mapfile.c @@ -87,7 +87,8 @@ createmapfilehash() unsetparam_pm(pm, 0, 1); mapfile_pm = NULL; - if (!(pm = createparam(mapfile_nam, PM_SPECIAL|PM_REMOVABLE|PM_HASHED))) + if (!(pm = createparam(mapfile_nam, + PM_SPECIAL|PM_HIDE|PM_REMOVABLE|PM_HASHED))) return NULL; pm->level = pm->old ? locallevel : 0; diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c index 2d932ce06..14f05d41d 100644 --- a/Src/Modules/parameter.c +++ b/Src/Modules/parameter.c @@ -47,7 +47,7 @@ createspecialhash(char *name, GetNodeFunc get, ScanTabFunc scan) Param pm; HashTable ht; - if (!(pm = createparam(name, PM_SPECIAL|PM_REMOVABLE|PM_HASHED))) + if (!(pm = createparam(name, PM_SPECIAL|PM_HIDE|PM_REMOVABLE|PM_HASHED))) return NULL; pm->level = pm->old ? locallevel : 0; diff --git a/Src/builtin.c b/Src/builtin.c index 6a2ec8335..ed9d01909 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -50,7 +50,7 @@ static struct builtin builtins[] = BUILTIN("cd", 0, bin_cd, 0, 2, BIN_CD, NULL, NULL), BUILTIN("chdir", 0, bin_cd, 0, 2, BIN_CD, NULL, NULL), BUILTIN("continue", BINF_PSPECIAL, bin_break, 0, 1, BIN_CONTINUE, NULL, NULL), - BUILTIN("declare", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ALRTUZafgilrtux", NULL), + BUILTIN("declare", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ALRTUZafghilrtux", NULL), BUILTIN("dirs", 0, bin_dirs, 0, -1, 0, "v", NULL), BUILTIN("disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmr", NULL), BUILTIN("disown", 0, bin_fg, 0, -1, BIN_DISOWN, NULL, NULL), @@ -60,7 +60,7 @@ static struct builtin builtins[] = BUILTIN("enable", 0, bin_enable, 0, -1, BIN_ENABLE, "afmr", NULL), BUILTIN("eval", BINF_PSPECIAL, bin_eval, 0, -1, BIN_EVAL, NULL, NULL), BUILTIN("exit", BINF_PSPECIAL, bin_break, 0, 1, BIN_EXIT, NULL, NULL), - BUILTIN("export", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, BIN_EXPORT, "LRTUZafilrtu", "xg"), + BUILTIN("export", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, BIN_EXPORT, "LRTUZafhilrtu", "xg"), BUILTIN("false", 0, bin_false, 0, -1, 0, NULL, NULL), BUILTIN("fc", BINF_FCOPTS, bin_fc, 0, -1, BIN_FC, "nlreIRWAdDfEim", NULL), BUILTIN("fg", 0, bin_fg, 0, -1, BIN_FG, NULL, NULL), @@ -74,11 +74,11 @@ static struct builtin builtins[] = #endif BUILTIN("history", 0, bin_fc, 0, -1, BIN_FC, "nrdDfEim", "l"), - BUILTIN("integer", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "glrtux", "i"), + BUILTIN("integer", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ghlrtux", "i"), BUILTIN("jobs", 0, bin_fg, 0, -1, BIN_JOBS, "dlpZrs", NULL), BUILTIN("kill", 0, bin_kill, 0, -1, 0, NULL, NULL), BUILTIN("let", 0, bin_let, 1, -1, 0, NULL, NULL), - BUILTIN("local", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ALRTUZailrtu", NULL), + BUILTIN("local", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ALRTUZahilrtu", NULL), BUILTIN("log", 0, bin_log, 0, 0, 0, NULL, NULL), BUILTIN("logout", 0, bin_break, 0, 1, BIN_LOGOUT, NULL, NULL), @@ -97,7 +97,7 @@ static struct builtin builtins[] = BUILTIN("pwd", 0, bin_pwd, 0, 0, 0, "rLP", NULL), BUILTIN("r", BINF_R, bin_fc, 0, -1, BIN_FC, "nrl", NULL), BUILTIN("read", 0, bin_read, 0, -1, 0, "rzu0123456789pkqecnAlE", NULL), - BUILTIN("readonly", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ALRTUZafgiltux", "r"), + BUILTIN("readonly", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ALRTUZafghiltux", "r"), BUILTIN("rehash", 0, bin_hash, 0, 0, 0, "dfv", "r"), BUILTIN("return", BINF_PSPECIAL, bin_break, 0, 1, BIN_RETURN, NULL, NULL), BUILTIN("set", BINF_PSPECIAL, bin_set, 0, -1, 0, NULL, NULL), @@ -111,7 +111,7 @@ static struct builtin builtins[] = BUILTIN("trap", BINF_PSPECIAL, bin_trap, 0, -1, 0, NULL, NULL), BUILTIN("true", 0, bin_true, 0, -1, 0, NULL, NULL), BUILTIN("type", 0, bin_whence, 0, -1, 0, "ampfsw", "v"), - BUILTIN("typeset", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ALRTUZafgilrtuxm", NULL), + BUILTIN("typeset", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "ALRTUZafghilrtuxm", NULL), BUILTIN("umask", 0, bin_umask, 0, 1, 0, "S", NULL), BUILTIN("unalias", 0, bin_unhash, 1, -1, 0, "m", "a"), BUILTIN("unfunction", 0, bin_unhash, 1, -1, 0, "m", "f"), @@ -1560,8 +1560,13 @@ typeset_single(char *cname, char *pname, Param pm, int func, /* * If the original parameter was special and we're creating * a new one, we need to keep it special. + * + * The -h (hide) flags prevents an existing special being made + * local. It can be applied either to the special or in the + * typeset/local statement for the local variable. */ - newspecial = (pm->flags & PM_SPECIAL); + newspecial = (pm->flags & PM_SPECIAL) + && !(on & PM_HIDE) && !(pm->flags & PM_HIDE & ~off); usepm = 0; } @@ -1780,7 +1785,7 @@ bin_typeset(char *name, char **argv, char *ops, int func) Param pm; Asgment asg; Patprog pprog; - char *optstr = "aiALRZlurtxUT"; + char *optstr = "aiALRZlurtxUhT"; int on = 0, off = 0, roff, bit = PM_ARRAY; int i; int returnval = 0, printflags = 0; diff --git a/Src/zsh.h b/Src/zsh.h index 3ba88cd83..3b5188724 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1028,15 +1028,18 @@ struct param { #define PM_UNIQUE (1<<11) /* remove duplicates */ #define PM_UNALIASED (1<<11) /* do not expand aliases when autoloading */ -#define PM_TIED (1<<12) /* array tied to colon-path or v.v. */ -#define PM_LOCAL (1<<13) /* this parameter will be made local */ -#define PM_SPECIAL (1<<14) /* special builtin parameter */ -#define PM_DONTIMPORT (1<<15) /* do not import this variable */ -#define PM_RESTRICTED (1<<16) /* cannot be changed in restricted mode */ -#define PM_UNSET (1<<17) /* has null value */ -#define PM_REMOVABLE (1<<18) /* special can be removed from paramtab */ -#define PM_AUTOLOAD (1<<19) /* autoloaded from module */ -#define PM_NORESTORE (1<<20) /* do not restore value of local special */ +#define PM_HIDE (1<<12) /* Special behaviour hidden by local */ +#define PM_TIED (1<<13) /* array tied to colon-path or v.v. */ + +/* Remaining flags do not correspond directly to command line arguments */ +#define PM_LOCAL (1<<14) /* this parameter will be made local */ +#define PM_SPECIAL (1<<15) /* special builtin parameter */ +#define PM_DONTIMPORT (1<<16) /* do not import this variable */ +#define PM_RESTRICTED (1<<17) /* cannot be changed in restricted mode */ +#define PM_UNSET (1<<18) /* has null value */ +#define PM_REMOVABLE (1<<19) /* special can be removed from paramtab */ +#define PM_AUTOLOAD (1<<20) /* autoloaded from module */ +#define PM_NORESTORE (1<<21) /* do not restore value of local special */ /* Flags for extracting elements of arrays and associative arrays */ #define SCANPM_WANTVALS (1<<0) |