Nicholas Marriott schrieb am 24.03.2014 18:51:
> IIRC the directories are searched after the db. Install it as stnew or
> something
> instead.
> 

You're right, installing the terminfo entries as stnew works (if the 
terminal name is changed as well)!  I grepped the sources a bit, and 
found this file:

    /usr/src/lib/libcurses/tinfo/read_bsd_terminfo.c

In there, you find a hardcoded string pointing to the nonexistent file:

    #define _PATH_TERMINFO  "/usr/share/misc/terminfo"

and this function:


int
_nc_read_bsd_terminfo_entry(tn, filename, tp)
    const char *const tn;
    char *const filename;
    TERMTYPE *const tp;
{
    char **fname, *p;
    char   envterm[PATH_MAX];           /* local copy of $TERMINFO */
    char   hometerm[PATH_MAX];          /* local copy of $HOME/.terminfo */
    char  *pathvec[4];                  /* list of possible terminfo files */
    size_t len;

    fname = pathvec;
    /* $TERMINFO may hold a path to a terminfo file */
    if (use_terminfo_vars() && (p = getenv("TERMINFO")) != NULL) {
        len = strlcpy(envterm, p, sizeof(envterm));
        if (len < sizeof(envterm))
            *fname++ = envterm;
    }

    /* Also check $HOME/.terminfo if it exists */
    if (use_terminfo_vars() && (p = getenv("HOME")) != NULL && *p != '\0') {
        len = snprintf(hometerm, sizeof(hometerm), "%s/.terminfo", p);
        if (len > 0 && len < sizeof(hometerm))
            *fname++ = hometerm;
    }

    /* Finally we check the system terminfo file */
    *fname++ = _PATH_TERMINFO;
    *fname = NULL;

    /*
     * Lookup ``tn'' in each possible terminfo file until
     * we find it or reach the end.
     */
    for (fname = pathvec; *fname; fname++) {
        if (_nc_lookup_bsd_terminfo_entry(tn, *fname, tp) == 1) {
            /* Set copyout parameter and return */
            (void)strlcpy(filename, *fname, PATH_MAX);
            return (1);
        }
    }
    return (0);
}


If i understand correctly, this program is used to read terminfo files 
and to lookup entries later, though i have no idea how it is done.  From 
this code, it seems that a dir given with TERMINFO and ~/.terminfo are 
checked as well, but always *before* the systemwide db is checked, and 
therefore, all previous entries are overridden if the same terminal id 
is found there in the system db.  Maybe changing the order of checks will
allow entries in ~ to dominate entries from the system db, and even 
though i don't really know what i'm doing, i think i will try it out and 
see if it helps :)

Best,
Nils

Reply via email to