summaryrefslogtreecommitdiff
path: root/lib/libcurses
diff options
context:
space:
mode:
authorroy <roy@NetBSD.org>2018-10-04 18:40:41 +0000
committerroy <roy@NetBSD.org>2018-10-04 18:40:41 +0000
commit261d0c98eba3ba2f0abaabfe91804f5b50c31b08 (patch)
tree7abfbf7008648953faefb1e0745d9601ccfaa660 /lib/libcurses
parent0af1aec11e6a8c64019abc59a0d81ced53889321 (diff)
curses: declare SLK format as invalid until slk_init(3) called
If we don't, then when __slk_init with a valid format of 0 it sets up labels to be drawn without a window.
Diffstat (limited to 'lib/libcurses')
-rw-r--r--lib/libcurses/curses_private.h3
-rw-r--r--lib/libcurses/slk.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/libcurses/curses_private.h b/lib/libcurses/curses_private.h
index 2d52f183f2b..555df27c9f0 100644
--- a/lib/libcurses/curses_private.h
+++ b/lib/libcurses/curses_private.h
@@ -1,4 +1,4 @@
-/* $NetBSD: curses_private.h,v 1.65 2018/10/03 13:22:29 roy Exp $ */
+/* $NetBSD: curses_private.h,v 1.66 2018/10/04 18:40:41 roy Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@@ -289,6 +289,7 @@ struct __screen {
bool is_term_slk;
WINDOW *slk_window;
int slk_format;
+#define SLK_FMT_INVAL -1
#define SLK_FMT_3_2_3 0
#define SLK_FMT_4_4 1
int slk_nlabels;
diff --git a/lib/libcurses/slk.c b/lib/libcurses/slk.c
index eccc2a0c169..73294bdc740 100644
--- a/lib/libcurses/slk.c
+++ b/lib/libcurses/slk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: slk.c,v 1.2 2017/01/30 17:15:52 roy Exp $ */
+/* $NetBSD: slk.c,v 1.3 2018/10/04 18:40:41 roy Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: slk.c,v 1.2 2017/01/30 17:15:52 roy Exp $");
+__RCSID("$NetBSD: slk.c,v 1.3 2018/10/04 18:40:41 roy Exp $");
#endif /* not lint */
#include <ctype.h>
@@ -57,7 +57,7 @@ __RCSID("$NetBSD: slk.c,v 1.2 2017/01/30 17:15:52 roy Exp $");
#define SLK_SIZE MAX_SLK_COLS
#endif
-static int slk_fmt; /* fmt of slk_init */
+static int slk_fmt = SLK_FMT_INVAL; /* fmt of slk_init */
/* Safe variants of public functions. */
static int __slk_attron(SCREEN *, const chtype);
@@ -560,6 +560,8 @@ __slk_init(SCREEN *screen)
{
__slk_free(screen); /* safety */
+ if (slk_fmt == SLK_FMT_INVAL)
+ return OK;
screen->slk_format = slk_fmt;
switch(screen->slk_format) {