Module Name:    src
Committed By:   roy
Date:           Fri Feb  5 19:21:02 UTC 2010

Modified Files:
        src/lib/libterminfo: term.c terminfo.5

Log Message:
Don't look in /etc for a terminfo database.
Don't report the rescue database if we did not find the terminal in
there AND we were able to access prior databases.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libterminfo/term.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/terminfo.5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libterminfo/term.c
diff -u src/lib/libterminfo/term.c:1.3 src/lib/libterminfo/term.c:1.4
--- src/lib/libterminfo/term.c:1.3	Fri Feb  5 12:31:56 2010
+++ src/lib/libterminfo/term.c	Fri Feb  5 19:21:02 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: term.c,v 1.3 2010/02/05 12:31:56 roy Exp $ */
+/* $NetBSD: term.c,v 1.4 2010/02/05 19:21:02 roy Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: term.c,v 1.3 2010/02/05 12:31:56 roy Exp $");
+__RCSID("$NetBSD: term.c,v 1.4 2010/02/05 19:21:02 roy Exp $");
 
 #include <sys/stat.h>
 
@@ -44,7 +44,8 @@
 #include <term_private.h>
 #include <term.h>
 
-#define TERMINFO_DIRS "/usr/share/misc/terminfo:/etc/terminfo:/rescue/terminfo"
+#define TERMINFO_DIRS		"/usr/share/misc/terminfo"
+#define TERMINFO_RESCUE		"/rescue/terminfo"
 
 static char database[PATH_MAX];
 static char pathbuf[PATH_MAX];
@@ -283,6 +284,7 @@
 	_DIAGASSERT(term != NULL);
 	_DIAGASSERT(name != NULL);
 
+	database[0] = '\0';
 	_ti_database = NULL;
 	e = getenv("TERMINFO");
 	if (e != NULL)
@@ -295,8 +297,18 @@
 		if (r == 1)
 			return 1;
 	}
-	
-	return _ti_dbgettermp(term, TERMINFO_DIRS, name, flags);
+
+	r = _ti_dbgettermp(term, TERMINFO_DIRS, name, flags);
+	if (r == 1)
+		return 1;
+
+	/* If we don't find the term in the rescue db and there is
+	 * no error, then report the last database accessed. */
+	strlcpy(h, database, sizeof(h));
+	r = _ti_dbgetterm(term, TERMINFO_RESCUE, name, flags);
+	if (r == 0 && h[0] != '\0')
+		strlcpy(database, h, sizeof(h));
+	return r;
 }
 
 void

Index: src/lib/libterminfo/terminfo.5
diff -u src/lib/libterminfo/terminfo.5:1.4 src/lib/libterminfo/terminfo.5:1.5
--- src/lib/libterminfo/terminfo.5:1.4	Fri Feb  5 09:42:21 2010
+++ src/lib/libterminfo/terminfo.5	Fri Feb  5 19:21:02 2010
@@ -1,7 +1,7 @@
 .\"DO NOT EDIT
 .\"Automatically generated from termcap.5.in
 .\"
-.\"	$NetBSD: terminfo.5,v 1.4 2010/02/05 09:42:21 roy Exp $
+.\"	$NetBSD: terminfo.5,v 1.5 2010/02/05 19:21:02 roy Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -669,18 +669,14 @@
 .Pa $HOME/.terminfo.db ,
 followed by
 .Pa /usr/share/misc/terminfo.db ,
-followed by
-.Pa /rescue/terminfo.db
 and
-.Pa /etc/terminfo.db .
+.Pa /rescue/terminfo.db .
 .Sh FILES
 .Bl -tag -width /usr/share/misc/terminfo.db -compact
 .It Pa $HOME/.terminfo.db
 Database of terminal descriptions for personal use.
-.It Pa /etc/terminfo.db
-Database of terminal descriptions for use during boot or single user.
 .It Pa /rescue/terminfo.db
-Database of terminal descriptions for use when rescuing the system.
+Small database of terminal descriptions for use when rescuing the system.
 .It Pa /usr/share/misc/terminfo
 File containing terminal descriptions.
 .It Pa /usr/share/misc/terminfo.db

Reply via email to