Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libterminfo Don't look in /etc for a terminfo database.



details:   https://anonhg.NetBSD.org/src/rev/033221378bc2
branches:  trunk
changeset: 751494:033221378bc2
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Feb 05 19:21:02 2010 +0000

description:
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.

diffstat:

 lib/libterminfo/term.c     |  22 +++++++++++++++++-----
 lib/libterminfo/terminfo.5 |  10 +++-------
 2 files changed, 20 insertions(+), 12 deletions(-)

diffs (90 lines):

diff -r e02d3359c625 -r 033221378bc2 lib/libterminfo/term.c
--- a/lib/libterminfo/term.c    Fri Feb 05 19:08:25 2010 +0000
+++ b/lib/libterminfo/term.c    Fri Feb 05 19:21:02 2010 +0000
@@ -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
diff -r e02d3359c625 -r 033221378bc2 lib/libterminfo/terminfo.5
--- a/lib/libterminfo/terminfo.5        Fri Feb 05 19:08:25 2010 +0000
+++ b/lib/libterminfo/terminfo.5        Fri Feb 05 19:21:02 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index