From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1429 invoked by alias); 8 May 2011 20:21:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29191 Received: (qmail 14701 invoked from network); 8 May 2011 20:21:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at lorien.comfychair.org designates 173.8.144.98 as permitted sender) Date: Sun, 8 May 2011 13:13:12 -0700 From: Danek Duvall To: zsh-workers@zsh.org Subject: patch to make $TERMINFO special Message-ID: <20110508201312.GA5170@lorien.comfychair.org> Mail-Followup-To: Danek Duvall , zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2010-04-22) I'm sure I'm going about this the wrong way, but at least it seems to work ... My problem is that I'm using a value of $TERM that's not present in the system's terminfo database, so when zsh starts up, its terminal handling is pretty confused. I'd like to be able to set TERMINFO to the proper path, but in order for that to do anything, the terminal needs to be reinitialized. So I've made TERMINFO a special variable that calls init_term() when it's set, and it seems to work okay. I'm guessing that the addenv() call isn't necessary, but I can't figure out how it ought to work. --- zsh-4.3.10/Src/params.c Fri May 8 02:45:13 2009 +++ zsh-4.3.10/Src/params.c Sun May 8 13:09:53 2011 @@ -198,6 +198,8 @@ { homegetfn, homesetfn, stdunsetfn }; static const struct gsu_scalar term_gsu = { termgetfn, termsetfn, stdunsetfn }; +static const struct gsu_scalar terminfo_gsu = +{ strgetfn, terminfosetfn, stdunsetfn }; static const struct gsu_scalar wordchars_gsu = { wordcharsgetfn, wordcharssetfn, stdunsetfn }; static const struct gsu_scalar ifs_gsu = @@ -270,6 +272,7 @@ IPDEF2("histchars", histchars_gsu, PM_DONTIMPORT), IPDEF2("HOME", home_gsu, PM_UNSET), IPDEF2("TERM", term_gsu, 0), +IPDEF2("TERMINFO", terminfo_gsu, 0), IPDEF2("WORDCHARS", wordchars_gsu, 0), IPDEF2("IFS", ifs_gsu, PM_DONTIMPORT), IPDEF2("_", underscore_gsu, PM_READONLY), @@ -3943,6 +3946,22 @@ term = x ? x : ztrdup(""); /* If non-interactive, delay setting up term till we need it. */ + if (unset(INTERACTIVE) || !*term) + termflags |= TERM_UNKNOWN; + else + init_term(); +} + +/* Function to set value of special parameter `TERMINFO' */ + +/**/ +void +terminfosetfn(Param pm, char *x) +{ + strsetfn(pm, x); + addenv(pm, x); + + /* If non-interactive, delay setting up term till we need it. */ if (unset(INTERACTIVE) || !*term) termflags |= TERM_UNKNOWN; else All comments appreciated. Thanks, Danek