summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1998-10-16 18:51:21 +0000
committermillert <millert@openbsd.org>1998-10-16 18:51:21 +0000
commit079208d62a76621e4dcc9ea944fa83e87f89ae50 (patch)
treedd985ade51e705095edcce2f42c24d6be8123e80
parentfix magma device generation; three cards supported (diff)
downloadwireguard-openbsd-079208d62a76621e4dcc9ea944fa83e87f89ae50.tar.xz
wireguard-openbsd-079208d62a76621e4dcc9ea944fa83e87f89ae50.zip
don't dump core when linked against ncurses
-rw-r--r--usr.bin/tset/term.c6
-rw-r--r--usr.bin/tset/tset.c29
2 files changed, 24 insertions, 11 deletions
diff --git a/usr.bin/tset/term.c b/usr.bin/tset/term.c
index b52899ad070..4b500a91594 100644
--- a/usr.bin/tset/term.c
+++ b/usr.bin/tset/term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: term.c,v 1.5 1998/04/25 04:30:38 millert Exp $ */
+/* $OpenBSD: term.c,v 1.6 1998/10/16 18:51:21 millert Exp $ */
/* $NetBSD: term.c,v 1.6 1994/12/07 05:08:12 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93";
#endif
-static char rcsid[] = "$OpenBSD: term.c,v 1.5 1998/04/25 04:30:38 millert Exp $";
+static char rcsid[] = "$OpenBSD: term.c,v 1.6 1998/10/16 18:51:21 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -119,7 +119,7 @@ found: if ((p = getenv("TERMCAP")) != NULL && *p != '/')
}
if (rval == -1)
warnx("termcap: %s", strerror(errno ? errno : ENOENT));
- *tcapbufp = tbuf;
+ *tcapbufp = *tbuf ? tbuf : NULL;
return (ttype);
}
diff --git a/usr.bin/tset/tset.c b/usr.bin/tset/tset.c
index 87d38d2b4c3..672c437f50f 100644
--- a/usr.bin/tset/tset.c
+++ b/usr.bin/tset/tset.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tset.c,v 1.5 1998/04/25 04:30:39 millert Exp $ */
+/* $OpenBSD: tset.c,v 1.6 1998/10/16 18:51:21 millert Exp $ */
/* $NetBSD: tset.c,v 1.4 1994/12/07 05:08:15 jtc Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)tset.c 8.1 (Berkeley) 6/9/93";
#endif
-static char rcsid[] = "$OpenBSD: tset.c,v 1.5 1998/04/25 04:30:39 millert Exp $";
+static char rcsid[] = "$OpenBSD: tset.c,v 1.6 1998/10/16 18:51:21 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -218,7 +218,8 @@ main(argc, argv)
if (Sflag) {
(void)printf("%s ", ttype);
- wrtermcap(tcapbuf);
+ if (tcapbuf)
+ wrtermcap(tcapbuf);
}
if (sflag) {
@@ -228,14 +229,26 @@ main(argc, argv)
*/
if ((p = getenv("SHELL")) &&
!strcmp(p + strlen(p) - 3, "csh")) {
- p = "set noglob histchars="";\nsetenv TERM %s;\nsetenv TERMCAP '";
- t = "';\nunset noglob histchars;\n";
+ if (tcapbuf)
+ p = "set noglob histchars="";\nsetenv TERM %s;\nsetenv TERMCAP ";
+ else
+ p = "set noglob histchars="";\nsetenv TERM %s;\n";
+ t = "unset noglob histchars;\n";
} else {
- p = "TERM=%s;\nTERMCAP='";
- t = "';\nexport TERMCAP TERM;\n";
+ if (tcapbuf) {
+ p = "TERM=%s;\nTERMCAP=";
+ t = "export TERMCAP TERM;\n";
+ } else {
+ p = "TERM=%s;\n";
+ t = "export TERMCAP;\n";
+ }
}
(void)printf(p, ttype);
- wrtermcap(tcapbuf);
+ if (tcapbuf) {
+ putchar('\'');
+ wrtermcap(tcapbuf);
+ fputs("';\n", stdout);
+ }
(void)printf(t);
}