Index: src/vtetc.c
===================================================================
--- src/vtetc.c	(revision 1887)
+++ src/vtetc.c	(working copy)
@@ -21,521 +21,53 @@
 #include <stdlib.h>
 #include <glib.h>
 
+#ifdef HAVE_TERMCAP
+#include <termcap.h>
+#else
+#include <term.h>
+#endif
+
 #include "vtetc.h"
 
-/*
- * --- a termcap file is represented by a simple tree ---
- */
-typedef struct _vte_termcap
-{
-  GMappedFile *file;
-  GTree *tree;
-  const char *end;
-} VteTermcap;
 
-/* a special strcmp that treats any character in
- * its third argument (plus '\0') as end of
- * string.
- *
- *  we have to be a little bit careful, however.
- *  note that '=' < 'A' < '|' and consider the
- *  following three strings with "=|" given as
- *  the 3rd argument:
- *
- *  foo=
- *  fooA
- *  foo|
- *
- *  if we just do the normal *a - *b thing when
- *  the strings don't match then we will find
- *
- *      "foo=" < "fooA"
- *
- *  and
- *
- *      "foo|" > "fooA"
- *
- *  but of course,
- *
- *      "foo=" == "foo|"
- *
- *  which means that our ordering isn't proper
- *  which may cause odd things to happen inside of
- *  the tree.  for this reason, all of the
- *  terminating characters are treated as '\0' for
- *  purposes of deciding greater or less than.
- *
- *  note: if anything in this file should be
- *        micro-optimised then it is probably
- *        this function!
- */
-static int
-_vte_termcap_strcmp (const char *a,
-                     const char *b,
-                     const char *enders)
-{
-  /* note: strchr on '\0' returns the
-   * end of the string (not NULL)
-   */
-
-  while (!strchr (enders, *a))
-  {
-    if (*a != *b)
-    {
-      /* we're in the loop so we know that *a is not a terminator.
-       * but maybe *b is?
-       */
-      if (strchr (enders, *b))
-        return *a - '\0';
-      else
-        /* b is not a terminator.  proceed normally. */
-        return *a - *b;
-    }
-    a++;
-    b++;
-  }
-
-  /* *a is a terminator for sure, but maybe *b is too. */
-  if (strchr (enders, *b))
-    /* b is too, so we have a match. */
-    return 0;
-
-  /* else, since *a is a terminator character and *b is not, *a is
-   * less than *b. */
-  return -1;
-}
-
-/*
- * --- routines for searching the tree ---
- */
-static const char *
-_vte_termcap_find_start (VteTermcap *termcap,
-                         const char *tname,
-                         const char *cap)
-{
-  const char *contents;
-  const char *start;
-  char *chain;
-
-  /* find the terminal */
-  contents = g_tree_lookup (termcap->tree, tname);
-
-  if (contents == NULL)
-    return NULL;
-
-  start = contents;
-  while (contents != termcap->end)
-  {
-    if (*contents == '\\' &&
-        contents + 1 != termcap->end &&
-        contents[1] == '\n')
-    {
-      /* we've hit \ at the end of a line.  skip. */
-      contents++;
-    }
-    else if (*contents == ':' || *contents == '\n')
-    {
-      if (!_vte_termcap_strcmp (start, cap, "=#:\n"))
-        return start;
-
-      start = contents + 1;
-      if (*contents == '\n')
-        break;
-    }
-
-    contents++;
-  }
-
-  /* else, try to find it in the term listed in our 'tc' entry.
-   * obviously, don't recurse when we're trying to find "tc"
-   * itself else we infinite loop.
-   */
-  if (!strcmp (cap, "tc"))
-    return NULL;
-
-  chain = _vte_termcap_find_string (termcap, tname, "tc");
-  if (chain[0])
-    start = _vte_termcap_find_start (termcap, chain, cap);
-  g_free (chain);
-
-  return start;
-}
-
-static int
-_vte_termcap_unescape_string(const char *string, char *result)
-{
-  int value = -1;
-  int length = 0;
-
-  while (TRUE)
-  {
-    /* Each time through the loop puts a value into 'value' if it
-     * wants to have it written into the string.  We do the write
-     * here because it is complicated (check for NULL result, etc)
-     *
-     * We finish and return the length whenb value is 0.
-     */
-    if (value >= 0)
-    {
-      if (result != NULL)
-        result[length] = value;
-      length++;
-
-      if (value == 0)
-        return length;
-
-      value = -1;
-    }
-
-    /* Now, decide what value should be for the next iteration.
-     * Here, "continue;" means "I've possibly set 'value' and I want
-     * to continue looking at the string starting at the next
-     * character pointed to by 'string'.
-     */
-    switch (*string++)
-    {
-      case '\n':
-      case '\0':
-      case ':':
-        value = 0;
-        continue;
-
-      case '\\':
-        switch (*string++)
-        {
-          case '\n':
-            while (*string == ' ' || *string == '\t')
-              string++;
-            continue;
-          case 'E':
-          case 'e':
-            value = 27;
-            continue;
-          case 'n':
-            value = 10;
-            continue;
-          case 'r':
-            value = 13;
-            continue;
-          case 't':
-            value = 8;
-            continue;
-          case 'b':
-            value = 9;
-            continue;
-          case 'f':
-            value = 12;
-            continue;
-          case '0':
-          case '1':
-            value = strtol(string - 1, (void *) &string, 8);
-            continue;
-          default:
-            /* invalid escape sequence.  write the \ and
-             * continue as if we never saw it...
-             */
-            value = '\\';
-            string--;
-            continue;
-        }
-
-      case '^':
-        if (*string >= 'A' && *string <= 'Z')
-        {
-          value = *string++ - '@';
-          break;
-        }
-
-        /* else, invalid control sequnce.  write the ^
-         * and continue as if we never saw it...
-         */
-
-      default:
-        /* else, the value is this character and the pointer has
-         * already been advanced to the next character. */
-        value = string[-1];
-    }
-  }
-}
-
 char *
