summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-06-18 20:29:42 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-06-18 20:29:42 +0000
commita0bc12ae2c5ccd08c0ab7635336cd812075f9a12 (patch)
treebca8b36e93ba3246edc74263feb0f51c38fa1742
parent92dec2dd827787d6533f9393e632522372cba7b9 (diff)
Also emulate old ttytype[] behaviour. Strip off any obsolete 2-character
terminal type found at the head of the name list before saving the list.
-rw-r--r--lib/libtermlib/getterm.c14
-rw-r--r--lib/libtermlib/term.h.tail3
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/libtermlib/getterm.c b/lib/libtermlib/getterm.c
index f2c8c0a9b10..87d8cdeedc8 100644
--- a/lib/libtermlib/getterm.c
+++ b/lib/libtermlib/getterm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getterm.c,v 1.1 1996/05/31 05:40:02 tholo Exp $ */
+/* $OpenBSD: getterm.c,v 1.2 1996/06/18 20:29:40 tholo Exp $ */
/*
* Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: getterm.c,v 1.1 1996/05/31 05:40:02 tholo Exp $";
+static char rcsid[] = "$OpenBSD: getterm.c,v 1.2 1996/06/18 20:29:40 tholo Exp $";
#endif
#include <stdlib.h>
@@ -43,6 +43,7 @@ static char rcsid[] = "$OpenBSD: getterm.c,v 1.1 1996/05/31 05:40:02 tholo Exp $
#include "pathnames.h"
#define PVECSIZ 32
+#define MAXSIZE 256 /* Maximum allowed size of a terminal name field */
TERMINAL *cur_term;
char *_ti_buf;
@@ -50,6 +51,7 @@ char *UP;
char *BC;
char PC;
int LINES, COLS, TABSIZE;
+char ttytype[MAXSIZE];
static int _ti_use_env = TRUE;
@@ -139,9 +141,15 @@ _ti_getterm(name)
if (i == 0) {
char *s;
- if ((s = home = strchr(dummy, ':')) == NULL)
+ if ((s = home = strchr(dummy, ':')) == NULL) {
cur_term->name = strdup(name);
+ strncpy(ttytype, name, MAXSIZE - 1);
+ ttytype[MAXSIZE - 1] = '\0';
+ }
else {
+ strncpy(ttytype, dummy + (dummy[2] == '|' ? 2 : 0),
+ MIN(MAXSIZE - 1, s - dummy));
+ ttytype[MAXSIZE - 1] = '\0';
*home = '\0';
while (s > dummy && *s != '|')
s--;
diff --git a/lib/libtermlib/term.h.tail b/lib/libtermlib/term.h.tail
index d3724d4d811..cdbc5e39c43 100644
--- a/lib/libtermlib/term.h.tail
+++ b/lib/libtermlib/term.h.tail
@@ -1,5 +1,5 @@
-/* $OpenBSD: term.h.tail,v 1.1 1996/05/31 05:40:02 tholo Exp $ */
+/* $OpenBSD: term.h.tail,v 1.2 1996/06/18 20:29:41 tholo Exp $ */
/*
* Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@@ -48,6 +48,7 @@ extern int LINES;
extern int COLS;
extern int TABSIZE;
extern TERMINAL *cur_term;
+extern char ttytype[];
int def_prog_mode __P((void));
int def_shell_mode __P((void));