/****************************************************************************
- * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: read_termcap.c,v 1.61 2003/11/08 20:22:45 tom Exp $")
+MODULE_ID("$Id: read_termcap.c,v 1.67 2005/06/04 21:49:20 tom Exp $")
#if !PURE_TERMINFO
#define TC_SYS_ERR -3
#define TC_REF_LOOP -4
-static char *
+static NCURSES_CONST char *
get_termpath(void)
{
- char *result;
+ NCURSES_CONST char *result;
if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0)
result = TERMPATH;
if (*s == '\0') {
break;
} else if (*s++ == '\n') {
- while (isspace(*s))
+ while (isspace(UChar(*s)))
s++;
} else {
found = TRUE;
break;
}
base = s;
- } else if (isgraph(ch)) {
+ } else if (isgraph(UChar(ch))) {
found = TRUE;
}
}
while ((ch = *src++) != '\0') {
if (ch == '\\' && *src == '\n') {
- while (isspace(*src))
+ while (isspace(UChar(*src)))
src++;
continue;
}
char pathbuf[PBUFSIZ]; /* holds raw path of filenames */
char *pathvec[PVECSIZ]; /* to point to names in pathbuf */
char **pvec; /* holds usable tail of path vector */
- char *termpath;
+ NCURSES_CONST char *termpath;
string_desc desc;
fname = pathvec;
#endif /* !USE_GETCAP */
NCURSES_EXPORT(int)
-_nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp)
+_nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp)
{
int found = FALSE;
ENTRY *ep;
* Probably /etc/termcap is a symlink to /usr/share/misc/termcap.
* Avoid reading the same file twice.
*/
-#ifdef HAVE_LINK
+#if HAVE_LINK
for (j = 0; j < filecount; j++) {
bool omit = FALSE;
if (stat(termpaths[j], &test_stat[j]) != 0
return (ERR);
/* resolve all use references */
- _nc_resolve_uses(TRUE);
+ _nc_resolve_uses2(TRUE, FALSE);
/* find a terminal matching tn, if we can */
#if USE_GETCAP_CACHE
for_entry_list(ep) {
if (_nc_name_match(ep->tterm.term_names, tn, "|:")) {
/*
- * Make a local copy of the terminal capabilities. Free all
- * entry storage except the string table for the loaded type
- * (which we disconnected from the list by NULLing out
- * ep->tterm.str_table above).
+ * Make a local copy of the terminal capabilities, delinked
+ * from the list.
*/
*tp = ep->tterm;
- ep->tterm.str_table = (char *) 0;
+ _nc_delink_entry(_nc_head, &(ep->tterm));
+ free(ep);
/*
* OK, now try to write the type to user's terminfo directory.
}
#endif
- _nc_free_entries(_nc_head);
return (found);
}
#else