From: Guillaume Maudoux <layus.on@gmail.com>
To: zsh-workers@zsh.org
Cc: Guillaume Maudoux <layus.on@gmail.com>
Subject: [PATCH] make TERMINFO_DIRS variable special
Date: Tue, 8 Nov 2016 21:26:51 +0100 [thread overview]
Message-ID: <20161108202651.22527-1-layus.on@gmail.com> (raw)
---
Doc/Zsh/params.yo | 15 +++++++++++----
Src/params.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index c7d84b9..728fc21 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -1485,10 +1485,17 @@ take effect.
)
vindex(TERMINFO)
item(tt(TERMINFO) <S>)(
-A reference to a compiled description of the terminal, used by the
-`terminfo' library when the system has it; see manref(terminfo)(5).
-If set, this causes the shell to reinitialise the terminal, making
-the workaround `tt(TERM=$TERM)' unnecessary.
+A reference to a directory containing the compiled description of
+terminals, used by the `terminfo' library when the system has it; see
+manref(terminfo)(5). If set, this causes the shell to reinitialise the
+terminal, making the workaround `tt(TERM=$TERM)' unnecessary.
+)
+vindex(TERMINFO_DIRS)
+item(tt(TERMINFO_DIRS) <S>)(
+An array (colon-separated list) of paths to be searched for a compiled
+description of the terminal, used by the `terminfo' library when the system has
+it; see manref(terminfo)(5). If set, this causes the shell to reinitialise the
+terminal, making the workaround `tt(TERM=$TERM)' unnecessary.
)
vindex(TIMEFMT)
item(tt(TIMEFMT))(
diff --git a/Src/params.c b/Src/params.c
index 19a8c29..92b8ac1 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),
@@ -4511,6 +4515,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' */
/**/
--
2.10.1
next reply other threads:[~2016-11-08 20:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <12935.1478707087@hydra.kiddle.eu>
2016-11-08 20:26 ` Guillaume Maudoux [this message]
2016-11-09 14:47 ` Guillaume Maudoux (Layus)
2016-11-09 15:26 ` Peter Stephenson
2016-11-09 15:35 ` Guillaume Maudoux (Layus)
2016-11-09 16:14 ` Guillaume Maudoux
2016-11-09 16:14 ` Guillaume Maudoux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161108202651.22527-1-layus.on@gmail.com \
--to=layus.on@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).