> 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
>
>
I was wrong here, the for-loop returns as soon as it finds a valid
entry. I left the order as it is and just added a few debug statements.
After installing the new compiled libcurses, when i start a new terminal,
it tries to lookup existing information in existing databases, and
once an entry is found, it is used immediately. Only when no database
contains an entry for the terminal, a terminfo file is read:
>> _nc_read_bsd_terminfo_entry: Description of stnew-256color in
/home/nils/.terminfo
>> _nc_lookup_bsd_terminfo_entry: tn=stnew-256color,
filename=/home/nils/.terminfo
>> _nc_lookup_bsd_terminfo_entry: Read entries for stnew-256color
from /home/nils/.terminfo
>> _nc_read_bsd_terminfo_entry: not found! Should continue.
>> _nc_read_bsd_terminfo_entry: Description of stnew-256color in
/usr/share/misc/terminfo
>> _nc_lookup_bsd_terminfo_entry: tn=stnew-256color,
filename=/usr/share/misc/terminfo
>> _nc_lookup_bsd_terminfo_entry: Read entries for stnew-256color
from /usr/share/misc/terminfo
>> _nc_read_bsd_terminfo_entry: not found! Should continue.
>> _nc_read_bsd_terminfo_file:
filename=/home/nils/.terminfo/s/stnew-256color
>> _nc_lookup_bsd_terminfo_entry: tn=stnew-256color,
filename=/home/nils/.terminfo
Is this intended?
Nils