summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1999-02-24 06:37:12 +0000
committermillert <millert@openbsd.org>1999-02-24 06:37:12 +0000
commit936c48d99accbe29fd16679ed55a4317c9695822 (patch)
tree10a8e64cf036a526e43ca14b2cfc72619952884b
parentThis is 5.0, not 4.2 (diff)
downloadwireguard-openbsd-936c48d99accbe29fd16679ed55a4317c9695822.tar.xz
wireguard-openbsd-936c48d99accbe29fd16679ed55a4317c9695822.zip
updates from ncurses-4.2-990220
-rw-r--r--lib/libmenu/m_item_opt.c9
-rw-r--r--lib/libmenu/m_opts.c8
-rw-r--r--usr.bin/tic/tic.c113
3 files changed, 123 insertions, 7 deletions
diff --git a/lib/libmenu/m_item_opt.c b/lib/libmenu/m_item_opt.c
index 7900d75c688..8dce6114bf4 100644
--- a/lib/libmenu/m_item_opt.c
+++ b/lib/libmenu/m_item_opt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m_item_opt.c,v 1.4 1998/07/24 16:39:02 millert Exp $ */
+/* $OpenBSD: m_item_opt.c,v 1.5 1999/02/24 06:37:12 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -39,7 +39,7 @@
#include "menu.priv.h"
-MODULE_ID("$From: m_item_opt.c,v 1.6 1998/02/11 12:13:49 tom Exp $")
+MODULE_ID("$From: m_item_opt.c,v 1.8 1999/02/18 16:12:15 juergen Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -54,6 +54,8 @@ MODULE_ID("$From: m_item_opt.c,v 1.6 1998/02/11 12:13:49 tom Exp $")
+--------------------------------------------------------------------------*/
int set_item_opts(ITEM *item, Item_Options opts)
{
+ opts &= ALL_ITEM_OPTS;
+
if (opts & ~ALL_ITEM_OPTS)
RETURN(E_BAD_ARGUMENT);
@@ -100,7 +102,7 @@ int item_opts_off(ITEM *item, Item_Options opts)
else
{
Normalize_Item(citem);
- opts = citem->opt & ~opts;
+ opts = citem->opt & ~(opts & ALL_ITEM_OPTS);
return set_item_opts( item, opts );
}
}
@@ -119,6 +121,7 @@ int item_opts_on(ITEM *item, Item_Options opts)
ITEM *citem = item; /* use a copy because set_item_opts must detect
NULL item itself to adjust its behaviour */
+ opts &= ALL_ITEM_OPTS;
if (opts & ~ALL_ITEM_OPTS)
RETURN(E_BAD_ARGUMENT);
else
diff --git a/lib/libmenu/m_opts.c b/lib/libmenu/m_opts.c
index 6af6a0f2bcc..7006ebf8403 100644
--- a/lib/libmenu/m_opts.c
+++ b/lib/libmenu/m_opts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m_opts.c,v 1.4 1998/07/24 16:39:10 millert Exp $ */
+/* $OpenBSD: m_opts.c,v 1.5 1999/02/24 06:37:12 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -39,7 +39,7 @@
#include "menu.priv.h"
-MODULE_ID("$From: m_opts.c,v 1.8 1998/02/11 12:13:49 tom Exp $")
+MODULE_ID("$From: m_opts.c,v 1.10 1999/02/18 16:12:19 juergen Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -56,6 +56,8 @@ MODULE_ID("$From: m_opts.c,v 1.8 1998/02/11 12:13:49 tom Exp $")
+--------------------------------------------------------------------------*/
int set_menu_opts(MENU * menu, Menu_Options opts)
{
+ opts &= ALL_MENU_OPTS;
+
if (opts & ~ALL_MENU_OPTS)
RETURN(E_BAD_ARGUMENT);
@@ -114,6 +116,7 @@ int menu_opts_off(MENU *menu, Menu_Options opts)
MENU *cmenu = menu; /* use a copy because set_menu_opts must detect
NULL menu itself to adjust its behaviour */
+ opts &= ALL_MENU_OPTS;
if (opts & ~ALL_MENU_OPTS)
RETURN(E_BAD_ARGUMENT);
else
@@ -142,6 +145,7 @@ int menu_opts_on(MENU * menu, Menu_Options opts)
MENU *cmenu = menu; /* use a copy because set_menu_opts must detect
NULL menu itself to adjust its behaviour */
+ opts &= ALL_MENU_OPTS;
if (opts & ~ALL_MENU_OPTS)
RETURN(E_BAD_ARGUMENT);
else
diff --git a/usr.bin/tic/tic.c b/usr.bin/tic/tic.c
index 1b7911f4bb7..8b992710d62 100644
--- a/usr.bin/tic/tic.c
+++ b/usr.bin/tic/tic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tic.c,v 1.5 1999/01/24 19:33:51 millert Exp $ */
+/* $OpenBSD: tic.c,v 1.6 1999/02/24 06:38:23 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <dump_entry.h>
#include <term_entry.h>
-MODULE_ID("$From: tic.c,v 1.41 1999/01/24 02:55:48 tom Exp $")
+MODULE_ID("$From: tic.c,v 1.45 1999/02/19 10:40:00 tom Exp $")
const char *_nc_progname = "tic";
@@ -53,6 +53,9 @@ static FILE *tmp_fp;
static bool showsummary = FALSE;
static const char *to_remove;
+static void (*save_check_termtype)(TERMTYPE *);
+static void check_termtype(TERMTYPE *tt);
+
static const char usage_string[] = "[-h] [-v[n]] [-e names] [-CILNRTcfrsw1] source-file\n";
static void cleanup(void)
@@ -488,6 +491,12 @@ bool check_only = FALSE;
debug_level = (v_opt > 0) ? v_opt : (v_opt == 0);
_nc_tracing = (1 << debug_level) - 1;
+ if (_nc_tracing)
+ {
+ save_check_termtype = _nc_check_termtype;
+ _nc_check_termtype = check_termtype;
+ }
+
#ifndef HAVE_BIG_CORE
/*
* Aaargh! immedhook seriously hoses us!
@@ -684,3 +693,103 @@ bool check_only = FALSE;
cleanup();
return(EXIT_SUCCESS);
}
+
+/*
+ * This bit of legerdemain turns all the terminfo variable names into
+ * references to locations in the arrays Booleans, Numbers, and Strings ---
+ * precisely what's needed (see comp_parse.c).
+ */
+
+#undef CUR
+#define CUR tp->
+
+/* other sanity-checks (things that we don't want in the normal
+ * logic that reads a terminfo entry)
+ */
+static void check_termtype(TERMTYPE *tp)
+{
+ bool conflict = FALSE;
+ unsigned j, k;
+ char fkeys[STRCOUNT];
+
+ /*
+ * A terminal entry may contain more than one keycode assigned to
+ * a given string (e.g., KEY_END and KEY_LL). But curses will only
+ * return one (the last one assigned).
+ */
+ memset(fkeys, 0, sizeof(fkeys));
+ for (j = 0; _nc_tinfo_fkeys[j].code; j++) {
+ char *a = tp->Strings[_nc_tinfo_fkeys[j].offset];
+ bool first = TRUE;
+ if (!VALID_STRING(a))
+ continue;
+ for (k = j+1; _nc_tinfo_fkeys[k].code; k++) {
+ char *b = tp->Strings[_nc_tinfo_fkeys[k].offset];
+ if (!VALID_STRING(b)
+ || fkeys[k])
+ continue;
+ if (!strcmp(a,b)) {
+ fkeys[j] = 1;
+ fkeys[k] = 1;
+ if (first) {
+ if (!conflict) {
+ _nc_warning("Conflicting key definitions (using the last)");
+ conflict = TRUE;
+ }
+ fprintf(stderr, "... %s is the same as %s",
+ keyname(_nc_tinfo_fkeys[j].code),
+ keyname(_nc_tinfo_fkeys[k].code));
+ first = FALSE;
+ } else {
+ fprintf(stderr, ", %s",
+ keyname(_nc_tinfo_fkeys[k].code));
+ }
+ }
+ }
+ if (!first)
+ fprintf(stderr, "\n");
+ }
+
+ /*
+ * Quick check for color. We could also check if the ANSI versus
+ * non-ANSI strings are misused.
+ */
+ if ((max_colors > 0) != (max_pairs > 0)
+ || (max_colors > max_pairs))
+ _nc_warning("inconsistent values for max_colors and max_pairs");
+
+ PAIRED(set_foreground, set_background)
+ PAIRED(set_a_foreground, set_a_background)
+
+ /*
+ * These may be mismatched because the terminal description relies on
+ * restoring the cursor visibility by resetting it.
+ */
+ ANDMISSING(cursor_invisible, cursor_normal)
+ ANDMISSING(cursor_visible, cursor_normal)
+
+ /*
+ * From XSI & O'Reilly, we gather that sc/rc are required if csr is
+ * given, because the cursor position after the scrolling operation is
+ * performed is undefined.
+ */
+ ANDMISSING(change_scroll_region, save_cursor)
+ ANDMISSING(change_scroll_region, restore_cursor)
+
+ /*
+ * Some standard applications (e.g., vi) and some non-curses
+ * applications (e.g., jove) get confused if we have both ich/ich1 and
+ * smir/rmir. Let's be nice and warn about that, too, even though
+ * ncurses handles it.
+ */
+ if ((PRESENT(enter_insert_mode) || PRESENT(exit_insert_mode))
+ && (PRESENT(insert_character) || PRESENT(parm_ich))) {
+ _nc_warning("non-curses applications may be confused by ich/ich1 with smir/rmir");
+ }
+
+ /*
+ * Finally, do the non-verbose checks
+ */
+ if (save_check_termtype != 0)
+ save_check_termtype(tp);
+}