static int grab_entry(const char *const tn, TERMTYPE *const tp) /* return 1 if entry found, 0 if not found, -1 if database not accessible */ { #if USE_DATABASE char filename[PATH_MAX]; #endif int status; /* * $TERM shouldn't contain pathname delimiters. */ if (strchr(tn, '/')) return 0; #if USE_DATABASE if ((status = _nc_read_entry(tn, filename, tp)) != 1) { #if !PURE_TERMINFO /* * Try falling back on the termcap file. * Note: allowing this call links the entire terminfo/termcap * compiler into the startup code. It's preferable to build a * real terminfo database and use that. */ status = _nc_read_termcap_entry(tn, tp); #endif /* PURE_TERMINFO */ } #else status = _nc_read_termcap_entry(tn, tp); #endif /* * If we have an entry, force all of the cancelled strings to null * pointers so we don't have to test them in the rest of the library. * (The terminfo compiler bypasses this logic, since it must know if * a string is cancelled, for merging entries). */ if (status == 1) { unsigned n; for_each_boolean(n, tp) { if (!VALID_BOOLEAN(tp->Booleans[n])) tp->Booleans[n] = FALSE; } for_each_string(n, tp) { if (tp->Strings[n] == CANCELLED_STRING) tp->Strings[n] = ABSENT_STRING; } }
static int grab_entry(const char *const tn, TERMTYPE *const tp) /* return 1 if entry found, 0 if not found, -1 if database not accessible */ { char filename[PATH_MAX]; int status; int _nc_read_bsd_terminfo_entry(const char *, TERMTYPE *); /* XXX */ #ifdef __OpenBSD__ if ((status = _nc_read_bsd_terminfo_entry(tn, tp)) == 1) return(1); #endif /* __OpenBSD__ */ if ((status = _nc_read_entry(tn, filename, tp)) == 1) return(1); #ifndef PURE_TERMINFO /* * Try falling back on the termcap file. Note: allowing this call * links the entire terminfo/termcap compiler into the startup code. * It's preferable to build a real terminfo database and use that. */ status = _nc_read_termcap_entry(tn, tp); #endif /* PURE_TERMINFO */ return(status); }