summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortholo <tholo@openbsd.org>1996-06-18 20:29:40 +0000
committertholo <tholo@openbsd.org>1996-06-18 20:29:40 +0000
commite94144f9fd50ef26a493e6f8b147c1c6fbca2764 (patch)
tree07b818bcc04005051379f0a3cbee3bd9b5434a4e
parenttalk about ypinit; fails to talk about "ypmake" still (diff)
downloadwireguard-openbsd-e94144f9fd50ef26a493e6f8b147c1c6fbca2764.tar.xz
wireguard-openbsd-e94144f9fd50ef26a493e6f8b147c1c6fbca2764.zip
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 4c0953d114a..87d8cdeedc8 100644
--- a/lib/libtermlib/getterm.c
+++ b/lib/libtermlib/getterm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getterm.c,v 1.1.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.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.1.1 1996/05/31 05:40:02 tholo E
#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 186fcb66cfd..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.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));