summaryrefslogtreecommitdiff
path: root/lib/libcurses/tinfo
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-06-19 03:54:00 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-06-19 03:54:00 +0000
commitd6e8f609245bfd13a1aee14a2347d3a3a6125319 (patch)
tree5633e2c339f330e0db835a1a8834519826c9f921 /lib/libcurses/tinfo
parente11e5df3fd5c0ef8be778b1ae185ee1842790d3e (diff)
ncurses-5.0-20000617
Diffstat (limited to 'lib/libcurses/tinfo')
-rw-r--r--lib/libcurses/tinfo/comp_parse.c48
-rw-r--r--lib/libcurses/tinfo/comp_scan.c7
-rw-r--r--lib/libcurses/tinfo/lib_napms.c47
-rw-r--r--lib/libcurses/tinfo/lib_tputs.c70
-rw-r--r--lib/libcurses/tinfo/parse_entry.c7
-rw-r--r--lib/libcurses/tinfo/read_termcap.c10
6 files changed, 130 insertions, 59 deletions
diff --git a/lib/libcurses/tinfo/comp_parse.c b/lib/libcurses/tinfo/comp_parse.c
index 9f0afdef140..731d0b5724d 100644
--- a/lib/libcurses/tinfo/comp_parse.c
+++ b/lib/libcurses/tinfo/comp_parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: comp_parse.c,v 1.6 2000/03/26 16:45:03 millert Exp $ */
+/* $OpenBSD: comp_parse.c,v 1.7 2000/06/19 03:53:48 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -54,7 +54,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$From: comp_parse.c,v 1.39 2000/03/25 17:07:30 tom Exp $")
+MODULE_ID("$From: comp_parse.c,v 1.40 2000/04/15 16:57:08 tom Exp $")
static void sanity_check(TERMTYPE *);
void (*_nc_check_termtype) (TERMTYPE *) = sanity_check;
@@ -461,26 +461,26 @@ sanity_check(TERMTYPE * tp)
}
/* listed in structure-member order of first argument */
- PAIRED(enter_alt_charset_mode, exit_alt_charset_mode)
- ANDMISSING(enter_alt_charset_mode, acs_chars)
- ANDMISSING(exit_alt_charset_mode, acs_chars)
- ANDMISSING(enter_blink_mode, exit_attribute_mode)
- ANDMISSING(enter_bold_mode, exit_attribute_mode)
- PAIRED(exit_ca_mode, enter_ca_mode)
- PAIRED(enter_delete_mode, exit_delete_mode)
- ANDMISSING(enter_dim_mode, exit_attribute_mode)
- PAIRED(enter_insert_mode, exit_insert_mode)
- ANDMISSING(enter_secure_mode, exit_attribute_mode)
- ANDMISSING(enter_protected_mode, exit_attribute_mode)
- ANDMISSING(enter_reverse_mode, exit_attribute_mode)
- PAIRED(from_status_line, to_status_line)
- PAIRED(meta_off, meta_on)
-
- PAIRED(prtr_on, prtr_off)
- PAIRED(save_cursor, restore_cursor)
- PAIRED(enter_xon_mode, exit_xon_mode)
- PAIRED(enter_am_mode, exit_am_mode)
- ANDMISSING(label_off, label_on)
- PAIRED(display_clock, remove_clock)
- ANDMISSING(set_color_pair, initialize_pair)
+ PAIRED(enter_alt_charset_mode, exit_alt_charset_mode);
+ ANDMISSING(enter_alt_charset_mode, acs_chars);
+ ANDMISSING(exit_alt_charset_mode, acs_chars);
+ ANDMISSING(enter_blink_mode, exit_attribute_mode);
+ ANDMISSING(enter_bold_mode, exit_attribute_mode);
+ PAIRED(exit_ca_mode, enter_ca_mode);
+ PAIRED(enter_delete_mode, exit_delete_mode);
+ ANDMISSING(enter_dim_mode, exit_attribute_mode);
+ PAIRED(enter_insert_mode, exit_insert_mode);
+ ANDMISSING(enter_secure_mode, exit_attribute_mode);
+ ANDMISSING(enter_protected_mode, exit_attribute_mode);
+ ANDMISSING(enter_reverse_mode, exit_attribute_mode);
+ PAIRED(from_status_line, to_status_line);
+ PAIRED(meta_off, meta_on);
+
+ PAIRED(prtr_on, prtr_off);
+ PAIRED(save_cursor, restore_cursor);
+ PAIRED(enter_xon_mode, exit_xon_mode);
+ PAIRED(enter_am_mode, exit_am_mode);
+ ANDMISSING(label_off, label_on);
+ PAIRED(display_clock, remove_clock);
+ ANDMISSING(set_color_pair, initialize_pair);
}
diff --git a/lib/libcurses/tinfo/comp_scan.c b/lib/libcurses/tinfo/comp_scan.c
index d2b7b78ecb8..77ac5d3043c 100644
--- a/lib/libcurses/tinfo/comp_scan.c
+++ b/lib/libcurses/tinfo/comp_scan.c
@@ -50,7 +50,7 @@
#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$From: comp_scan.c,v 1.42 2000/04/01 19:08:36 tom Exp $")
+MODULE_ID("$From: comp_scan.c,v 1.44 2000/06/10 21:59:21 tom Exp $")
/*
* Maximum length of string capability we'll accept before raising an error.
@@ -66,6 +66,9 @@ long _nc_comment_start = 0; /* start of comment range before name */
long _nc_comment_end = 0; /* end of comment range before name */
long _nc_start_line = 0; /* start line of current entry */
+struct token _nc_curr_token =
+{0, 0, 0};
+
/*****************************************************************************
*
* Token-grabbing machinery
@@ -472,6 +475,8 @@ _nc_trans_string(char *ptr, char *last)
}
if (ch == '?') {
*(ptr++) = '\177';
+ if (_nc_tracing)
+ _nc_warning("Allow ^? as synonym for \\177");
} else {
if ((ch &= 037) == 0)
ch = 128;
diff --git a/lib/libcurses/tinfo/lib_napms.c b/lib/libcurses/tinfo/lib_napms.c
index 90001b03b50..de4f97efce7 100644
--- a/lib/libcurses/tinfo/lib_napms.c
+++ b/lib/libcurses/tinfo/lib_napms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_napms.c,v 1.5 2000/03/10 01:35:03 millert Exp $ */
+/* $OpenBSD: lib_napms.c,v 1.6 2000/06/19 03:53:50 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -33,7 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
* lib_napms.c
*
@@ -45,6 +44,9 @@
#if HAVE_NANOSLEEP
#include <time.h>
+#if HAVE_SYS_TIME_H
+#include <sys/time.h> /* needed for MacOS X DP3 */
+#endif
#elif USE_FUNC_POLL
#if HAVE_SYS_TIME_H
#include <sys/time.h>
@@ -58,31 +60,32 @@
#endif
#endif
-MODULE_ID("$From: lib_napms.c,v 1.8 2000/02/13 01:01:26 tom Exp $")
+MODULE_ID("$From: lib_napms.c,v 1.9 2000/04/29 23:42:56 tom Exp $")
-int napms(int ms)
+int
+napms(int ms)
{
- T((T_CALLED("napms(%d)"), ms));
+ T((T_CALLED("napms(%d)"), ms));
#if HAVE_NANOSLEEP
- {
- struct timespec ts;
- ts.tv_sec = ms / 1000;
- ts.tv_nsec = (ms % 1000) * 1000000;
- nanosleep(&ts, NULL);
- }
+ {
+ struct timespec ts;
+ ts.tv_sec = ms / 1000;
+ ts.tv_nsec = (ms % 1000) * 1000000;
+ nanosleep(&ts, NULL);
+ }
#elif USE_FUNC_POLL
- {
- struct pollfd fds[1];
- poll(fds, 0, ms);
- }
+ {
+ struct pollfd fds[1];
+ poll(fds, 0, ms);
+ }
#elif HAVE_SELECT
- {
- struct timeval tval;
- tval.tv_sec = ms / 1000;
- tval.tv_usec = (ms % 1000) * 1000;
- select(0, NULL, NULL, NULL, &tval);
- }
+ {
+ struct timeval tval;
+ tval.tv_sec = ms / 1000;
+ tval.tv_usec = (ms % 1000) * 1000;
+ select(0, NULL, NULL, NULL, &tval);
+ }
#endif
- returnCode(OK);
+ returnCode(OK);
}
diff --git a/lib/libcurses/tinfo/lib_tputs.c b/lib/libcurses/tinfo/lib_tputs.c
index 7bed4f9cdb8..4a5aa118864 100644
--- a/lib/libcurses/tinfo/lib_tputs.c
+++ b/lib/libcurses/tinfo/lib_tputs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_tputs.c,v 1.5 2000/03/10 01:35:04 millert Exp $ */
+/* $OpenBSD: lib_tputs.c,v 1.6 2000/06/19 03:53:50 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -47,7 +47,7 @@
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$From: lib_tputs.c,v 1.45 2000/02/27 02:33:24 tom Exp $")
+MODULE_ID("$From: lib_tputs.c,v 1.47 2000/05/27 23:08:41 tom Exp $")
char PC = 0; /* used by termcap library */
speed_t ospeed = 0; /* used by termcap library */
@@ -77,6 +77,12 @@ delay_output(int ms)
returnCode(OK);
}
+void
+_nc_flush(void)
+{
+ (void)fflush(NC_OUTPUT);
+}
+
int
_nc_outch(int ch)
{
@@ -98,6 +104,66 @@ _nc_outch(int ch)
return OK;
}
+#ifdef USE_WIDEC_SUPPORT
+/*
+ * Reference: The Unicode Standard 2.0
+ *
+ * No surrogates supported (we're storing only one 16-bit Unicode value per
+ * cell).
+ */
+int
+_nc_utf8_outch(int ch)
+{
+ static const unsigned byteMask = 0xBF;
+ static const unsigned otherMark = 0x80;
+ static const unsigned firstMark[] =
+ {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC};
+
+ int result[7], *ptr;
+ int count = 0;
+
+ if (ch < 0x80)
+ count = 1;
+ else if (ch < 0x800)
+ count = 2;
+ else if (ch < 0x10000)
+ count = 3;
+ else if (ch < 0x200000)
+ count = 4;
+ else if (ch < 0x4000000)
+ count = 5;
+ else if (ch <= 0x7FFFFFFF)
+ count = 6;
+ else {
+ count = 2;
+ ch = 0xFFFD;
+ }
+ ptr = result + count;
+ switch (count) {
+ case 6:
+ *--ptr = (ch | otherMark) & byteMask;
+ ch >>= 6;
+ case 5:
+ *--ptr = (ch | otherMark) & byteMask;
+ ch >>= 6;
+ case 4:
+ *--ptr = (ch | otherMark) & byteMask;
+ ch >>= 6;
+ case 3:
+ *--ptr = (ch | otherMark) & byteMask;
+ ch >>= 6;
+ case 2:
+ *--ptr = (ch | otherMark) & byteMask;
+ ch >>= 6;
+ case 1:
+ *--ptr = (ch | firstMark[count]);
+ }
+ while (count--)
+ _nc_outch(*ptr++);
+ return OK;
+}
+#endif
+
int
putp(const char *string)
{
diff --git a/lib/libcurses/tinfo/parse_entry.c b/lib/libcurses/tinfo/parse_entry.c
index 3f03844dc48..9ee99320357 100644
--- a/lib/libcurses/tinfo/parse_entry.c
+++ b/lib/libcurses/tinfo/parse_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse_entry.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */
+/* $OpenBSD: parse_entry.c,v 1.7 2000/06/19 03:53:51 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -49,7 +49,7 @@
#define __INTERNAL_CAPS_VISIBLE
#include <term_entry.h>
-MODULE_ID("$From: parse_entry.c,v 1.43 2000/03/12 00:09:06 tom Exp $")
+MODULE_ID("$From: parse_entry.c,v 1.44 2000/04/30 00:17:42 tom Exp $")
#ifdef LINT
static short const parametrized[] =
@@ -58,9 +58,6 @@ static short const parametrized[] =
#include <parametrized.h>
#endif
-struct token _nc_curr_token =
-{0, 0, 0};
-
static void postprocess_termcap(TERMTYPE *, bool);
static void postprocess_terminfo(TERMTYPE *);
static struct name_table_entry const *lookup_fullname(const char *name);
diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c
index 37fb06dc3a9..68592645c60 100644
--- a/lib/libcurses/tinfo/read_termcap.c
+++ b/lib/libcurses/tinfo/read_termcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_termcap.c,v 1.8 2000/04/14 19:14:02 millert Exp $ */
+/* $OpenBSD: read_termcap.c,v 1.9 2000/06/19 03:53:52 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -57,7 +57,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$From: read_termcap.c,v 1.46 2000/03/18 21:53:26 tom Exp $")
+MODULE_ID("$From: read_termcap.c,v 1.47 2000/04/15 16:53:19 Todd.C.Miller Exp $")
#ifndef PURE_TERMINFO
@@ -925,9 +925,9 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp)
static char *source;
static int lineno;
- if (!issetugid() && (p = getenv("TERMCAP")) != 0 && !is_pathname(p) &&
- _nc_name_match(p, tn, "|:")) {
-
+ if (!issetugid() && (p = getenv("TERMCAP")) != 0
+ && !is_pathname(p) && _nc_name_match(p, tn, "|:")) {
+ /* TERMCAP holds a termcap entry */
strlcpy(tc, p, sizeof(tc));
_nc_set_source("TERMCAP");
} else {