Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

patch to make $TERMINFO special



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



Messages sorted by: Reverse Date, Date, Thread, Author