summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1998-06-19 16:09:20 +0000
committerache <ache@FreeBSD.org>1998-06-19 16:09:20 +0000
commit2e210ceb513fc03627756d71376a8935f4a3744c (patch)
tree43cef6e6ed121c9996b63b3794ed8e1a7bd820b8
parent20df804cb40473d53d25636ead10cc0777542868 (diff)
downloadFreeBSD-src-2e210ceb513fc03627756d71376a8935f4a3744c.zip
FreeBSD-src-2e210ceb513fc03627756d71376a8935f4a3744c.tar.gz
Add check for non-NULL cur_term
Add #pragma weak for reset_*_mode() they will be replaced in libncurses
-rw-r--r--lib/libmytinfo/tty.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libmytinfo/tty.c b/lib/libmytinfo/tty.c
index 2ba2a7c..9c22eb1 100644
--- a/lib/libmytinfo/tty.c
+++ b/lib/libmytinfo/tty.c
@@ -107,6 +107,8 @@ _check_tty() {
int
def_prog_mode() {
+ if (cur_term == NULL)
+ return ERR;
#ifdef USE_WINSZ
#ifdef TIOCGWINSZ
if (ioctl(cur_term->fd, TIOCGWINSZ, &cur_term->prog_winsz) < 0)
@@ -125,6 +127,8 @@ def_prog_mode() {
int
def_shell_mode() {
+ if (cur_term == NULL)
+ return ERR;
cur_term->termcap = 0;
#ifdef USE_WINSZ
#ifdef TIOCGWINSZ
@@ -139,8 +143,12 @@ def_shell_mode() {
#endif
}
+
+#pragma weak reset_prog_mode
int
reset_prog_mode() {
+ if (cur_term == NULL)
+ return ERR;
#ifdef USE_TERMIO
return ioctl(cur_term->fd, TCSETA, &cur_term->prog_mode)==0 ? OK : ERR;
#else
@@ -148,8 +156,11 @@ reset_prog_mode() {
#endif
}
+#pragma weak reset_shell_mode
int
reset_shell_mode() {
+ if (cur_term == NULL)
+ return ERR;
#ifdef USE_TERMIO
return ioctl(cur_term->fd, TCSETA, &cur_term->shell_mode)==0 ? OK : ERR;
#else
OpenPOWER on IntegriCloud