-_vte_termcap_find_string_length (VteTermcap *termcap,
-                                 const char *tname,
+_vte_termcap_find_string_length (const char *tname,
                                  const char *cap,
                                  gssize *length)
 {
-  const char *result = _vte_termcap_find_start (termcap, tname, cap);
-  char *string;
+  char * ret = _vte_termcap_find_string (tname, cap);
 
-  if (result == NULL || result[2] != '=')
-  {
-    *length = 0;
-    return g_strdup ("");
-  }
-
-  result += 3;
-
-  *length = _vte_termcap_unescape_string (result, NULL);
-  string = g_malloc (*length);
-  _vte_termcap_unescape_string (result, string);
-
-  (*length)--;
-
-  return string;
+  *length = strlen (ret);
+  return ret;
 }
 
 char *
-_vte_termcap_find_string (VteTermcap *termcap,
-                          const char *tname,
+_vte_termcap_find_string (const char *tname,
                           const char *cap)
 {
-  gssize length;
+  const char * ret;
 
-  return _vte_termcap_find_string_length (termcap, tname, cap, &length);
+  tgetent (NULL, tname);
+  ret = tgetstr (cap, NULL);
+  return g_strdup (ret ? ret : "");
 }
 
 long
-_vte_termcap_find_numeric (VteTermcap *termcap,
-                           const char *tname,
+_vte_termcap_find_numeric (const char *tname,
                            const char *cap)
 {
-  const char *result = _vte_termcap_find_start (termcap, tname, cap);
-  long value;
-  char *end;
-
-  if (result == NULL || result[2] != '#')
-    return 0;
-
-  result += 3;
-
-  value = strtol (result, &end, 0);
-  if (*end != ':' && *end != '\0' && *end != '\n')
-    return 0;
-
-  return value;
+  tgetent (NULL, tname);
+  return tgetnum (cap);
 }
 
 gboolean
-_vte_termcap_find_boolean (VteTermcap *termcap,
-                           const char *tname,
+_vte_termcap_find_boolean (const char *tname,
                            const char *cap)
 {
-  const char *result = _vte_termcap_find_start (termcap, tname, cap);
-
-  if (result == NULL)
-    return 0;
-
-  result += 2;
-
-  if (*result != ':' && *result != '\0' && *result != '\n')
-    return FALSE;
-
-  return TRUE;
+  tgetent (NULL, tname);
+  return tgetflag (cap);
 }
 
-/*
- * --- routines for building the tree from the file ---
- */
-static void
-_vte_termcap_parse_entry (GTree *termcap, const char **cnt, const char *end)
-{
-  gboolean seen_content;
-  const char *contents;
-  const char *start;
-  const char *caps;
-
-  contents = *cnt;
-
-  /* look for the start of the capabilities.
-   */
-  caps = contents;
-  while (caps != end)
-    if (*caps == ':')
-      break;
-    else
-      caps++;
-
-  if (*caps != ':')
-    return;
-
-  /* parse all of the aliases and insert one item into the termcap
-   * tree for each alias, pointing it to our caps.
-   */
-  seen_content = FALSE;
-  start = contents;
-  while (contents != end)
-  {
-    /* 
-    if (contents == end)
-    {
-       * we can't deal with end of file directly following a
-       * terminal name without any delimiters or even a newline.
-       * but honestly, what did they expect?  end of file without
-       * newline in the middle of a terminal alias with no
-       * capability definitions?  i'll doubt they notice that
-       * anything is missing.
-    }
-    */
-
-    if (*contents == '\\' && contents + 1 != end && contents[1] == '\n')
-    {
-      /* we've hit \ at the end of a line.  skip. */
-      contents++;
-    }
-    else if (*contents == '|' || *contents == ':' || *contents == '\n')
-    {
-      /* we wait to find the terminator before putting anything in
-       * the tree to ensure that _vte_termcap_strcmp will always
-       * terminate.  we also only add the alias if we've seen
-       * actual characters (not just spaces, continuations, etc)
-       */
-      if (seen_content)
-        g_tree_insert (termcap, (gpointer) start, (gpointer) caps);
-      start = contents + 1;
-      seen_content = FALSE;
-
-      /* we've either hit : and need to move on to capabilities or
-       * end of line and then there are no capabilities for this
-       * terminal.  any aliases have already been added to the tree
-       * so we can just move on.  if it was '\n' then the next while
-       * loop will exit immediately.
-       */
-      if (*contents == ':' || *contents == '\n')
-        break;
-    }
-    else if (*contents != ' ' && *contents != '\t')
-      seen_content = TRUE;
-
-    contents++;
-  }
-
-  /* we've processed all of the aliases.  now skip past the capabilities
-   * so that we're ready to go on the next entry. */
-  while (contents != end)
-  {
-    if (*contents == '\\' && contents + 1 != end && contents[1] == '\n')
-    {
-      /* we've hit \ at the end of a line.  skip. */
-      contents++;
-    }
-    else if (*contents == '\n')
-      break;
-
-    contents++;
-  }
-
-  *cnt = contents;
-}
-
-static GTree *
-_vte_termcap_parse_file (const char *contents, int length)
-{
-  const char *end = contents + length;
-  GTree *termcap;
-
-  /* this tree contains terminal alias names which in a proper
-   * termcap file will always be followed by : or |.  we
-   * include \n to be extra-permissive. \0 is here to allow
-   * us to notice the end of strings passed to us by vte.
-   */
-  termcap = g_tree_new_full ((GCompareDataFunc) _vte_termcap_strcmp,
-                             (gpointer)":|\n", NULL, NULL);
-
-  while (contents != end)
-  {
-    switch (*contents++)
-    {
-      /* comments */
-      case '#':
-        /* eat up to (but not) the \n */
-        while (contents != end && *contents != '\n')
-          contents++;
-
-      /* whitespace */
-      case ' ':
-      case '\t':
-      case '\n':
-        continue;
-
-      default:
-        /* bring back the character */
-        contents--;
-
-        /* parse one entry (ie: one line) */
-        _vte_termcap_parse_entry (termcap, &contents, end);
-    }
-  }
-
-  return termcap;
-}
-
-static VteTermcap *
-_vte_termcap_create (const char *filename)
-{
-  const char *contents;
-  VteTermcap *termcap;
-  GMappedFile *file;
-  int length;
-
-  file = g_mapped_file_new (filename, FALSE, NULL);
-  
-  if (file == NULL)
-    return NULL;
-
-  contents = g_mapped_file_get_contents (file);
-  length = g_mapped_file_get_length (file);
-
-  termcap = g_slice_new (VteTermcap);
-  termcap->file = file;
-  termcap->tree = _vte_termcap_parse_file (contents, length);
-  termcap->end = contents + length;
-
-  return termcap;
-}
-
-static void
-_vte_termcap_destroy (VteTermcap *termcap)
-{
-  g_tree_destroy (termcap->tree);
-  g_mapped_file_free (termcap->file);
-  g_slice_free (VteTermcap, termcap);
-}
-
-/*
- * --- cached interface to create/destroy termcap trees ---
- */
-static GStaticMutex _vte_termcap_mutex = G_STATIC_MUTEX_INIT;
-static GCache *_vte_termcap_cache = NULL;
-
-VteTermcap *
-_vte_termcap_new(const char *filename)
-{
-  VteTermcap *result;
-
-  g_static_mutex_lock (&_vte_termcap_mutex);
-
-  if (_vte_termcap_cache == NULL)
-    _vte_termcap_cache = g_cache_new((GCacheNewFunc) _vte_termcap_create,
-                                     (GCacheDestroyFunc) _vte_termcap_destroy,
-                                     (GCacheDupFunc) g_strdup,
-                                     (GCacheDestroyFunc) g_free,
-                                     g_str_hash, g_direct_hash, g_str_equal);
-
-  result = g_cache_insert (_vte_termcap_cache, (gpointer) filename);
-
-  g_static_mutex_unlock (&_vte_termcap_mutex);
-
-  return result;
-}
-
-void
-_vte_termcap_free (VteTermcap *termcap)
-{
-  g_static_mutex_lock (&_vte_termcap_mutex);
-  g_cache_remove (_vte_termcap_cache, termcap);
-  g_static_mutex_unlock (&_vte_termcap_mutex);
-}
-
 #ifdef TERMCAP_MAIN
 #include <stdio.h>
 
Index: src/keymap.c
===================================================================
--- src/keymap.c	(revision 1887)
+++ src/keymap.c	(working copy)
@@ -991,7 +991,6 @@
 		gboolean vt220_mode,
 		gboolean app_cursor_keys,
 		gboolean app_keypad_keys,
-		struct _vte_termcap *termcap,
 		const char *terminal,
 		char **normal,
 		gssize *normal_length,
@@ -1140,8 +1139,7 @@
 			return;
 		} else {
 			termcap_special = entries[i].special;
-			cap = _vte_termcap_find_string(termcap,
-						       terminal,
+			cap = _vte_termcap_find_string(terminal,
 						       entries[i].special);
 			if (cap != NULL) {
 				*special = NULL;
Index: src/vtetc.h
===================================================================
--- src/vtetc.h	(revision 1887)
+++ src/vtetc.h	(working copy)
@@ -26,36 +26,24 @@
 
 G_BEGIN_DECLS
 
-struct _vte_termcap;
-
-/* Create a new termcap structure. */
-struct _vte_termcap *_vte_termcap_new(const char *filename);
-
-/* Free a termcap structure. */
-void _vte_termcap_free(struct _vte_termcap *termcap);
-
 /* Read a boolean capability for a given terminal. */
-gboolean _vte_termcap_find_boolean(struct _vte_termcap *termcap,
-				   const char *tname, const char *cap);
+gboolean _vte_termcap_find_boolean(const char *tname, const char *cap);
 
 /* Read a numeric capability for a given terminal. */
-long _vte_termcap_find_numeric(struct _vte_termcap *termcap, const char *tname,
-			       const char *cap);
+long _vte_termcap_find_numeric(const char *tname, const char *cap);
 
 /* Read a string capability for a given terminal.  The returned string should
  * be freed with g_free(). */
-char *_vte_termcap_find_string(struct _vte_termcap *termcap, const char *tname,
-			       const char *cap);
+char *_vte_termcap_find_string(const char *tname, const char *cap);
 
 /* Read a string capability for a given terminal, and return the length of
  * the result in addition to the result itself.  The returned string should
  * be freed with g_free(). */
-char *_vte_termcap_find_string_length(struct _vte_termcap *termcap,
-				      const char *tname,
-				      const char *cap, gssize *length);
+char *_vte_termcap_find_string_length(const char *tname, const char *cap,
+                                      gssize *length);
 
 /* Preprocess a termcap-style string, expanding any escape sequences. */
-void _vte_termcap_strip(const char *termcap, char **stripped, gssize *len);
+void _vte_termcap_strip(char **stripped, gssize *len);
 
 G_END_DECLS
 
Index: src/keymap.h
===================================================================
--- src/keymap.h	(revision 1887)
+++ src/keymap.h	(working copy)
@@ -40,7 +40,6 @@
 		     gboolean vt220_mode,
 		     gboolean app_cursor_keys,
 		     gboolean app_keypad_keys,
-		     struct _vte_termcap *termcap,
 		     const char *term,
 		     char **normal,
 		     gssize *normal_length,
Index: src/matcher.c
===================================================================
--- src/matcher.c	(revision 1887)
+++ src/matcher.c	(working copy)
@@ -53,49 +53,14 @@
 
 /* Loads all sequences into matcher */
 static void
-_vte_matcher_init(struct _vte_matcher *matcher, const char *emulation,
-		  struct _vte_termcap *termcap)
+_vte_matcher_init(struct _vte_matcher *matcher, const char *emulation)
 {
 	const char *code, *value;
 	gboolean found_cr = FALSE, found_lf = FALSE;
-	gssize stripped_length;
-	char *stripped;
 	int i;
 
 	_vte_debug_print(VTE_DEBUG_LIFECYCLE, "_vte_matcher_init()\n");
 
-	if (termcap != NULL) {
-		/* Load the known capability strings from the termcap
-		 * structure into the table for recognition. */
-		for (i = 0;
-				_vte_terminal_capability_strings[i].capability[0];
-				i++) {
-			if (_vte_terminal_capability_strings[i].key) {
-				continue;
-			}
-			code = _vte_terminal_capability_strings[i].capability;
-			stripped = _vte_termcap_find_string_length(termcap,
-					emulation,
-					code,
-					&stripped_length);
-			if (stripped[0] != '\0') {
-				_vte_matcher_add(matcher,
-						stripped, stripped_length,
-						code, 0);
-				if (stripped[0] == '\r') {
-					found_cr = TRUE;
-				} else
-					if (stripped[0] == '\n') {
-						if (strcmp(code, "sf") == 0 ||
-								strcmp(code, "do") == 0) {
-							found_lf = TRUE;
-						}
-					}
-			}
-			g_free(stripped);
-		}
-	}
-
 	/* Add emulator-specific sequences. */
 	if (strstr(emulation, "xterm") || strstr(emulation, "dtterm")) {
 		/* Add all of the xterm-specific stuff. */
@@ -164,7 +129,7 @@
 
 /* Create and init matcher. */
 struct _vte_matcher *
-_vte_matcher_new(const char *emulation, struct _vte_termcap *termcap)
+_vte_matcher_new(const char *emulation)
 {
 	struct _vte_matcher *ret = NULL;
 	g_static_mutex_lock(&_vte_matcher_mutex);
@@ -185,7 +150,7 @@
 	if (ret->match == NULL) {
 		ret->impl = ret->impl->klass->create();
 		ret->match = ret->impl->klass->match;
-		_vte_matcher_init(ret, emulation, termcap);
+		_vte_matcher_init(ret, emulation);
 	}
 
 	g_static_mutex_unlock(&_vte_matcher_mutex);
Index: src/matcher.h
===================================================================
--- src/matcher.h	(revision 1887)
+++ src/matcher.h	(working copy)
@@ -53,8 +53,7 @@
 };
 
 /* Create and init matcher. */
-struct _vte_matcher *_vte_matcher_new(const char *emulation,
-				      struct _vte_termcap *termcap);
+struct _vte_matcher *_vte_matcher_new(const char *emulation);
 
 /* Free a matcher. */
 void _vte_matcher_free(struct _vte_matcher *matcher);
Index: src/vte.c
===================================================================
--- src/vte.c	(revision 1887)
+++ src/vte.c	(working copy)
@@ -1035,9 +1035,7 @@
 	}
 	terminal->pvt->tabstops = g_hash_table_new(NULL, NULL);
 	if (terminal->pvt->termcap != NULL) {
-		width = _vte_termcap_find_numeric(terminal->pvt->termcap,
-						  terminal->pvt->emulation,
-						  "it");
+		width = _vte_termcap_find_numeric(terminal->pvt->emulation, "it");
 	}
 	if (width == 0) {
 		width = VTE_TAB_WIDTH;
@@ -4333,7 +4331,6 @@
 					terminal->pvt->vt220_fkey_mode,
 					terminal->pvt->cursor_mode == VTE_KEYMODE_APPLICATION,
 					terminal->pvt->keypad_mode == VTE_KEYMODE_APPLICATION,
-					terminal->pvt->termcap,
 					terminal->pvt->emulation ?
 					terminal->pvt->emulation : vte_terminal_get_default_emulation(terminal),
 					&normal,
@@ -4404,8 +4401,7 @@
 		if (special != NULL && terminal->pvt->termcap != NULL) {
 			termcap = terminal->pvt->termcap;
 			tterm = terminal->pvt->emulation;
-			normal = _vte_termcap_find_string_length(termcap,
-								 tterm,
+			normal = _vte_termcap_find_string_length(tterm,
 								 special,
 								 &normal_length);
 			_vte_keymap_key_add_key_modifiers(keyval,
@@ -6995,37 +6991,30 @@
 	if (terminal->pvt->matcher != NULL) {
 		_vte_matcher_free(terminal->pvt->matcher);
 	}
-	terminal->pvt->matcher = _vte_matcher_new(emulation, terminal->pvt->termcap);
+	terminal->pvt->matcher = _vte_matcher_new(emulation);
 
 	if (terminal->pvt->termcap != NULL) {
 		/* Read emulation flags. */
-		terminal->pvt->flags.am = _vte_termcap_find_boolean(terminal->pvt->termcap,
-								    terminal->pvt->emulation,
+		terminal->pvt->flags.am = _vte_termcap_find_boolean(terminal->pvt->emulation,
 								    "am");
-		terminal->pvt->flags.bw = _vte_termcap_find_boolean(terminal->pvt->termcap,
-								    terminal->pvt->emulation,
+		terminal->pvt->flags.bw = _vte_termcap_find_boolean(terminal->pvt->emulation,
 								    "bw");
-		terminal->pvt->flags.LP = _vte_termcap_find_boolean(terminal->pvt->termcap,
-								    terminal->pvt->emulation,
+		terminal->pvt->flags.LP = _vte_termcap_find_boolean(terminal->pvt->emulation,
 								    "LP");
-		terminal->pvt->flags.ul = _vte_termcap_find_boolean(terminal->pvt->termcap,
-								    terminal->pvt->emulation,
+		terminal->pvt->flags.ul = _vte_termcap_find_boolean(terminal->pvt->emulation,
 								    "ul");
-		terminal->pvt->flags.xn = _vte_termcap_find_boolean(terminal->pvt->termcap,
-								    terminal->pvt->emulation,
+		terminal->pvt->flags.xn = _vte_termcap_find_boolean(terminal->pvt->emulation,
 								    "xn");
 
 		/* Resize to the given default. */
-		columns = _vte_termcap_find_numeric(terminal->pvt->termcap,
-						    terminal->pvt->emulation,
+		columns = _vte_termcap_find_numeric(terminal->pvt->emulation,
 						    "co");
 		if (columns <= 0) {
 			columns = VTE_COLUMNS;
 		}
 		terminal->pvt->default_column_count = columns;
 
-		rows = _vte_termcap_find_numeric(terminal->pvt->termcap,
-						 terminal->pvt->emulation,
+		rows = _vte_termcap_find_numeric(terminal->pvt->emulation,
 						 "li");
 		if (rows <= 0 ) {
 			rows = VTE_ROWS;
@@ -7115,16 +7104,7 @@
 
 	_vte_debug_print(VTE_DEBUG_MISC, "Loading termcap `%s'...",
 			terminal->pvt->termcap_path);
-	if (terminal->pvt->termcap != NULL) {
-		_vte_termcap_free(terminal->pvt->termcap);
-	}
-	terminal->pvt->termcap = _vte_termcap_new(terminal->pvt->termcap_path);
 	_vte_debug_print(VTE_DEBUG_MISC, "\n");
-	if (terminal->pvt->termcap == NULL) {
-		_vte_terminal_inline_error_message(terminal,
-				"Failed to load terminal capabilities from '%s'",
-				terminal->pvt->termcap_path);
-	}
 	if (reset) {
 		vte_terminal_set_emulation(terminal, terminal->pvt->emulation);
 	}
@@ -7762,9 +7742,6 @@
 	if (terminal->pvt->matcher != NULL) {
 		_vte_matcher_free(terminal->pvt->matcher);
 	}
-	if (terminal->pvt->termcap != NULL) {
-		_vte_termcap_free(terminal->pvt->termcap);
-	}
 
 	remove_update_timeout (terminal);
 
@@ -10200,7 +10177,6 @@
 				terminal->pvt->vt220_fkey_mode,
 				terminal->pvt->cursor_mode == VTE_KEYMODE_APPLICATION,
 				terminal->pvt->keypad_mode == VTE_KEYMODE_APPLICATION,
-				terminal->pvt->termcap,
 				terminal->pvt->emulation ?
 				terminal->pvt->emulation : vte_terminal_get_default_emulation(terminal),
 				&normal,
Index: src/vteseq.c
===================================================================
--- src/vteseq.c	(revision 1887)
+++ src/vteseq.c	(working copy)
@@ -2114,25 +2114,13 @@
 
 	/* Standout may be mapped to another attribute, so attempt to do
 	 * the Right Thing here. */
-	standout = _vte_termcap_find_string(terminal->pvt->termcap,
-					    terminal->pvt->emulation,
-					    "so");
+	standout = _vte_termcap_find_string(terminal->pvt->emulation, "so");
 	g_assert(standout != NULL);
-	blink = _vte_termcap_find_string(terminal->pvt->termcap,
-					 terminal->pvt->emulation,
-					 "mb");
-	bold = _vte_termcap_find_string(terminal->pvt->termcap,
-					terminal->pvt->emulation,
-					"md");
-	half = _vte_termcap_find_string(terminal->pvt->termcap,
-					terminal->pvt->emulation,
-					"mh");
-	reverse = _vte_termcap_find_string(terminal->pvt->termcap,
-					   terminal->pvt->emulation,
-					   "mr");
-	underline = _vte_termcap_find_string(terminal->pvt->termcap,
-					     terminal->pvt->emulation,
-					     "us");
+	blink = _vte_termcap_find_string(terminal->pvt->emulation, "mb");
+	bold = _vte_termcap_find_string(terminal->pvt->emulation, "md");
+	half = _vte_termcap_find_string(terminal->pvt->emulation, "mh");
+	reverse = _vte_termcap_find_string(terminal->pvt->emulation, "mr");
+	underline = _vte_termcap_find_string(terminal->pvt->emulation, "us");
 
 	/* If the standout sequence is the same as another sequence, do what
 	 * we'd do for that other sequence instead. */
@@ -2278,25 +2266,13 @@
 
 	/* Standout may be mapped to another attribute, so attempt to do
 	 * the Right Thing here. */
-	standout = _vte_termcap_find_string(terminal->pvt->termcap,
-				     terminal->pvt->emulation,
-				    "so");
+	standout = _vte_termcap_find_string(terminal->pvt->emulation, "so");
 	g_assert(standout != NULL);
-	blink = _vte_termcap_find_string(terminal->pvt->termcap,
-					 terminal->pvt->emulation,
-					 "mb");
-	bold = _vte_termcap_find_string(terminal->pvt->termcap,
-					terminal->pvt->emulation,
-					"md");
-	half = _vte_termcap_find_string(terminal->pvt->termcap,
-					terminal->pvt->emulation,
-					"mh");
-	reverse = _vte_termcap_find_string(terminal->pvt->termcap,
-					   terminal->pvt->emulation,
-					   "mr");
-	underline = _vte_termcap_find_string(terminal->pvt->termcap,
-					     terminal->pvt->emulation,
-					     "us");
+	blink = _vte_termcap_find_string(terminal->pvt->emulation, "mb");
+	bold = _vte_termcap_find_string(terminal->pvt->emulation, "md");
+	half = _vte_termcap_find_string(terminal->pvt->emulation, "mh");
+	reverse = _vte_termcap_find_string(terminal->pvt->emulation, "mr");
+	underline = _vte_termcap_find_string(terminal->pvt->emulation, "us");
 
 	/* If the standout sequence is the same as another sequence, do what
 	 * we'd do for that other sequence instead. */
Index: src/interpret.c
===================================================================
--- src/interpret.c	(revision 1887)
+++ src/interpret.c	(working copy)
@@ -39,7 +39,6 @@
 {
 	char *terminal = NULL;
 	struct _vte_matcher *matcher = NULL;
-	struct _vte_termcap *termcap = NULL;
 	struct _vte_buffer *buffer = NULL;
 	GArray *array;
 	int i, j, l;
@@ -71,15 +70,10 @@
 
 	g_type_init();
 	terminal = argv[1];
-	termcap = _vte_termcap_new(g_strdup_printf(DATADIR "/" PACKAGE
-						   "/termcap/%s", terminal));
-	if (termcap == NULL) {
-		termcap = _vte_termcap_new("/etc/termcap");
-	}
 	buffer = _vte_buffer_new();
 	array = g_array_new(FALSE, FALSE, sizeof(gunichar));
 
-	matcher = _vte_matcher_new(terminal, termcap);
+	matcher = _vte_matcher_new(terminal);
 
 	subst = _vte_iso2022_state_new(NULL, NULL, NULL);
 
@@ -161,7 +155,6 @@
 	_vte_iso2022_state_free(subst);
 	_vte_buffer_free(buffer);
 	g_array_free(array, TRUE);
-	_vte_termcap_free(termcap);
 	_vte_matcher_free(matcher);
 	return 0;
 }
