Module Name: src
Committed By: roy
Date: Thu Oct 4 18:40:41 UTC 2018
Modified Files:
src/lib/libcurses: curses_private.h slk.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.2 -r1.3 src/lib/libcurses/slk.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libcurses/curses_private.h
diff -u src/lib/libcurses/curses_private.h:1.65 src/lib/libcurses/curses_private.h:1.66
--- src/lib/libcurses/curses_private.h:1.65 Wed Oct 3 13:22:29 2018
+++ src/lib/libcurses/curses_private.h Thu Oct 4 18:40:41 2018
@@ -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;
Index: src/lib/libcurses/slk.c
diff -u src/lib/libcurses/slk.c:1.2 src/lib/libcurses/slk.c:1.3
--- src/lib/libcurses/slk.c:1.2 Mon Jan 30 17:15:52 2017
+++ src/lib/libcurses/slk.c Thu Oct 4 18:40:41 2018
@@ -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
#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) {