summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@src.gnome.org>2002-05-01 15:40:13 +0000
committerNalin Dahyabhai <nalin@src.gnome.org>2002-05-01 15:40:13 +0000
commit92d904d5dd39221b2ab942c2cc59056a50b357cc (patch)
treecb3b8cc5dfd5b88d6d805597010f94a7614ada6f
parent4461f119849629f1ecca1003e78113d8cc3aa8fc (diff)
Try @pkgdatadir@/termcap/$TERM when reading termcap files. This fixes thevte_0_3_2
* src/vte.c: Try @pkgdatadir@/termcap/$TERM when reading termcap files. This fixes the app on systems with no /etc/termcap, and also speeds up loads and reduces memory consumption for xterm-color at the expense of making on-the-fly emulation changes impossible. Don't xor reverse with itself when drawing characters (this broke when snapshotting was added). * termcaps/Makefile.am, termcaps/xterm-color: include a default termcap for xterm-color. * src/termcap.c src/termcap.h: make _find_boolean return a gboolean instead of an int.
-rw-r--r--ChangeLog11
-rw-r--r--Makefile.am2
-rw-r--r--configure.in10
-rw-r--r--src/termcap.c15
-rw-r--r--src/termcap.h4
-rw-r--r--src/vte.c18
-rw-r--r--termcaps/Makefile.am3
-rw-r--r--termcaps/xterm-color27
-rw-r--r--vte.spec6
9 files changed, 85 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 55b2c95..fc0cc77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-05-01 nalin
+ * src/vte.c: Try @pkgdatadir@/termcap/$TERM when reading termcap files.
+ This fixes the app on systems with no /etc/termcap, and also speeds up
+ loads and reduces memory consumption for xterm-color at the expense of
+ making on-the-fly emulation changes impossible. Don't xor reverse with
+ itself when drawing characters (this broke when snapshotting was added).
+ * termcaps/Makefile.am, termcaps/xterm-color: include a default termcap
+ for xterm-color.
+ * src/termcap.c src/termcap.h: make _find_boolean return a gboolean
+ instead of an int.
+
2002-04-30 nalin
* src/vte.c: Disconnect from toplevel window_configure events at
finalize-time.
diff --git a/Makefile.am b/Makefile.am
index f4069e0..db3d1ec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = src
+SUBDIRS = src termcaps
EXTRA_DIST = HACKING vte.spec vte.pc.in
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/configure.in b/configure.in
index b2944f5..0af3dff 100644
--- a/configure.in
+++ b/configure.in
@@ -51,5 +51,13 @@ fi
if test x$VTE_DEBUG = x1 ; then
AC_DEFINE(VTE_DEBUG,,[Enable debugging of unrecognized sequences.])
fi
+
+mydatadir=`eval echo $datadir`
+if test x$prefix = xNONE ; then
+ mydatadir=`echo $mydatadir | sed s,NONE,$ac_default_prefix,g`
+fi
+AC_DEFINE_UNQUOTED(DATADIR,"$mydatadir",
+ [The location where arch-independent package-specific data can be found.])
+
AM_CONFIG_HEADER(config.h)
-AC_OUTPUT([Makefile src/Makefile vte.pc])
+AC_OUTPUT([Makefile src/Makefile termcaps/Makefile vte.pc])
diff --git a/src/termcap.c b/src/termcap.c
index 6096f79..79839d5 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -397,6 +397,12 @@ vte_termcap_find_l(struct vte_termcap *termcap, const char *tname, ssize_t len,
char ttname[len + 1];
ssize_t clen;
+ g_return_val_if_fail(termcap != NULL, "");
+ g_return_val_if_fail(tname != NULL, "");
+ g_return_val_if_fail(len > 0, "");
+ g_return_val_if_fail(cap != NULL, "");
+ g_return_val_if_fail(strlen(cap) > 0, "");
+
/* Find the entry by this name. */
memcpy(ttname, tname, len);
ttname[len] = '\0';
@@ -484,19 +490,21 @@ static const char *
vte_termcap_find(struct vte_termcap *termcap,
const char *tname, const char *cap)
{
+ g_return_val_if_fail(termcap != NULL, "");
return vte_termcap_find_l(termcap, tname, strlen(tname), cap);
}
-TERMCAP_MAYBE_STATIC int
+TERMCAP_MAYBE_STATIC gboolean
vte_termcap_find_boolean(struct vte_termcap *termcap, const char *tname,
const char *cap)
{
const char *val;
+ g_return_val_if_fail(termcap != NULL, FALSE);
val = vte_termcap_find(termcap, tname, cap);
if ((val != NULL) && (val[0] != '\0')) {
- return 1;
+ return TRUE;
}
- return 0;
+ return FALSE;
}
TERMCAP_MAYBE_STATIC long
@@ -507,6 +515,7 @@ vte_termcap_find_numeric(struct vte_termcap *termcap, const char *tname,
char *p;
ssize_t l;
long ret;
+ g_return_val_if_fail(termcap != NULL, 0);
val = vte_termcap_find(termcap, tname, cap);
if ((val != NULL) && (val[0] != '\0')) {
l = strlen(cap);
diff --git a/src/termcap.h b/src/termcap.h
index d1928ca..2e8e044 100644
--- a/src/termcap.h
+++ b/src/termcap.h
@@ -32,8 +32,8 @@ struct vte_termcap *vte_termcap_new(const char *filename);
void vte_termcap_free(struct vte_termcap *termcap);
/* Read a boolean capability for a given terminal. */
-int vte_termcap_find_boolean(struct vte_termcap *termcap, const char *tname,
- const char *cap);
+gboolean vte_termcap_find_boolean(struct vte_termcap *termcap,
+ 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,
diff --git a/src/vte.c b/src/vte.c
index 126835e..7fdf525 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -21,6 +21,7 @@
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/param.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <errno.h>
#include <fcntl.h>
@@ -64,6 +65,7 @@
#define VTE_DEF_BG 17
#define VTE_SATURATION_MAX 10000
#define VTE_SCROLLBACK_MIN 100
+#define VTE_DEFAULT_EMULATION "xterm-color"
/* The structure we use to hold characters we're supposed to display -- this
* includes any supported visible attributes. */
@@ -5255,7 +5257,7 @@ vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation)
/* Set the emulation type, for reference. */
if (emulation == NULL) {
- emulation = "xterm-color";
+ emulation = VTE_DEFAULT_EMULATION;
}
quark = g_quark_from_string(emulation);
terminal->pvt->terminal = g_quark_to_string(quark);
@@ -5329,8 +5331,18 @@ vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation)
static void
vte_terminal_set_termcap(VteTerminal *terminal, const char *path)
{
+ struct stat st;
+ char path_default[PATH_MAX];
+
if (path == NULL) {
- path = "/etc/termcap";
+ snprintf(path_default, sizeof(path_default),
+ DATADIR "/" PACKAGE "/termcap/%s",
+ terminal->pvt->terminal ?: VTE_DEFAULT_EMULATION);
+ if (stat(path_default, &st) == 0) {
+ path = path_default;
+ } else {
+ path = "/etc/termcap";
+ }
}
terminal->pvt->termcap_path = g_quark_to_string(g_quark_from_string(path));
#ifdef VTE_DEBUG
@@ -5838,7 +5850,7 @@ vte_terminal_determine_colors(VteTerminal *terminal,
{
/* Determine what the foreground and background colors for rendering
* text should be. */
- if (reverse ^ (cell && cell->reverse)) {
+ if (reverse) {
*fore = cell ? cell->back : VTE_DEF_BG;
*back = cell ? cell->fore : VTE_DEF_FG;
} else {
diff --git a/termcaps/Makefile.am b/termcaps/Makefile.am
new file mode 100644
index 0000000..ce2f1b1
--- /dev/null
+++ b/termcaps/Makefile.am
@@ -0,0 +1,3 @@
+EXTRA_DIST = xterm-color
+termcapdir = $(pkgdatadir)/termcap
+termcap_DATA = xterm-color
diff --git a/termcaps/xterm-color b/termcaps/xterm-color
new file mode 100644
index 0000000..f0b0840
--- /dev/null
+++ b/termcaps/xterm-color
@@ -0,0 +1,27 @@
+# This is a cut-down version of the termcap file from my box.
+
+xterm-color|generic "ANSI" color xterm (X Window System):\
+ :Co#8:NC@:pa#64:\
+ :AB=\E[4%dm:AF=\E[3%dm:op=\E[m:tc=xterm-r6:
+
+xterm-r6|xterm-old|xterm X11R6 version:\
+ :am:km:mi:ms:xn:\
+ :co#80:it#8:li#24:\
+ :@7=\E[4~:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:\
+ :F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\
+ :F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:\
+ :Km=\E[M:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\
+ :bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\
+ :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:eA=\E)0:\
+ :ei=\E[4l:ho=\E[H:im=\E[4h:\
+ :is=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:k1=\EOP:\
+ :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:\
+ :k8=\E[19~:k9=\E[20~:k;=\E[21~:kD=\177:kI=\E[2~:kN=\E[6~:\
+ :kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:\
+ :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:mb@:md=\E[1m:me=\E[m:\
+ :ml=\El:mr=\E[7m:mu=\Em:nd=\E[C:rc=\E8:\
+ :rs=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:sc=\E7:\
+ :se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:te=\E[2J\E[?47l\E8:\
+ :ti=\E7\E[?47h:u6=\E[%i%d;%dR:u7=\E[6n:u8=\E[?1;2c:\
+ :u9=\E[c:ue=\E[m:up=\E[A:us=\E[4m:
+
diff --git a/vte.spec b/vte.spec
index 9e662b0..7eb31b3 100644
--- a/vte.spec
+++ b/vte.spec
@@ -1,5 +1,5 @@
Name: vte
-Version: 0.3.1
+Version: 0.3.2
Release: 1
Summary: An experimental terminal emulator.
License: LGPL
@@ -43,6 +43,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
%doc ChangeLog COPYING HACKING NEWS README
%{_bindir}/*
%{_libdir}/*.so.*.*
+%{_datadir}/*
%files devel
%defattr(-,root,root)
@@ -52,6 +53,9 @@ make install DESTDIR=$RPM_BUILD_ROOT
%{_libdir}/pkgconfig/*
%changelog
+* Wed May 1 2002 Nalin Dahyabhai <nalin@redhat.com> 0.3.2-1
+- include a small default termcap for systems without termcap files
+
* Tue Apr 30 2002 Nalin Dahyabhai <nalin@redhat.com> 0.3.1-1
- disconnect from the configure_toplevel signal at finalize-time