diff options
author | Guillaume Maudoux <layus.on@gmail.com> | 2016-11-09 17:14:33 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2016-11-20 20:24:15 +0000 |
commit | dae21874d498ccd3f947f6f47e5ec23feb2bdcb4 (patch) | |
tree | f92d59fc773c1485ead0d87aa8d607d0627fe84c /Src | |
parent | 368884a3aacd9852ae1310346695dbf2240e863b (diff) | |
download | zsh-dae21874d498ccd3f947f6f47e5ec23feb2bdcb4.tar.gz zsh-dae21874d498ccd3f947f6f47e5ec23feb2bdcb4.tar.xz zsh-dae21874d498ccd3f947f6f47e5ec23feb2bdcb4.zip |
39900: Add TERMINFO_DIRS special like TERMINFO.
Although this is a colon-separated array there is no tied array.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/params.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Src/params.c b/Src/params.c index a79debc93..45f398a27 100644 --- a/Src/params.c +++ b/Src/params.c @@ -87,6 +87,7 @@ char *ifs, /* $IFS */ *postedit, /* $POSTEDIT */ *term, /* $TERM */ *zsh_terminfo, /* $TERMINFO */ + *zsh_terminfodirs, /* $TERMINFO_DIRS */ *ttystrname, /* $TTY */ *pwd; /* $PWD */ @@ -208,6 +209,8 @@ static const struct gsu_scalar term_gsu = { termgetfn, termsetfn, stdunsetfn }; static const struct gsu_scalar terminfo_gsu = { terminfogetfn, terminfosetfn, stdunsetfn }; +static const struct gsu_scalar terminfodirs_gsu = +{ terminfodirsgetfn, terminfodirssetfn, stdunsetfn }; static const struct gsu_scalar wordchars_gsu = { wordcharsgetfn, wordcharssetfn, stdunsetfn }; static const struct gsu_scalar ifs_gsu = @@ -283,6 +286,7 @@ IPDEF2("histchars", histchars_gsu, PM_DONTIMPORT), IPDEF2("HOME", home_gsu, PM_UNSET), IPDEF2("TERM", term_gsu, PM_UNSET), IPDEF2("TERMINFO", terminfo_gsu, PM_UNSET), +IPDEF2("TERMINFO_DIRS", terminfodirs_gsu, PM_UNSET), IPDEF2("WORDCHARS", wordchars_gsu, 0), IPDEF2("IFS", ifs_gsu, PM_DONTIMPORT | PM_RESTRICTED), IPDEF2("_", underscore_gsu, PM_DONTIMPORT), @@ -4548,6 +4552,33 @@ terminfosetfn(Param pm, char *x) term_reinit_from_pm(); } +/* Function to get value of special parameter `TERMINFO_DIRS' */ + +/**/ +char * +terminfodirsgetfn(UNUSED(Param pm)) +{ + return zsh_terminfodirs ? zsh_terminfodirs : dupstring(""); +} + +/* Function to set value of special parameter `TERMINFO_DIRS' */ + +/**/ +void +terminfodirssetfn(Param pm, char *x) +{ + zsfree(zsh_terminfodirs); + zsh_terminfodirs = x; + + /* + * terminfo relies on the value being exported before + * we reinitialise the terminal. This is a bit inefficient. + */ + if ((pm->node.flags & PM_EXPORTED) && x) + addenv(pm, x); + + term_reinit_from_pm(); +} /* Function to get value for special parameter `pipestatus' */ /**/ |