summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2000-04-14 18:43:34 +0000
committermillert <millert@openbsd.org>2000-04-14 18:43:34 +0000
commit085778450d9f966a89056166f59c5c2c9822a7fd (patch)
tree23e1e3892b69a0e160a9c10185d13fc5c42fb516
parentpartial sync (diff)
downloadwireguard-openbsd-085778450d9f966a89056166f59c5c2c9822a7fd.tar.xz
wireguard-openbsd-085778450d9f966a89056166f59c5c2c9822a7fd.zip
Don't assume that termcap entries start with a 2-character short name--
modern ones do not.
-rw-r--r--usr.bin/window/ttinit.c20
-rw-r--r--usr.bin/window/ww.h4
2 files changed, 14 insertions, 10 deletions
diff --git a/usr.bin/window/ttinit.c b/usr.bin/window/ttinit.c
index ea827ea7de2..360a9c4702f 100644
--- a/usr.bin/window/ttinit.c
+++ b/usr.bin/window/ttinit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttinit.c,v 1.5 1999/11/14 17:34:24 millert Exp $ */
+/* $OpenBSD: ttinit.c,v 1.6 2000/04/14 18:43:34 millert Exp $ */
/* $NetBSD: ttinit.c,v 1.3 1995/09/28 10:34:50 tls Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)ttinit.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: ttinit.c,v 1.5 1999/11/14 17:34:24 millert Exp $";
+static char rcsid[] = "$OpenBSD: ttinit.c,v 1.6 2000/04/14 18:43:34 millert Exp $";
#endif
#endif /* not lint */
@@ -93,16 +93,20 @@ ttinit()
tt_obe = tt_ob + i;
/*
- * Use the standard name of the terminal (i.e. the second
- * name in termcap).
+ * Use the standard name of the terminal (i.e. the first
+ * non-two letter name in termcap).
*/
#ifdef NCURSES_VERSION
wwterm = strdup(_nc_first_name(cur_term->type.term_names));
#else
- for (p = wwtermcap; *p && *p != '|' && *p != ':'; p++)
- ;
- if (*p == '|')
- p++;
+ if ((p = strchr(wwtermcap, '|')) && p - wwtermcap == 2) {
+ /* Skip the two-character short name. */
+ for (p = wwtermcap; *p && *p != '|' && *p != ':'; p++)
+ ;
+ if (*p == '|')
+ p++;
+ } else
+ p = wwtermcap;
for (q = p; *q && *q != '|' && *q != ':'; q++)
;
if (q != p && (t = malloc(q - p + 1)) != 0) {
diff --git a/usr.bin/window/ww.h b/usr.bin/window/ww.h
index 1b9298d9c5d..aed54113c62 100644
--- a/usr.bin/window/ww.h
+++ b/usr.bin/window/ww.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ww.h,v 1.6 1997/02/25 00:04:36 downsj Exp $ */
+/* $OpenBSD: ww.h,v 1.7 2000/04/14 18:43:34 millert Exp $ */
/* $NetBSD: ww.h,v 1.9 1996/10/12 23:46:23 christos Exp $ */
/*
@@ -286,7 +286,7 @@ int wwdocheckpoint;
/* the window virtual terminal */
#define WWT_TERM "window-v2"
-#define WWT_TERMCAP "WW|window-v2|window program version 2:\
+#define WWT_TERMCAP "window-v2|window program version 2:\
:am:bs:da:db:ms:pt:cr=^M:nl=^J:bl=^G:ta=^I:\
:cm=\\EY%+ %+ :le=^H:nd=\\EC:up=\\EA:do=\\EB:ho=\\EH:\
:cd=\\EJ:ce=\\EK:cl=\\EE:me=\\Er^?:"