summaryrefslogtreecommitdiff
path: root/lib/libcurses/tinfo
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcurses/tinfo')
-rw-r--r--lib/libcurses/tinfo/MKcaptab.awk9
-rw-r--r--lib/libcurses/tinfo/MKfallback.sh6
-rw-r--r--lib/libcurses/tinfo/MKnames.awk10
-rw-r--r--lib/libcurses/tinfo/access.c12
-rw-r--r--lib/libcurses/tinfo/add_tries.c8
-rw-r--r--lib/libcurses/tinfo/alloc_entry.c66
-rw-r--r--lib/libcurses/tinfo/alloc_ttype.c14
-rw-r--r--lib/libcurses/tinfo/captoinfo.c65
-rw-r--r--lib/libcurses/tinfo/comp_error.c5
-rw-r--r--lib/libcurses/tinfo/comp_expand.c262
-rw-r--r--lib/libcurses/tinfo/comp_parse.c101
-rw-r--r--lib/libcurses/tinfo/comp_scan.c64
-rw-r--r--lib/libcurses/tinfo/doalloc.c33
-rw-r--r--lib/libcurses/tinfo/free_ttype.c13
-rw-r--r--lib/libcurses/tinfo/getenv_num.c32
-rw-r--r--lib/libcurses/tinfo/home_terminfo.c6
-rw-r--r--lib/libcurses/tinfo/init_keytry.c40
-rw-r--r--lib/libcurses/tinfo/lib_acs.c212
-rw-r--r--lib/libcurses/tinfo/lib_baudrate.c16
-rw-r--r--lib/libcurses/tinfo/lib_cur_term.c48
-rw-r--r--lib/libcurses/tinfo/lib_data.c37
-rw-r--r--lib/libcurses/tinfo/lib_has_cap.c31
-rw-r--r--lib/libcurses/tinfo/lib_kernel.c74
-rw-r--r--lib/libcurses/tinfo/lib_longname.c21
-rw-r--r--lib/libcurses/tinfo/lib_napms.c6
-rw-r--r--lib/libcurses/tinfo/lib_options.c30
-rw-r--r--lib/libcurses/tinfo/lib_print.c35
-rw-r--r--lib/libcurses/tinfo/lib_raw.c18
-rw-r--r--lib/libcurses/tinfo/lib_setup.c51
-rw-r--r--lib/libcurses/tinfo/lib_termcap.c26
-rw-r--r--lib/libcurses/tinfo/lib_termname.c28
-rw-r--r--lib/libcurses/tinfo/lib_tgoto.c37
-rw-r--r--lib/libcurses/tinfo/lib_ti.c10
-rw-r--r--lib/libcurses/tinfo/lib_tparm.c13
-rw-r--r--lib/libcurses/tinfo/lib_tputs.c38
-rw-r--r--lib/libcurses/tinfo/lib_ttyflags.c141
-rw-r--r--lib/libcurses/tinfo/make_keys.c156
-rw-r--r--lib/libcurses/tinfo/name_match.c81
-rw-r--r--lib/libcurses/tinfo/parse_entry.c95
-rw-r--r--lib/libcurses/tinfo/read_entry.c20
-rw-r--r--lib/libcurses/tinfo/read_termcap.c21
-rw-r--r--lib/libcurses/tinfo/setbuf.c60
-rw-r--r--lib/libcurses/tinfo/strings.c28
-rw-r--r--lib/libcurses/tinfo/write_entry.c32
44 files changed, 1123 insertions, 988 deletions
diff --git a/lib/libcurses/tinfo/MKcaptab.awk b/lib/libcurses/tinfo/MKcaptab.awk
index 8d9a41b4877..4f5df3afdb2 100644
--- a/lib/libcurses/tinfo/MKcaptab.awk
+++ b/lib/libcurses/tinfo/MKcaptab.awk
@@ -1,6 +1,6 @@
#!/bin/sh
-# $OpenBSD: MKcaptab.awk,v 1.2 1999/01/24 20:06:47 millert Exp $
-# $From: MKcaptab.awk,v 1.11 1999/01/24 02:46:42 Jeffrey.C.Honig Exp $
+# $OpenBSD: MKcaptab.awk,v 1.3 2001/01/22 18:01:49 millert Exp $
+# $From: MKcaptab.awk,v 1.12 2000/12/10 00:14:12 tom Exp $
AWK=${1-awk}
DATA=${2-../include/Caps}
@@ -12,6 +12,7 @@ cat <<'EOF'
*/
#include <ncurses_cfg.h>
+#include <curses.priv.h>
#include <tic.h>
#include <term.h>
@@ -59,12 +60,12 @@ cat <<'EOF'
{(char *)NULL, (char *)NULL, (char *)NULL}
};
-const struct name_table_entry *_nc_get_table(bool termcap)
+NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool termcap)
{
return termcap ? _nc_cap_table: _nc_info_table ;
}
-const struct name_table_entry * const * _nc_get_hash_table(bool termcap)
+NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_table (bool termcap)
{
return termcap ? _nc_cap_hash_table: _nc_info_hash_table ;
}
diff --git a/lib/libcurses/tinfo/MKfallback.sh b/lib/libcurses/tinfo/MKfallback.sh
index 0c1eaef70c7..ce7d14cb7a4 100644
--- a/lib/libcurses/tinfo/MKfallback.sh
+++ b/lib/libcurses/tinfo/MKfallback.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# $OpenBSD: MKfallback.sh,v 1.2 1999/06/27 08:14:21 millert Exp $
-# $From: MKfallback.sh,v 1.9 1999/06/15 22:57:45 tom Exp $
+# $OpenBSD: MKfallback.sh,v 1.3 2001/01/22 18:01:50 millert Exp $
+# $From: MKfallback.sh,v 1.10 2000/12/10 00:14:39 tom Exp $
#
# MKfallback.sh -- create fallback table for entry reads
#
@@ -51,7 +51,7 @@ EOF
fi
cat <<EOF
-const TERMTYPE *_nc_fallback(const char *name GCC_UNUSED)
+NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *name GCC_UNUSED)
{
EOF
diff --git a/lib/libcurses/tinfo/MKnames.awk b/lib/libcurses/tinfo/MKnames.awk
index 7f49c21b9f5..5fdb8c20690 100644
--- a/lib/libcurses/tinfo/MKnames.awk
+++ b/lib/libcurses/tinfo/MKnames.awk
@@ -1,5 +1,5 @@
-# $OpenBSD
-# $From: MKnames.awk,v 1.10 1999/01/16 23:36:34 tom Exp $
+# $OpenBSD: MKnames.awk,v 1.2 2001/01/22 18:01:50 millert Exp $
+# $From: MKnames.awk,v 1.11 2000/12/09 23:46:13 tom Exp $
BEGIN {
print "/* This file was generated by MKnames.awk */" > "namehdr"
print "" > "namehdr"
@@ -11,7 +11,7 @@ BEGIN {
print "#include <term.h>" > "namehdr"
print "#define DCL(it) static IT data##it[]" > "namehdr"
print "#else" > "namehdr"
- print "#define DCL(it) IT it[]" > "namehdr"
+ print "#define DCL(it) NCURSES_EXPORT_VAR(IT) it[]" > "namehdr"
print "#endif" > "namehdr"
print "" > "namehdr"
print "/*" > "boolnames"
@@ -81,7 +81,7 @@ END {
print "};" > "strcodes"
print "" > "strcodes"
print "#if BROKEN_LINKER" > "nameftr"
- print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "nameftr"
+ print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "nameftr"
print "FIX(boolnames)" > "nameftr"
print "FIX(boolfnames)" > "nameftr"
print "FIX(numnames)" > "nameftr"
@@ -91,7 +91,7 @@ END {
print "#endif /* BROKEN_LINKER */" > "nameftr"
print "" > "codeftr"
print "#if BROKEN_LINKER" > "codeftr"
- print "#define FIX(it) IT *_nc_##it(void) { return data##it; }" > "codeftr"
+ print "#define FIX(it) NCURSES_IMPEXP IT * NCURSES_API _nc_##it(void) { return data##it; }" > "codeftr"
print "FIX(boolcodes)" > "codeftr"
print "FIX(numcodes)" > "codeftr"
print "FIX(strcodes)" > "codeftr"
diff --git a/lib/libcurses/tinfo/access.c b/lib/libcurses/tinfo/access.c
index 5c0e4c64920..7a2bc501c50 100644
--- a/lib/libcurses/tinfo/access.c
+++ b/lib/libcurses/tinfo/access.c
@@ -33,9 +33,9 @@
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$From: access.c,v 1.4 2000/10/08 01:25:06 tom Exp $")
+MODULE_ID("$From: access.c,v 1.7 2000/12/10 02:55:07 tom Exp $")
-char *
+NCURSES_EXPORT(char *)
_nc_basename(char *path)
{
char *result = strrchr(path, '/');
@@ -50,7 +50,7 @@ _nc_basename(char *path)
return result;
}
-int
+NCURSES_EXPORT(int)
_nc_access(const char *path, int mode)
{
if (access(path, mode) < 0) {
@@ -78,7 +78,7 @@ _nc_access(const char *path, int mode)
* Returns true if we allow application to use environment variables that are
* used for searching lists of directories, etc.
*/
-int
+NCURSES_EXPORT(int)
_nc_env_access(void)
{
#if HAVE_ISSETUGID
@@ -86,9 +86,9 @@ _nc_env_access(void)
return FALSE;
#elif HAVE_GETEUID && HAVE_GETEGID
if (getuid() != geteuid()
- || getgid() != getegid())
+ || getgid() != getegid())
return FALSE;
#endif
- return getuid() != 0; /* ...finally, disallow root */
+ return getuid() != 0 && geteuid() != 0; /* ...finally, disallow root */
}
#endif
diff --git a/lib/libcurses/tinfo/add_tries.c b/lib/libcurses/tinfo/add_tries.c
index fddee879548..55ad69543d5 100644
--- a/lib/libcurses/tinfo/add_tries.c
+++ b/lib/libcurses/tinfo/add_tries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add_tries.c,v 1.2 2000/03/26 16:45:03 millert Exp $ */
+/* $OpenBSD: add_tries.c,v 1.3 2001/01/22 18:01:50 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,2000 Free Software Foundation, Inc. *
@@ -41,12 +41,12 @@
#include <curses.priv.h>
-MODULE_ID("$From: add_tries.c,v 1.2 2000/03/18 22:23:56 tom Exp $")
+MODULE_ID("$From: add_tries.c,v 1.4 2000/12/10 02:55:07 tom Exp $")
#define SET_TRY(dst,src) if ((dst->ch = *src++) == 128) dst->ch = '\0'
#define CMP_TRY(a,b) ((a)? (a == b) : (b == 128))
-void
+NCURSES_EXPORT(void)
_nc_add_to_try(struct tries **tree, const char *str, unsigned short code)
{
static bool out_of_memory = FALSE;
@@ -63,7 +63,7 @@ _nc_add_to_try(struct tries **tree, const char *str, unsigned short code)
unsigned char cmp = *txt;
while (!CMP_TRY(ptr->ch, cmp)
- && ptr->sibling != 0)
+ && ptr->sibling != 0)
ptr = ptr->sibling;
if (CMP_TRY(ptr->ch, cmp)) {
diff --git a/lib/libcurses/tinfo/alloc_entry.c b/lib/libcurses/tinfo/alloc_entry.c
index b019f59ce6e..8429ab5fbbc 100644
--- a/lib/libcurses/tinfo/alloc_entry.c
+++ b/lib/libcurses/tinfo/alloc_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc_entry.c,v 1.3 2000/03/13 23:53:39 millert Exp $ */
+/* $OpenBSD: alloc_entry.c,v 1.4 2001/01/22 18:01:50 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,2000 Free Software Foundation, Inc. *
@@ -49,7 +49,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$From: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $")
+MODULE_ID("$From: alloc_entry.c,v 1.35 2001/01/13 22:40:17 tom Exp $")
#define ABSENT_OFFSET -1
#define CANCELLED_OFFSET -2
@@ -59,7 +59,7 @@ MODULE_ID("$From: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $")
static char stringbuf[MAX_STRTAB]; /* buffer for string capabilities */
static size_t next_free; /* next free character in stringbuf */
-void
+NCURSES_EXPORT(void)
_nc_init_entry(TERMTYPE * const tp)
/* initialize a terminal type data block */
{
@@ -92,7 +92,7 @@ _nc_init_entry(TERMTYPE * const tp)
next_free = 0;
}
-ENTRY *
+NCURSES_EXPORT(ENTRY *)
_nc_copy_entry(ENTRY * oldp)
{
ENTRY *newp = typeCalloc(ENTRY, 1);
@@ -104,7 +104,7 @@ _nc_copy_entry(ENTRY * oldp)
return newp;
}
-char *
+NCURSES_EXPORT(char *)
_nc_save_str(const char *const string)
/* save a copy of string in the string buffer */
{
@@ -120,14 +120,35 @@ _nc_save_str(const char *const string)
return (stringbuf + old_next_free);
}
-void
-_nc_wrap_entry(ENTRY * const ep)
+NCURSES_EXPORT(void)
+_nc_wrap_entry(ENTRY * const ep, bool copy_strings)
/* copy the string parts to allocated storage, preserving pointers to it */
{
int offsets[MAX_ENTRY_SIZE / 2], useoffsets[MAX_USES];
int i, n;
TERMTYPE *tp = &(ep->tterm);
+ if (copy_strings) {
+ next_free = 0; /* clear static storage */
+
+ /* copy term_names, Strings, uses */
+ tp->term_names = _nc_save_str(tp->term_names);
+ for_each_string(i, tp) {
+ if (tp->Strings[i] != ABSENT_STRING &&
+ tp->Strings[i] != CANCELLED_STRING) {
+ tp->Strings[i] = _nc_save_str(tp->Strings[i]);
+ }
+ }
+
+ for (i = 0; i < ep->nuses; i++) {
+ if (ep->uses[i].name == 0) {
+ ep->uses[i].name = _nc_save_str(ep->uses[i].name);
+ }
+ }
+
+ free(tp->str_table);
+ }
+
n = tp->term_names - stringbuf;
for_each_string(i, &(ep->tterm)) {
if (tp->Strings[i] == ABSENT_STRING)
@@ -160,18 +181,20 @@ _nc_wrap_entry(ENTRY * const ep)
}
#if NCURSES_XNAMES
- if ((n = NUM_EXT_NAMES(tp)) != 0) {
- unsigned length = 0;
- for (i = 0; i < n; i++) {
- length += strlen(tp->ext_Names[i]) + 1;
- offsets[i] = tp->ext_Names[i] - stringbuf;
- }
- if ((tp->ext_str_table = typeMalloc(char, length)) == 0)
- _nc_err_abort("Out of memory");
- for (i = 0, length = 0; i < n; i++) {
- tp->ext_Names[i] = tp->ext_str_table + length;
- strcpy(tp->ext_Names[i], stringbuf + offsets[i]);
- length += strlen(tp->ext_Names[i]) + 1;
+ if (!copy_strings) {
+ if ((n = NUM_EXT_NAMES(tp)) != 0) {
+ unsigned length = 0;
+ for (i = 0; i < n; i++) {
+ length += strlen(tp->ext_Names[i]) + 1;
+ offsets[i] = tp->ext_Names[i] - stringbuf;
+ }
+ if ((tp->ext_str_table = typeMalloc(char, length)) == 0)
+ _nc_err_abort("Out of memory");
+ for (i = 0, length = 0; i < n; i++) {
+ tp->ext_Names[i] = tp->ext_str_table + length;
+ strcpy(tp->ext_Names[i], stringbuf + offsets[i]);
+ length += strlen(tp->ext_Names[i]) + 1;
+ }
}
}
#endif
@@ -184,8 +207,9 @@ _nc_wrap_entry(ENTRY * const ep)
}
}
-void
-_nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from)
+NCURSES_EXPORT(void)
+_nc_merge_entry
+(TERMTYPE * const to, TERMTYPE * const from)
/* merge capabilities from `from' entry into `to' entry */
{
int i;
diff --git a/lib/libcurses/tinfo/alloc_ttype.c b/lib/libcurses/tinfo/alloc_ttype.c
index c03a3a5919c..43583824c0f 100644
--- a/lib/libcurses/tinfo/alloc_ttype.c
+++ b/lib/libcurses/tinfo/alloc_ttype.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc_ttype.c,v 1.4 2000/10/08 22:47:00 millert Exp $ */
+/* $OpenBSD: alloc_ttype.c,v 1.5 2001/01/22 18:01:50 millert Exp $ */
/****************************************************************************
* Copyright (c) 1999,2000 Free Software Foundation, Inc. *
@@ -45,7 +45,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$From: alloc_ttype.c,v 1.10 2000/08/12 21:56:24 tom Exp $")
+MODULE_ID("$From: alloc_ttype.c,v 1.12 2000/12/10 02:55:07 tom Exp $")
#if NCURSES_XNAMES
/*
@@ -372,8 +372,9 @@ adjust_cancels(TERMTYPE * to, TERMTYPE * from)
}
}
-void
-_nc_align_termtype(TERMTYPE * to, TERMTYPE * from)
+NCURSES_EXPORT(void)
+_nc_align_termtype
+(TERMTYPE * to, TERMTYPE * from)
{
int na = NUM_EXT_NAMES(to);
int nb = NUM_EXT_NAMES(from);
@@ -457,8 +458,9 @@ _nc_align_termtype(TERMTYPE * to, TERMTYPE * from)
}
#endif
-void
-_nc_copy_termtype(TERMTYPE * dst, TERMTYPE * src)
+NCURSES_EXPORT(void)
+_nc_copy_termtype
+(TERMTYPE * dst, TERMTYPE * src)
{
int i;
diff --git a/lib/libcurses/tinfo/captoinfo.c b/lib/libcurses/tinfo/captoinfo.c
index 2a797d038e5..c36f7160660 100644
--- a/lib/libcurses/tinfo/captoinfo.c
+++ b/lib/libcurses/tinfo/captoinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: captoinfo.c,v 1.8 2000/04/04 16:49:59 millert Exp $ */
+/* $OpenBSD: captoinfo.c,v 1.9 2001/01/22 18:01:50 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -41,7 +41,7 @@
*
* There is just one entry point:
*
- * char *captoinfo(n, s, parametrized)
+ * char *_nc_captoinfo(n, s, parametrized)
*
* Convert value s for termcap string capability named n into terminfo
* format.
@@ -94,7 +94,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$From: captoinfo.c,v 1.37 2000/04/01 20:07:34 tom Exp $")
+MODULE_ID("$From: captoinfo.c,v 1.40 2000/11/05 00:22:36 tom Exp $")
#define MAX_PUSHED 16 /* max # args we can push onto the stack */
@@ -196,7 +196,7 @@ cvtchar(register const char *sp)
case '2':
case '3':
len = 1;
- while (isdigit(*sp)) {
+ while (isdigit(CharOf(*sp))) {
c = 8 * c + (*sp++ - '0');
len++;
}
@@ -270,13 +270,16 @@ getparm(int parm, int n)
}
}
+/*
+ * Convert a termcap string to terminfo format.
+ * 'cap' is the relevant terminfo capability index.
+ * 's' is the string value of the capability.
+ * 'parametrized' tells what type of translations to do:
+ * % translations if 1
+ * pad translations if >=0
+ */
char *
-_nc_captoinfo(
-/* convert a termcap string to terminfo format */
- register const char *cap, /* relevant terminfo capability index */
- register const char *s, /* string value of the capability */
- int const parametrized /* do % translations if 1, pad translations if >=0 */
-)
+_nc_captoinfo(const char *cap, const char *s, int const parametrized)
{
const char *capstart;
@@ -293,9 +296,9 @@ _nc_captoinfo(
capstart = 0;
if (s == 0)
s = "";
- if (parametrized >= 0 && isdigit(*s))
+ if (parametrized >= 0 && isdigit(CharOf(*s)))
for (capstart = s;; s++)
- if (!(isdigit(*s) || *s == '*' || *s == '.'))
+ if (!(isdigit(CharOf(*s)) || *s == '*' || *s == '.'))
break;
while (*s != '\0') {
@@ -351,7 +354,7 @@ _nc_captoinfo(
break;
case 'a':
if ((*s == '=' || *s == '+' || *s == '-'
- || *s == '*' || *s == '/')
+ || *s == '*' || *s == '/')
&& (s[1] == 'p' || s[1] == 'c')
&& s[2] != '\0') {
int l;
@@ -463,7 +466,7 @@ _nc_captoinfo(
dp = save_char(dp, '%');
s--;
_nc_warning("unknown %% code %s (%#x) in %s",
- unctrl(*s), (*s) & 0xff, cap);
+ unctrl((chtype) * s), CharOf(*s), cap);
break;
}
break;
@@ -544,7 +547,7 @@ _nc_captoinfo(
if (capstart) {
dp = save_string(dp, "$<");
for (s = capstart;; s++)
- if (isdigit(*s) || *s == '*' || *s == '.')
+ if (isdigit(CharOf(*s)) || *s == '*' || *s == '.')
dp = save_char(dp, *s);
else
break;
@@ -568,8 +571,8 @@ bcd_expression(const char *str)
char ch1, ch2;
if (sscanf(str, fmt, &ch1, &ch2) == 2
- && isdigit(ch1)
- && isdigit(ch2)
+ && isdigit(CharOf(ch1))
+ && isdigit(CharOf(ch2))
&& (ch1 == ch2)) {
len = 28;
#ifndef NDEBUG
@@ -596,7 +599,7 @@ save_tc_char(char *bufptr, int c1)
bufptr = save_char(bufptr, c1);
} else {
if (c1 == (c1 & 0x1f)) /* iscntrl() returns T on 255 */
- (void) strcpy(temp, unctrl(c1));
+ (void) strcpy(temp, unctrl((chtype) c1));
else
(void) sprintf(temp, "\\%03o", c1);
bufptr = save_string(bufptr, temp);
@@ -631,13 +634,12 @@ save_tc_inequality(char *bufptr, int c1, int c2)
* %m exclusive-or all parameters with 0177 (not in 4.4BSD)
*/
+/*
+ * Convert a terminfo string to termcap format. Parameters are as in
+ * _nc_captoinfo().
+ */
char *
-_nc_infotocap(
-/* convert a terminfo string to termcap format */
- register const char *cap GCC_UNUSED, /* relevant termcap capability index */
- register const char *str, /* string value of the capability */
- int const parametrized /* do % translations if 1, pad translations if >=0 */
-)
+_nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parametrized)
{
int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0;
const char *padding;
@@ -651,13 +653,13 @@ _nc_infotocap(
padding = str + strlen(str) - 1;
if (*padding == '>' && *--padding == '/') {
--padding;
- while (isdigit(*padding) || *padding == '.' || *padding == '*')
+ while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*')
padding--;
if (*padding == '<' && *--padding == '$')
trimmed = padding;
padding += 2;
- while (isdigit(*padding) || *padding == '.' || *padding == '*')
+ while (isdigit(CharOf(*padding)) || *padding == '.' || *padding == '*')
bufptr = save_char(bufptr, *padding++);
}
@@ -669,8 +671,11 @@ _nc_infotocap(
bufptr = save_char(bufptr, *++str);
} else if (str[0] == '$' && str[1] == '<') { /* discard padding */
str += 2;
- while (isdigit(*str) || *str == '.' || *str == '*' || *str ==
- '/' || *str == '>')
+ while (isdigit(CharOf(*str))
+ || *str == '.'
+ || *str == '*'
+ || *str == '/'
+ || *str == '>')
str++;
--str;
} else if (str[0] == '%' && str[1] == '%') { /* escaped '%' */
@@ -694,7 +699,7 @@ _nc_infotocap(
bufptr = save_string(bufptr, "%B");
} else if ((sscanf(str, "%%{%d}%%+%%c", &c1) == 1
|| sscanf(str, "%%'%c'%%+%%c", &ch1) == 1)
- && (cp = strchr(str, '+'))) {
+ && (cp = strchr(str, '+'))) {
str = cp + 2;
bufptr = save_string(bufptr, "%+");
@@ -734,7 +739,7 @@ _nc_infotocap(
case '8':
case '9':
bufptr = save_char(bufptr, '%');
- while (isdigit(*str))
+ while (isdigit(CharOf(*str)))
bufptr = save_char(bufptr, *str++);
if (strchr("doxX.", *str)) {
if (*str != 'd') /* termcap doesn't have octal, hex */
diff --git a/lib/libcurses/tinfo/comp_error.c b/lib/libcurses/tinfo/comp_error.c
index 38580200f4d..cfa5dfd59be 100644
--- a/lib/libcurses/tinfo/comp_error.c
+++ b/lib/libcurses/tinfo/comp_error.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: comp_error.c,v 1.2 1999/11/28 17:49:53 millert Exp $ */
+/* $OpenBSD: comp_error.c,v 1.3 2001/01/22 18:01:50 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998,1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
* comp_error.c -- Error message routines
*
diff --git a/lib/libcurses/tinfo/comp_expand.c b/lib/libcurses/tinfo/comp_expand.c
index bf2bb3d397d..3de650bd120 100644
--- a/lib/libcurses/tinfo/comp_expand.c
+++ b/lib/libcurses/tinfo/comp_expand.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: comp_expand.c,v 1.3 1999/03/11 21:03:57 millert Exp $ */
+/* $OpenBSD: comp_expand.c,v 1.4 2001/01/22 18:01:51 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -37,13 +37,14 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$From: comp_expand.c,v 1.11 1999/03/07 00:51:07 tom Exp $")
+MODULE_ID("$From: comp_expand.c,v 1.15 2000/12/10 01:30:10 tom Exp $")
-static int trailing_spaces(const char *src)
+static int
+trailing_spaces(const char *src)
{
- while (*src == ' ')
- src++;
- return *src == 0;
+ while (*src == ' ')
+ src++;
+ return *src == 0;
}
/* this deals with differences over whether 0x7f and 0x80..0x9f are controls */
@@ -51,141 +52,136 @@ static int trailing_spaces(const char *src)
#define REALCTL(s) (CHAR_OF(s) < 127 && iscntrl(CHAR_OF(s)))
#define REALPRINT(s) (CHAR_OF(s) < 127 && isprint(CHAR_OF(s)))
-char *_nc_tic_expand(const char *srcp, bool tic_format, int numbers)
+NCURSES_EXPORT(char *)
+_nc_tic_expand
+(const char *srcp, bool tic_format, int numbers)
{
-static char * buffer;
-static size_t length;
+ static char *buffer;
+ static size_t length;
-int bufp;
-const char *ptr, *str = VALID_STRING(srcp) ? srcp : "";
-bool islong = (strlen(str) > 3);
-size_t need = (2 + strlen(str)) * 4;
-int ch;
+ int bufp;
+ const char *str = VALID_STRING(srcp) ? srcp : "";
+ bool islong = (strlen(str) > 3);
+ size_t need = (2 + strlen(str)) * 4;
+ int ch;
- if (buffer == 0 || need > length) {
- if ((buffer = typeRealloc(char, length = need, buffer)) == 0)
- return 0;
- }
+ if (buffer == 0 || need > length) {
+ if ((buffer = typeRealloc(char, length = need, buffer)) == 0)
+ return 0;
+ }
- bufp = 0;
- ptr = str;
- while ((ch = (*str & 0xff)) != 0) {
- if (ch == '%' && REALPRINT(str+1)) {
- buffer[bufp++] = *str++;
- /*
- * Though the character literals are more compact, most
- * terminal descriptions use numbers and are not easy
- * to read in character-literal form.
- */
- switch (numbers) {
- case -1:
- if (str[0] == S_QUOTE
- && str[1] != '\\'
- && REALPRINT(str+1)
- && str[2] == S_QUOTE) {
- sprintf(buffer+bufp, "{%d}", str[1]);
- bufp += strlen(buffer+bufp);
- str += 2;
- } else {
- buffer[bufp++] = *str;
- }
- break;
- /*
- * If we have a "%{number}", try to translate it into
- * a "%'char'" form, since that will run a little faster
- * when we're interpreting it. Also, having one form
- * for the constant makes it simpler to compare terminal
- * descriptions.
- */
- case 1:
- if (str[0] == L_BRACE
- && isdigit(str[1])) {
- char *dst = 0;
- long value = strtol(str+1, &dst, 0);
- if (dst != 0
- && *dst == R_BRACE
- && value < 127
- && value != '\\' /* FIXME */
- && isprint((int)value)) {
- ch = (int)value;
- buffer[bufp++] = S_QUOTE;
- if (ch == '\\'
- || ch == S_QUOTE)
- buffer[bufp++] = '\\';
- buffer[bufp++] = ch;
- buffer[bufp++] = S_QUOTE;
- str = dst;
- } else {
- buffer[bufp++] = *str;
- }
- } else {
- buffer[bufp++] = *str;
- }
- break;
- default:
- buffer[bufp++] = *str;
- break;
- }
- }
- else if (ch == 128) {
- buffer[bufp++] = '\\';
- buffer[bufp++] = '0';
- }
- else if (ch == '\033') {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 'E';
- }
- else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) {
- buffer[bufp++] = '\\';
- buffer[bufp++] = '\\';
- }
- else if (ch == ' ' && tic_format && (str == srcp || trailing_spaces(str))) {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 's';
+ bufp = 0;
+ while ((ch = CharOf(*str)) != 0) {
+ if (ch == '%' && REALPRINT(str + 1)) {
+ buffer[bufp++] = *str++;
+ /*
+ * Though the character literals are more compact, most
+ * terminal descriptions use numbers and are not easy
+ * to read in character-literal form.
+ */
+ switch (numbers) {
+ case -1:
+ if (str[0] == S_QUOTE
+ && str[1] != '\\'
+ && REALPRINT(str + 1)
+ && str[2] == S_QUOTE) {
+ sprintf(buffer + bufp, "{%d}", str[1]);
+ bufp += strlen(buffer + bufp);
+ str += 2;
+ } else {
+ buffer[bufp++] = *str;
}
- else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) {
- buffer[bufp++] = '\\';
+ break;
+ /*
+ * If we have a "%{number}", try to translate it into
+ * a "%'char'" form, since that will run a little faster
+ * when we're interpreting it. Also, having one form
+ * for the constant makes it simpler to compare terminal
+ * descriptions.
+ */
+ case 1:
+ if (str[0] == L_BRACE
+ && isdigit(CharOf(str[1]))) {
+ char *dst = 0;
+ long value = strtol(str + 1, &dst, 0);
+ if (dst != 0
+ && *dst == R_BRACE
+ && value < 127
+ && value != '\\' /* FIXME */
+ && isprint((int) value)) {
+ ch = (int) value;
+ buffer[bufp++] = S_QUOTE;
+ if (ch == '\\'
+ || ch == S_QUOTE)
+ buffer[bufp++] = '\\';
buffer[bufp++] = ch;
+ buffer[bufp++] = S_QUOTE;
+ str = dst;
+ } else {
+ buffer[bufp++] = *str;
+ }
+ } else {
+ buffer[bufp++] = *str;
}
- else if (REALPRINT(str) && (ch != ',' && ch != ':' && !(ch == '!' && !tic_format) && ch != '^'))
- buffer[bufp++] = ch;
-#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */
- else if (ch == '\b') {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 'b';
- }
- else if (ch == '\f') {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 'f';
- }
- else if (ch == '\t' && islong) {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 't';
- }
+ break;
+ default:
+ buffer[bufp++] = *str;
+ break;
+ }
+ } else if (ch == 128) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = '0';
+ } else if (ch == '\033') {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'E';
+ } else if (ch == '\\' && tic_format && (str == srcp || str[-1] != '^')) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = '\\';
+ } else if (ch == ' ' && tic_format && (str == srcp ||
+ trailing_spaces(str))) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 's';
+ } else if ((ch == ',' || ch == ':' || ch == '^') && tic_format) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = ch;
+ } else if (REALPRINT(str)
+ && (ch != ','
+ && ch != ':'
+ && !(ch == '!' && !tic_format)
+ && ch != '^'))
+ buffer[bufp++] = ch;
+#if 0 /* FIXME: this would be more readable (in fact the whole 'islong' logic should be removed) */
+ else if (ch == '\b') {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'b';
+ } else if (ch == '\f') {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'f';
+ } else if (ch == '\t' && islong) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 't';
+ }
#endif
- else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 'r';
- }
- else if (ch == '\n' && islong) {
- buffer[bufp++] = '\\';
- buffer[bufp++] = 'n';
- }
+ else if (ch == '\r' && (islong || (strlen(srcp) > 2 && str[1] == '\0'))) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'r';
+ } else if (ch == '\n' && islong) {
+ buffer[bufp++] = '\\';
+ buffer[bufp++] = 'n';
+ }
#define UnCtl(c) ((c) + '@')
- else if (REALCTL(str) && ch != '\\' && (!islong || isdigit(str[1])))
- {
- (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch));
- bufp += 2;
- }
- else
- {
- (void) sprintf(&buffer[bufp], "\\%03o", ch);
- bufp += 4;
- }
-
- str++;
+ else if (REALCTL(str) && ch != '\\'
+ && (!islong || isdigit(CharOf(str[1])))) {
+ (void) sprintf(&buffer[bufp], "^%c", UnCtl(ch));
+ bufp += 2;
+ } else {
+ (void) sprintf(&buffer[bufp], "\\%03o", ch);
+ bufp += 4;
}
- buffer[bufp] = '\0';
- return(buffer);
+ str++;
+ }
+
+ buffer[bufp] = '\0';
+ return (buffer);
}
diff --git a/lib/libcurses/tinfo/comp_parse.c b/lib/libcurses/tinfo/comp_parse.c
index 161b6d977c3..7a8992726ac 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.9 2000/10/22 18:27:23 millert Exp $ */
+/* $OpenBSD: comp_parse.c,v 1.10 2001/01/22 18:01:51 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -54,10 +54,10 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$From: comp_parse.c,v 1.42 2000/10/14 17:50:45 Bernhard.Rosenkraenzer Exp $")
+MODULE_ID("$From: comp_parse.c,v 1.48 2001/01/15 00:44:51 tom Exp $")
static void sanity_check(TERMTYPE *);
-void (*_nc_check_termtype) (TERMTYPE *) = sanity_check;
+NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check;
/****************************************************************************
*
@@ -80,10 +80,11 @@ void (*_nc_check_termtype) (TERMTYPE *) = sanity_check;
* _nc_head _nc_tail
*/
-ENTRY *_nc_head = 0, *_nc_tail = 0;
+NCURSES_EXPORT_VAR(ENTRY *) _nc_head = 0;
+NCURSES_EXPORT_VAR(ENTRY *) _nc_tail = 0;
-static void
-enqueue(ENTRY * ep)
+ static void
+ enqueue(ENTRY * ep)
/* add an entry to the in-core list */
{
ENTRY *newp = _nc_copy_entry(ep);
@@ -99,7 +100,7 @@ enqueue(ENTRY * ep)
newp->last->next = newp;
}
-void
+NCURSES_EXPORT(void)
_nc_free_entries(ENTRY * headp)
/* free the allocated storage consumed by list entries */
{
@@ -139,7 +140,7 @@ force_bar(char *dst, char *src, size_t siz)
return src;
}
-bool
+NCURSES_EXPORT(bool)
_nc_entry_match(char *n1, char *n2)
/* do any of the aliases in a pair of terminal names match? */
{
@@ -164,10 +165,10 @@ _nc_entry_match(char *n1, char *n2)
*
****************************************************************************/
-void
+NCURSES_EXPORT(void)
_nc_read_entry_source(FILE * fp, char *buf,
- int literal, bool silent,
- bool(*hook) (ENTRY *))
+ int literal, bool silent,
+ bool(*hook) (ENTRY *))
/* slurp all entries in the given file into core */
{
ENTRY thisentry;
@@ -182,7 +183,7 @@ _nc_read_entry_source(FILE * fp, char *buf,
memset(&thisentry, 0, sizeof(thisentry));
if (_nc_parse_entry(&thisentry, literal, silent) == ERR)
break;
- if (!isalnum(thisentry.tterm.term_names[0]))
+ if (!isalnum(CharOf(thisentry.tterm.term_names[0])))
_nc_err_abort("terminal names must start with letter or digit");
/*
@@ -212,7 +213,7 @@ _nc_read_entry_source(FILE * fp, char *buf,
_nc_suppress_warnings = oldsuppress;
}
-int
+NCURSES_EXPORT(int)
_nc_resolve_uses(bool fullresolve)
/* try to resolve all use capabilities */
{
@@ -229,17 +230,18 @@ _nc_resolve_uses(bool fullresolve)
for_entry_list(qp) {
int matchcount = 0;
- for_entry_list(rp)
+ for_entry_list(rp) {
if (qp > rp
- && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) {
- matchcount++;
- if (matchcount == 1) {
- (void) fprintf(stderr, "Name collision between %s",
- _nc_first_name(qp->tterm.term_names));
- multiples++;
+ && _nc_entry_match(qp->tterm.term_names, rp->tterm.term_names)) {
+ matchcount++;
+ if (matchcount == 1) {
+ (void) fprintf(stderr, "Name collision between %s",
+ _nc_first_name(qp->tterm.term_names));
+ multiples++;
+ }
+ if (matchcount >= 1)
+ (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names));
}
- if (matchcount >= 1)
- (void) fprintf(stderr, " %s", _nc_first_name(rp->tterm.term_names));
}
if (matchcount >= 1)
(void) putc('\n', stderr);
@@ -267,14 +269,15 @@ _nc_resolve_uses(bool fullresolve)
_nc_set_type(child);
/* first, try to resolve from in-core records */
- for_entry_list(rp)
+ for_entry_list(rp) {
if (rp != qp
- && _nc_name_match(rp->tterm.term_names, lookfor, "|")) {
- DEBUG(2, ("%s: resolving use=%s (in core)",
- child, lookfor));
+ && _nc_name_match(rp->tterm.term_names, lookfor, "|")) {
+ DEBUG(2, ("%s: resolving use=%s (in core)",
+ child, lookfor));
- qp->uses[i].link = rp;
- foundit = TRUE;
+ qp->uses[i].link = rp;
+ foundit = TRUE;
+ }
}
/* if that didn't work, try to merge in a compiled entry */
@@ -285,7 +288,7 @@ _nc_resolve_uses(bool fullresolve)
memset(&thisterm, 0, sizeof(thisterm));
if (_nc_read_entry(lookfor, filename, &thisterm) == 1) {
DEBUG(2, ("%s: resolving use=%s (compiled)",
- child, lookfor));
+ child, lookfor));
rp = typeMalloc(ENTRY, 1);
if (rp == 0)
@@ -333,7 +336,7 @@ _nc_resolve_uses(bool fullresolve)
for_entry_list(qp) {
if (qp->nuses > 0) {
DEBUG(2, ("%s: attempting merge",
- _nc_first_name(qp->tterm.term_names)));
+ _nc_first_name(qp->tterm.term_names)));
/*
* If any of the use entries we're looking for is
* incomplete, punt. We'll catch this entry on a
@@ -342,7 +345,7 @@ _nc_resolve_uses(bool fullresolve)
for (i = 0; i < qp->nuses; i++)
if (qp->uses[i].link->nuses) {
DEBUG(2, ("%s: use entry %d unresolved",
- _nc_first_name(qp->tterm.term_names), i));
+ _nc_first_name(qp->tterm.term_names), i));
goto incomplete;
}
@@ -360,7 +363,7 @@ _nc_resolve_uses(bool fullresolve)
*/
for (; qp->nuses; qp->nuses--)
_nc_merge_entry(&merged,
- &qp->uses[qp->nuses - 1].link->tterm);
+ &qp->uses[qp->nuses - 1].link->tterm);
/*
* Now merge in the original entry.
@@ -374,6 +377,7 @@ _nc_resolve_uses(bool fullresolve)
FreeIfNeeded(qp->tterm.Numbers);
FreeIfNeeded(qp->tterm.Strings);
qp->tterm = merged;
+ _nc_wrap_entry(qp, TRUE);
/*
* We know every entry is resolvable because name resolution
@@ -395,15 +399,18 @@ _nc_resolve_uses(bool fullresolve)
* entry there should be no cancellation markers.
*/
for_entry_list(qp) {
- for_each_boolean(j, &(qp->tterm))
- if (qp->tterm.Booleans[j] == CANCELLED_BOOLEAN)
- qp->tterm.Booleans[j] = ABSENT_BOOLEAN;
- for_each_number(j, &(qp->tterm))
+ for_each_boolean(j, &(qp->tterm)) {
+ if ((int) qp->tterm.Booleans[j] == CANCELLED_BOOLEAN)
+ qp->tterm.Booleans[j] = ABSENT_BOOLEAN;
+ }
+ for_each_number(j, &(qp->tterm)) {
if (qp->tterm.Numbers[j] == CANCELLED_NUMERIC)
- qp->tterm.Numbers[j] = ABSENT_NUMERIC;
- for_each_string(j, &(qp->tterm))
+ qp->tterm.Numbers[j] = ABSENT_NUMERIC;
+ }
+ for_each_string(j, &(qp->tterm)) {
if (qp->tterm.Strings[j] == CANCELLED_STRING)
- qp->tterm.Strings[j] = ABSENT_STRING;
+ qp->tterm.Strings[j] = ABSENT_STRING;
+ }
}
}
@@ -447,14 +454,14 @@ sanity_check(TERMTYPE * tp)
bool terminal_entry = !strchr(tp->term_names, '+');
if (terminal_entry &&
(PRESENT(set_attributes)
- || PRESENT(enter_standout_mode)
- || PRESENT(enter_underline_mode)
- || PRESENT(enter_blink_mode)
- || PRESENT(enter_bold_mode)
- || PRESENT(enter_dim_mode)
- || PRESENT(enter_secure_mode)
- || PRESENT(enter_protected_mode)
- || PRESENT(enter_reverse_mode)))
+ || PRESENT(enter_standout_mode)
+ || PRESENT(enter_underline_mode)
+ || PRESENT(enter_blink_mode)
+ || PRESENT(enter_bold_mode)
+ || PRESENT(enter_dim_mode)
+ || PRESENT(enter_secure_mode)
+ || PRESENT(enter_protected_mode)
+ || PRESENT(enter_reverse_mode)))
_nc_warning("no exit_attribute_mode");
#endif /* __UNUSED__ */
PAIRED(enter_standout_mode, exit_standout_mode)
diff --git a/lib/libcurses/tinfo/comp_scan.c b/lib/libcurses/tinfo/comp_scan.c
index 2ada427fc8c..80b4b84cec5 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.47 2000/09/24 01:15:17 tom Exp $")
+MODULE_ID("$From: comp_scan.c,v 1.52 2000/12/10 02:55:07 tom Exp $")
/*
* Maximum length of string capability we'll accept before raising an error.
@@ -60,14 +60,22 @@ MODULE_ID("$From: comp_scan.c,v 1.47 2000/09/24 01:15:17 tom Exp $")
#define iswhite(ch) (ch == ' ' || ch == '\t')
-int _nc_syntax = 0; /* termcap or terminfo? */
-long _nc_curr_file_pos = 0; /* file offset of current line */
-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};
+NCURSES_EXPORT_VAR(int)
+_nc_syntax = 0; /* termcap or terminfo? */
+NCURSES_EXPORT_VAR(long)
+_nc_curr_file_pos = 0; /* file offset of current line */
+NCURSES_EXPORT_VAR(long)
+_nc_comment_start = 0; /* start of comment range before name */
+NCURSES_EXPORT_VAR(long)
+_nc_comment_end = 0; /* end of comment range before name */
+NCURSES_EXPORT_VAR(long)
+_nc_start_line = 0; /* start line of current entry */
+
+NCURSES_EXPORT_VAR(struct token)
+_nc_curr_token =
+{
+ 0, 0, 0
+};
/*****************************************************************************
*
@@ -81,18 +89,18 @@ static int pushtype; /* type of pushback token */
static char pushname[MAX_NAME_SIZE + 1];
#if NCURSES_EXT_FUNCS
-bool _nc_disable_period = FALSE; /* used by tic -a option */
+NCURSES_EXPORT_VAR(bool) _nc_disable_period = FALSE; /* used by tic -a option */
#endif
-static int last_char(void);
-static int next_char(void);
-static long stream_pos(void);
-static bool end_of_stream(void);
-static void push_back(char c);
+ static int last_char(void);
+ static int next_char(void);
+ static long stream_pos(void);
+ static bool end_of_stream(void);
+ static void push_back(char c);
/* Assume we may be looking at a termcap-style continuation */
-static inline int
-eat_escaped_newline(int ch)
+ static inline int
+ eat_escaped_newline(int ch)
{
if (ch == '\\')
while ((ch = next_char()) == '\n' || iswhite(ch))
@@ -133,7 +141,7 @@ eat_escaped_newline(int ch)
*
*/
-int
+NCURSES_EXPORT(int)
_nc_get_token(void)
{
static const char terminfo_punct[] = "@%&*!#";
@@ -203,7 +211,7 @@ _nc_get_token(void)
#endif
&& !strchr(terminfo_punct, (char) ch)) {
_nc_warning("Illegal character (expected alphanumeric or %s) - %s",
- terminfo_punct, unctrl(ch));
+ terminfo_punct, unctrl((chtype) ch));
_nc_panic_mode(separator);
goto start_token;
}
@@ -296,7 +304,7 @@ _nc_get_token(void)
* dangerous due to shell expansion.
*/
for (ptr = buffer; ptr < desc; ptr++) {
- if (isspace(*ptr)) {
+ if (isspace(CharOf(*ptr))) {
_nc_warning("whitespace in name or alias field");
break;
} else if (*ptr == '/') {
@@ -338,7 +346,7 @@ _nc_get_token(void)
case '@':
if ((ch = next_char()) != separator)
_nc_warning("Missing separator after `%s', have %s",
- buffer, unctrl(ch));
+ buffer, unctrl((chtype) ch));
_nc_curr_token.tk_name = buffer;
type = CANCEL;
break;
@@ -376,7 +384,7 @@ _nc_get_token(void)
default:
/* just to get rid of the compiler warning */
type = UNDEF;
- _nc_warning("Illegal character - %s", unctrl(ch));
+ _nc_warning("Illegal character - %s", unctrl((chtype) ch));
}
} /* end else (first_column == FALSE) */
} /* end else (ch != EOF) */
@@ -454,11 +462,11 @@ _nc_get_token(void)
*
*/
-char
+NCURSES_EXPORT(char)
_nc_trans_string(char *ptr, char *last)
{
int count = 0;
- int number;
+ int number = 0;
int i, c;
chtype ch, last_ch = '\0';
bool ignored = FALSE;
@@ -608,7 +616,7 @@ _nc_trans_string(char *ptr, char *last)
* get_token() call.
*/
-void
+NCURSES_EXPORT(void)
_nc_push_token(int tokclass)
{
/*
@@ -627,7 +635,7 @@ _nc_push_token(int tokclass)
/*
* Panic mode error recovery - skip everything until a "ch" is found.
*/
-void
+NCURSES_EXPORT(void)
_nc_panic_mode(char ch)
{
int c;
@@ -661,7 +669,7 @@ static FILE *yyin; /* scanner's input file descriptor */
* non-null.
*/
-void
+NCURSES_EXPORT(void)
_nc_reset_input(FILE * fp, char *buf)
{
pushtype = NO_PUSHBACK;
@@ -684,7 +692,7 @@ last_char(void)
{
size_t len = strlen(bufptr);
while (len--) {
- if (!isspace(bufptr[len]))
+ if (!isspace(CharOf(bufptr[len])))
return bufptr[len];
}
return 0;
diff --git a/lib/libcurses/tinfo/doalloc.c b/lib/libcurses/tinfo/doalloc.c
index 2afac65e2ef..14628653065 100644
--- a/lib/libcurses/tinfo/doalloc.c
+++ b/lib/libcurses/tinfo/doalloc.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: doalloc.c,v 1.4 1999/05/08 20:29:01 millert Exp $ */
+/* $OpenBSD: doalloc.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -32,7 +32,6 @@
* Author: Thomas E. Dickey <dickey@clark.net> 1998 *
****************************************************************************/
-
/*
* Wrapper for malloc/realloc. Standard implementations allow realloc with
* a null pointer, but older libraries may not (e.g., SunOS).
@@ -42,31 +41,33 @@
#include <curses.priv.h>
-MODULE_ID("$From: doalloc.c,v 1.5 1999/03/14 12:25:27 tom Exp $")
+MODULE_ID("$From: doalloc.c,v 1.7 2000/12/10 02:55:07 tom Exp $")
-void *_nc_doalloc(void *oldp, size_t amount)
+NCURSES_EXPORT(void *)
+_nc_doalloc(void *oldp, size_t amount)
{
- void *newp;
+ void *newp;
- if (oldp != 0) {
- if ((newp = realloc(oldp, amount)) == 0) {
- free(oldp);
- errno = ENOMEM; /* just in case 'free' reset */
- }
- } else {
- newp = typeMalloc(char, amount);
+ if (oldp != 0) {
+ if ((newp = realloc(oldp, amount)) == 0) {
+ free(oldp);
+ errno = ENOMEM; /* just in case 'free' reset */
}
- return newp;
+ } else {
+ newp = typeMalloc(char, amount);
+ }
+ return newp;
}
#if !HAVE_STRDUP
-char *_nc_strdup(const char *src)
+NCURSES_EXPORT(char *)
+_nc_strdup(const char *src)
{
char *dst;
if (src != 0) {
dst = typeMalloc(char, strlen(src) + 1);
if (dst != 0) {
- (void)strcpy(dst, src);
+ (void) strcpy(dst, src);
}
} else {
dst = 0;
diff --git a/lib/libcurses/tinfo/free_ttype.c b/lib/libcurses/tinfo/free_ttype.c
index 31588f3f458..987a3dfd4b1 100644
--- a/lib/libcurses/tinfo/free_ttype.c
+++ b/lib/libcurses/tinfo/free_ttype.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: free_ttype.c,v 1.4 2000/07/10 03:06:16 millert Exp $ */
+/* $OpenBSD: free_ttype.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */
/****************************************************************************
* Copyright (c) 1999,2000 Free Software Foundation, Inc. *
@@ -32,7 +32,6 @@
* Author: Thomas E. Dickey <dickey@clark.net> 1999 *
****************************************************************************/
-
/*
* free_ttype.c -- allocation functions for TERMTYPE
*
@@ -46,9 +45,10 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$From: free_ttype.c,v 1.5 2000/07/08 00:43:58 tom Exp $")
+MODULE_ID("$From: free_ttype.c,v 1.7 2000/12/10 02:55:07 tom Exp $")
-void _nc_free_termtype(TERMTYPE *ptr)
+NCURSES_EXPORT(void)
+_nc_free_termtype(TERMTYPE * ptr)
{
FreeIfNeeded(ptr->str_table);
FreeIfNeeded(ptr->term_names);
@@ -63,9 +63,10 @@ void _nc_free_termtype(TERMTYPE *ptr)
}
#if NCURSES_XNAMES
-bool _nc_user_definable = TRUE;
+NCURSES_EXPORT_VAR(bool) _nc_user_definable = TRUE;
-int use_extended_names(bool flag)
+NCURSES_EXPORT(int)
+use_extended_names(bool flag)
{
int oldflag = _nc_user_definable;
_nc_user_definable = flag;
diff --git a/lib/libcurses/tinfo/getenv_num.c b/lib/libcurses/tinfo/getenv_num.c
index 21e48bdbafe..80723dbedf8 100644
--- a/lib/libcurses/tinfo/getenv_num.c
+++ b/lib/libcurses/tinfo/getenv_num.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: getenv_num.c,v 1.1 1999/01/18 19:10:15 millert Exp $ */
+/* $OpenBSD: getenv_num.c,v 1.2 2001/01/22 18:01:51 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,21 +38,21 @@
#include <curses.priv.h>
-MODULE_ID("$From: getenv_num.c,v 1.1 1998/09/19 21:30:23 tom Exp $")
+MODULE_ID("$From: getenv_num.c,v 1.3 2000/12/10 02:55:07 tom Exp $")
-int
+NCURSES_EXPORT(int)
_nc_getenv_num(const char *name)
{
- char *dst = 0;
- char *src = getenv(name);
- long value;
-
- if ((src == 0)
- || (value = strtol(src, &dst, 0)) < 0
- || (dst == src)
- || (*dst != '\0')
- || (int)value < value)
- value = -1;
-
- return (int) value;
+ char *dst = 0;
+ char *src = getenv(name);
+ long value;
+
+ if ((src == 0)
+ || (value = strtol(src, &dst, 0)) < 0
+ || (dst == src)
+ || (*dst != '\0')
+ || (int) value < value)
+ value = -1;
+
+ return (int) value;
}
diff --git a/lib/libcurses/tinfo/home_terminfo.c b/lib/libcurses/tinfo/home_terminfo.c
index 367bfa68fe7..13b0cad7e6c 100644
--- a/lib/libcurses/tinfo/home_terminfo.c
+++ b/lib/libcurses/tinfo/home_terminfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: home_terminfo.c,v 1.6 2000/10/09 14:39:50 millert Exp $ */
+/* $OpenBSD: home_terminfo.c,v 1.7 2001/01/22 18:01:51 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,2000 Free Software Foundation, Inc. *
@@ -39,13 +39,13 @@
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$From: home_terminfo.c,v 1.3 2000/10/04 02:31:53 tom Exp $");
+MODULE_ID("$From: home_terminfo.c,v 1.6 2000/12/10 02:55:07 tom Exp $")
#define my_length (strlen(home) + sizeof(PRIVATE_INFO))
/* ncurses extension...fall back on user's private directory */
-char *
+NCURSES_EXPORT(char *)
_nc_home_terminfo(void)
{
char *home;
diff --git a/lib/libcurses/tinfo/init_keytry.c b/lib/libcurses/tinfo/init_keytry.c
index d4c96517309..083861d2690 100644
--- a/lib/libcurses/tinfo/init_keytry.c
+++ b/lib/libcurses/tinfo/init_keytry.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: init_keytry.c,v 1.4 2000/03/13 23:53:40 millert Exp $ */
+/* $OpenBSD: init_keytry.c,v 1.5 2001/01/22 18:01:51 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1999,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,11 +30,11 @@
#include <curses.priv.h>
-#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */
+#include <term.h> /* keypad_xmit, keypad_local, meta_on, meta_off */
/* cursor_visible,cursor_normal,cursor_invisible */
-#include <tic.h> /* struct tinfo_fkeys */
+#include <tic.h> /* struct tinfo_fkeys */
-MODULE_ID("$From: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $")
+MODULE_ID("$From: init_keytry.c,v 1.5 2000/12/10 02:55:07 tom Exp $")
/*
** _nc_init_keytry()
@@ -54,27 +54,29 @@ MODULE_ID("$From: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $")
#endif*/
#if BROKEN_LINKER
-struct tinfo_fkeys *_nc_tinfo_fkeysf(void)
+struct tinfo_fkeys *
+_nc_tinfo_fkeysf(void)
{
- return _nc_tinfo_fkeys;
+ return _nc_tinfo_fkeys;
}
#endif
-void _nc_init_keytry(void)
+NCURSES_EXPORT(void)
+_nc_init_keytry(void)
{
- size_t n;
+ size_t n;
- /* The SP->_keytry value is initialized in newterm(), where the SP
- * structure is created, because we can not tell where keypad() or
- * mouse_activate() (which will call keyok()) are first called.
- */
+ /* The SP->_keytry value is initialized in newterm(), where the SP
+ * structure is created, because we can not tell where keypad() or
+ * mouse_activate() (which will call keyok()) are first called.
+ */
- for (n = 0; _nc_tinfo_fkeys[n].code; n++)
- if (_nc_tinfo_fkeys[n].offset < STRCOUNT)
- _nc_add_to_try(&(SP->_keytry),
- CUR Strings[_nc_tinfo_fkeys[n].offset],
- _nc_tinfo_fkeys[n].code);
+ for (n = 0; _nc_tinfo_fkeys[n].code; n++)
+ if (_nc_tinfo_fkeys[n].offset < STRCOUNT)
+ _nc_add_to_try(&(SP->_keytry),
+ CUR Strings[_nc_tinfo_fkeys[n].offset],
+ _nc_tinfo_fkeys[n].code);
#ifdef TRACE
- _nc_trace_tries(SP->_keytry);
+ _nc_trace_tries(SP->_keytry);
#endif
}
diff --git a/lib/libcurses/tinfo/lib_acs.c b/lib/libcurses/tinfo/lib_acs.c
index a9b142b9b64..9e406cf4d18 100644
--- a/lib/libcurses/tinfo/lib_acs.c
+++ b/lib/libcurses/tinfo/lib_acs.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_acs.c,v 1.3 1999/11/28 17:49:54 millert Exp $ */
+/* $OpenBSD: lib_acs.c,v 1.4 2001/01/22 18:01:52 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998,1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,109 +33,133 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
-
#include <curses.priv.h>
-#include <term.h> /* ena_acs, acs_chars */
-
-MODULE_ID("$From: lib_acs.c,v 1.16 1999/10/30 23:00:16 tom Exp $")
+#include <term.h> /* ena_acs, acs_chars */
-chtype acs_map[ACS_LEN] = { 0 };
+MODULE_ID("$From: lib_acs.c,v 1.18 2000/12/10 02:55:07 tom Exp $")
-void _nc_init_acs(void)
+NCURSES_EXPORT_VAR(chtype) acs_map[ACS_LEN] =
{
- T(("initializing ACS map"));
+ 0
+};
- /*
- * Initializations for a UNIX-like multi-terminal environment. Use
- * ASCII chars and count on the terminfo description to do better.
- */
- ACS_ULCORNER = '+'; /* should be upper left corner */
- ACS_LLCORNER = '+'; /* should be lower left corner */
- ACS_URCORNER = '+'; /* should be upper right corner */
- ACS_LRCORNER = '+'; /* should be lower right corner */
- ACS_RTEE = '+'; /* should be tee pointing left */
- ACS_LTEE = '+'; /* should be tee pointing right */
- ACS_BTEE = '+'; /* should be tee pointing up */
- ACS_TTEE = '+'; /* should be tee pointing down */
- ACS_HLINE = '-'; /* should be horizontal line */
- ACS_VLINE = '|'; /* should be vertical line */
- ACS_PLUS = '+'; /* should be large plus or crossover */
- ACS_S1 = '~'; /* should be scan line 1 */
- ACS_S9 = '_'; /* should be scan line 9 */
- ACS_DIAMOND = '+'; /* should be diamond */
- ACS_CKBOARD = ':'; /* should be checker board (stipple) */
- ACS_DEGREE = '\''; /* should be degree symbol */
- ACS_PLMINUS = '#'; /* should be plus/minus */
- ACS_BULLET = 'o'; /* should be bullet */
- ACS_LARROW = '<'; /* should be arrow pointing left */
- ACS_RARROW = '>'; /* should be arrow pointing right */
- ACS_DARROW = 'v'; /* should be arrow pointing down */
- ACS_UARROW = '^'; /* should be arrow pointing up */
- ACS_BOARD = '#'; /* should be board of squares */
- ACS_LANTERN = '#'; /* should be lantern symbol */
- ACS_BLOCK = '#'; /* should be solid square block */
- /* these defaults were invented for ncurses */
- ACS_S3 = '-'; /* should be scan line 3 */
- ACS_S7 = '-'; /* should be scan line 7 */
- ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */
- ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */
- ACS_PI = '*'; /* should be greek pi */
- ACS_NEQUAL = '!'; /* should be not-equal */
- ACS_STERLING = 'f'; /* should be pound-sterling symbol */
+NCURSES_EXPORT(void)
+_nc_init_acs(void)
+{
+ T(("initializing ACS map"));
- if (ena_acs != NULL)
- {
- TPUTS_TRACE("ena_acs");
- putp(ena_acs);
- }
+ /*
+ * Initializations for a UNIX-like multi-terminal environment. Use
+ * ASCII chars and count on the terminfo description to do better.
+ */
+ ACS_ULCORNER = '+'; /* should be upper left corner */
+ ACS_LLCORNER = '+'; /* should be lower left corner */
+ ACS_URCORNER = '+'; /* should be upper right corner */
+ ACS_LRCORNER = '+'; /* should be lower right corner */
+ ACS_RTEE = '+'; /* should be tee pointing left */
+ ACS_LTEE = '+'; /* should be tee pointing right */
+ ACS_BTEE = '+'; /* should be tee pointing up */
+ ACS_TTEE = '+'; /* should be tee pointing down */
+ ACS_HLINE = '-'; /* should be horizontal line */
+ ACS_VLINE = '|'; /* should be vertical line */
+ ACS_PLUS = '+'; /* should be large plus or crossover */
+ ACS_S1 = '~'; /* should be scan line 1 */
+ ACS_S9 = '_'; /* should be scan line 9 */
+ ACS_DIAMOND = '+'; /* should be diamond */
+ ACS_CKBOARD = ':'; /* should be checker board (stipple) */
+ ACS_DEGREE = '\''; /* should be degree symbol */
+ ACS_PLMINUS = '#'; /* should be plus/minus */
+ ACS_BULLET = 'o'; /* should be bullet */
+ ACS_LARROW = '<'; /* should be arrow pointing left */
+ ACS_RARROW = '>'; /* should be arrow pointing right */
+ ACS_DARROW = 'v'; /* should be arrow pointing down */
+ ACS_UARROW = '^'; /* should be arrow pointing up */
+ ACS_BOARD = '#'; /* should be board of squares */
+ ACS_LANTERN = '#'; /* should be lantern symbol */
+ ACS_BLOCK = '#'; /* should be solid square block */
+ /* these defaults were invented for ncurses */
+ ACS_S3 = '-'; /* should be scan line 3 */
+ ACS_S7 = '-'; /* should be scan line 7 */
+ ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */
+ ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */
+ ACS_PI = '*'; /* should be greek pi */
+ ACS_NEQUAL = '!'; /* should be not-equal */
+ ACS_STERLING = 'f'; /* should be pound-sterling symbol */
+ if (ena_acs != NULL) {
+ TPUTS_TRACE("ena_acs");
+ putp(ena_acs);
+ }
#define ALTCHAR(c) ((chtype)(((unsigned char)(c)) | A_ALTCHARSET))
- if (acs_chars != NULL) {
- size_t i = 0;
- size_t length = strlen(acs_chars);
+ if (acs_chars != NULL) {
+ size_t i = 0;
+ size_t length = strlen(acs_chars);
- while (i < length)
- switch (acs_chars[i]) {
- case 'l':case 'm':case 'k':case 'j':
- case 'u':case 't':case 'v':case 'w':
- case 'q':case 'x':case 'n':case 'o':
- case 's':case '`':case 'a':case 'f':
- case 'g':case '~':case ',':case '+':
- case '.':case '-':case 'h':case 'i':
- case '0':case 'p':case 'r':case 'y':
- case 'z':case '{':case '|':case '}':
- acs_map[(unsigned int)acs_chars[i]] =
- ALTCHAR(acs_chars[i+1]);
- i++;
- /* FALLTHRU */
- default:
- i++;
- break;
- }
- }
+ while (i < length)
+ switch (acs_chars[i]) {
+ case 'l':
+ case 'm':
+ case 'k':
+ case 'j':
+ case 'u':
+ case 't':
+ case 'v':
+ case 'w':
+ case 'q':
+ case 'x':
+ case 'n':
+ case 'o':
+ case 's':
+ case '`':
+ case 'a':
+ case 'f':
+ case 'g':
+ case '~':
+ case ',':
+ case '+':
+ case '.':
+ case '-':
+ case 'h':
+ case 'i':
+ case '0':
+ case 'p':
+ case 'r':
+ case 'y':
+ case 'z':
+ case '{':
+ case '|':
+ case '}':
+ acs_map[(unsigned int) acs_chars[i]] =
+ ALTCHAR(acs_chars[i + 1]);
+ i++;
+ /* FALLTHRU */
+ default:
+ i++;
+ break;
+ }
+ }
#ifdef TRACE
- /* Show the equivalent mapping, noting if it does not match the
- * given attribute, whether by re-ordering or duplication.
- */
- if (_nc_tracing & TRACE_CALLS) {
- size_t n, m;
- char show[SIZEOF(acs_map) + 1];
- for (n = 1, m = 0; n < SIZEOF(acs_map); n++) {
- if (acs_map[n] != 0) {
- show[m++] = (char)n;
- show[m++] = TextOf(acs_map[n]);
- }
- }
- show[m] = 0;
- _tracef("%s acs_chars %s",
- (acs_chars == NULL)
- ? "NULL"
- : (strcmp(acs_chars, show)
- ? "DIFF"
- : "SAME"),
- _nc_visbuf(show));
+ /* Show the equivalent mapping, noting if it does not match the
+ * given attribute, whether by re-ordering or duplication.
+ */
+ if (_nc_tracing & TRACE_CALLS) {
+ size_t n, m;
+ char show[SIZEOF(acs_map) + 1];
+ for (n = 1, m = 0; n < SIZEOF(acs_map); n++) {
+ if (acs_map[n] != 0) {
+ show[m++] = (char) n;
+ show[m++] = TextOf(acs_map[n]);
+ }
}
+ show[m] = 0;
+ _tracef("%s acs_chars %s",
+ (acs_chars == NULL)
+ ? "NULL"
+ : (strcmp(acs_chars, show)
+ ? "DIFF"
+ : "SAME"),
+ _nc_visbuf(show));
+ }
#endif /* TRACE */
}
diff --git a/lib/libcurses/tinfo/lib_baudrate.c b/lib/libcurses/tinfo/lib_baudrate.c
index 31a78c107f6..39342dcb9ab 100644
--- a/lib/libcurses/tinfo/lib_baudrate.c
+++ b/lib/libcurses/tinfo/lib_baudrate.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_baudrate.c,v 1.3 2000/10/08 22:47:01 millert Exp $ */
+/* $OpenBSD: lib_baudrate.c,v 1.4 2001/01/22 18:01:52 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,7 +42,7 @@
#include <term.h> /* cur_term, pad_char */
#include <termcap.h> /* ospeed */
-MODULE_ID("$From: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $")
+MODULE_ID("$From: lib_baudrate.c,v 1.19 2000/12/10 02:55:07 tom Exp $")
/*
* int
@@ -53,8 +53,8 @@ MODULE_ID("$From: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $")
*/
struct speed {
- int s; /* value for 'ospeed' is an index */
- int sp; /* the actual speed */
+ int s; /* value for 'ospeed' is an index */
+ int sp; /* the actual speed */
};
static struct speed const speeds[] =
@@ -101,7 +101,7 @@ static struct speed const speeds[] =
#endif
};
-int
+NCURSES_EXPORT(int)
_nc_baudrate(int OSpeed)
{
static int last_OSpeed;
@@ -127,7 +127,7 @@ _nc_baudrate(int OSpeed)
return (result);
}
-int
+NCURSES_EXPORT(int)
_nc_ospeed(int BaudRate)
{
int result = 1;
@@ -144,7 +144,7 @@ _nc_ospeed(int BaudRate)
return (result);
}
-int
+NCURSES_EXPORT(int)
baudrate(void)
{
int result;
diff --git a/lib/libcurses/tinfo/lib_cur_term.c b/lib/libcurses/tinfo/lib_cur_term.c
index 22bdcaa77df..3fcf4abe47c 100644
--- a/lib/libcurses/tinfo/lib_cur_term.c
+++ b/lib/libcurses/tinfo/lib_cur_term.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_cur_term.c,v 1.4 1999/11/28 17:49:54 millert Exp $ */
+/* $OpenBSD: lib_cur_term.c,v 1.5 2001/01/22 18:01:52 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998,1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,34 +39,36 @@
*/
#include <curses.priv.h>
-#include <term_entry.h> /* TTY, cur_term */
-#include <termcap.h> /* ospeed */
+#include <term_entry.h> /* TTY, cur_term */
+#include <termcap.h> /* ospeed */
-MODULE_ID("$From: lib_cur_term.c,v 1.9 1999/10/30 23:00:16 tom Exp $")
+MODULE_ID("$From: lib_cur_term.c,v 1.11 2000/12/10 02:55:07 tom Exp $")
-TERMINAL *cur_term = 0;
+NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0;
-TERMINAL *set_curterm(TERMINAL *termp)
+NCURSES_EXPORT(TERMINAL *)
+set_curterm(TERMINAL * termp)
{
- TERMINAL *oldterm = cur_term;
+ TERMINAL *oldterm = cur_term;
- if ((cur_term = termp) != 0) {
- ospeed = _nc_ospeed(cur_term->_baudrate);
- PC = (pad_char != NULL) ? pad_char[0] : 0;
- }
- return oldterm;
+ if ((cur_term = termp) != 0) {
+ ospeed = _nc_ospeed(cur_term->_baudrate);
+ PC = (pad_char != NULL) ? pad_char[0] : 0;
+ }
+ return oldterm;
}
-int del_curterm(TERMINAL *termp)
+NCURSES_EXPORT(int)
+del_curterm(TERMINAL * termp)
{
- T((T_CALLED("del_curterm(%p)"), termp));
+ T((T_CALLED("del_curterm(%p)"), termp));
- if (termp != 0) {
- _nc_free_termtype(&(termp->type));
- free(termp);
- if (termp == cur_term)
- cur_term = 0;
- returnCode(OK);
- }
- returnCode(ERR);
+ if (termp != 0) {
+ _nc_free_termtype(&(termp->type));
+ free(termp);
+ if (termp == cur_term)
+ cur_term = 0;
+ returnCode(OK);
+ }
+ returnCode(ERR);
}
diff --git a/lib/libcurses/tinfo/lib_data.c b/lib/libcurses/tinfo/lib_data.c
index f686f40b4da..cdc8044ab18 100644
--- a/lib/libcurses/tinfo/lib_data.c
+++ b/lib/libcurses/tinfo/lib_data.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_data.c,v 1.2 1999/01/31 20:17:10 millert Exp $ */
+/* $OpenBSD: lib_data.c,v 1.3 2001/01/22 18:01:52 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998,1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -42,17 +42,20 @@
#include <curses.priv.h>
-MODULE_ID("$From: lib_data.c,v 1.14 1999/01/31 01:34:33 Ilya.Zakharevich Exp $")
+MODULE_ID("$From: lib_data.c,v 1.16 2000/12/10 02:55:07 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
* constructing a dll (reported by J.J.G.Ripoll).
*/
-WINDOW *stdscr = 0;
-WINDOW *curscr = 0;
-WINDOW *newscr = 0;
+NCURSES_EXPORT_VAR(WINDOW *)
+stdscr = 0;
+NCURSES_EXPORT_VAR(WINDOW *)
+curscr = 0;
+NCURSES_EXPORT_VAR(WINDOW *)
+newscr = 0;
-SCREEN *_nc_screen_chain = 0;
+NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0;
/*
* The variable 'SP' will be defined as a function on systems that cannot link
@@ -65,22 +68,26 @@ SCREEN *_nc_screen_chain = 0;
* module coupling that increases the size of the executable.
*/
#if BROKEN_LINKER
-static SCREEN *my_screen;
+ static SCREEN *my_screen;
-SCREEN *_nc_screen(void)
+NCURSES_EXPORT(SCREEN *)
+_nc_screen(void)
{
- return my_screen;
+ return my_screen;
}
-int _nc_alloc_screen(void)
+NCURSES_EXPORT(int)
+_nc_alloc_screen(void)
{
- return ((my_screen = typeCalloc(SCREEN, 1)) != 0);
+ return ((my_screen = typeCalloc(SCREEN, 1)) != 0);
}
-void _nc_set_screen(SCREEN *sp)
+NCURSES_EXPORT(void)
+_nc_set_screen(SCREEN * sp)
{
- my_screen = sp;
+ my_screen = sp;
}
+
#else
-SCREEN *SP = NULL; /* Some linkers require initialized data... */
+NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */
#endif
diff --git a/lib/libcurses/tinfo/lib_has_cap.c b/lib/libcurses/tinfo/lib_has_cap.c
index de5ebb5c133..d95e3f908c7 100644
--- a/lib/libcurses/tinfo/lib_has_cap.c
+++ b/lib/libcurses/tinfo/lib_has_cap.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_has_cap.c,v 1.1 1999/01/18 19:10:17 millert Exp $ */
+/* $OpenBSD: lib_has_cap.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
** lib_has_cap.c
**
@@ -45,21 +44,23 @@
#include <term.h>
-MODULE_ID("$From: lib_has_cap.c,v 1.1 1998/10/23 15:32:21 tom Exp $")
+MODULE_ID("$From: lib_has_cap.c,v 1.3 2000/12/10 02:55:07 tom Exp $")
-bool has_ic(void)
+NCURSES_EXPORT(bool)
+has_ic(void)
{
- T((T_CALLED("has_ic()")));
- returnCode(cur_term &&
- (insert_character || parm_ich
- || (enter_insert_mode && exit_insert_mode))
- && (delete_character || parm_dch));
+ T((T_CALLED("has_ic()")));
+ returnCode(cur_term &&
+ (insert_character || parm_ich
+ || (enter_insert_mode && exit_insert_mode))
+ && (delete_character || parm_dch));
}
-bool has_il(void)
+NCURSES_EXPORT(bool)
+has_il(void)
{
- T((T_CALLED("has_il()")));
- returnCode(cur_term
- && (insert_line || parm_insert_line)
- && (delete_line || parm_delete_line));
+ T((T_CALLED("has_il()")));
+ returnCode(cur_term
+ && (insert_line || parm_insert_line)
+ && (delete_line || parm_delete_line));
}
diff --git a/lib/libcurses/tinfo/lib_kernel.c b/lib/libcurses/tinfo/lib_kernel.c
index 16cb06afe9d..730ba1551fd 100644
--- a/lib/libcurses/tinfo/lib_kernel.c
+++ b/lib/libcurses/tinfo/lib_kernel.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_kernel.c,v 1.1 1999/01/18 19:10:17 millert Exp $ */
+/* $OpenBSD: lib_kernel.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
* lib_kernel.c
*
@@ -48,9 +47,9 @@
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
+#include <term.h> /* cur_term */
-MODULE_ID("$From: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $")
+MODULE_ID("$From: lib_kernel.c,v 1.21 2000/12/10 02:55:07 tom Exp $")
/*
* erasechar()
@@ -59,23 +58,21 @@ MODULE_ID("$From: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $")
*
*/
-char
+NCURSES_EXPORT(char)
erasechar(void)
{
- T((T_CALLED("erasechar()")));
+ T((T_CALLED("erasechar()")));
- if (cur_term != 0) {
+ if (cur_term != 0) {
#ifdef TERMIOS
- returnCode(cur_term->Ottyb.c_cc[VERASE]);
+ returnCode(cur_term->Ottyb.c_cc[VERASE]);
#else
- returnCode(cur_term->Ottyb.sg_erase);
+ returnCode(cur_term->Ottyb.sg_erase);
#endif
- }
- returnCode(ERR);
+ }
+ returnCode(ERR);
}
-
-
/*
* killchar()
*
@@ -83,23 +80,21 @@ erasechar(void)
*
*/
-char
+NCURSES_EXPORT(char)
killchar(void)
{
- T((T_CALLED("killchar()")));
+ T((T_CALLED("killchar()")));
- if (cur_term != 0) {
+ if (cur_term != 0) {
#ifdef TERMIOS
- returnCode(cur_term->Ottyb.c_cc[VKILL]);
+ returnCode(cur_term->Ottyb.c_cc[VKILL]);
#else
- returnCode(cur_term->Ottyb.sg_kill);
+ returnCode(cur_term->Ottyb.sg_kill);
#endif
- }
- returnCode(ERR);
+ }
+ returnCode(ERR);
}
-
-
/*
* flushinp()
*
@@ -107,26 +102,27 @@ killchar(void)
*
*/
-int flushinp(void)
+NCURSES_EXPORT(int)
+flushinp(void)
{
- T((T_CALLED("flushinp()")));
+ T((T_CALLED("flushinp()")));
- if (cur_term != 0) {
+ if (cur_term != 0) {
#ifdef TERMIOS
- tcflush(cur_term->Filedes, TCIFLUSH);
+ tcflush(cur_term->Filedes, TCIFLUSH);
#else
- errno = 0;
- do {
- ioctl(cur_term->Filedes, TIOCFLUSH, 0);
- } while
- (errno == EINTR);
+ errno = 0;
+ do {
+ ioctl(cur_term->Filedes, TIOCFLUSH, 0);
+ } while
+ (errno == EINTR);
#endif
- if (SP) {
- SP->_fifohead = -1;
- SP->_fifotail = 0;
- SP->_fifopeek = 0;
- }
- returnCode(OK);
+ if (SP) {
+ SP->_fifohead = -1;
+ SP->_fifotail = 0;
+ SP->_fifopeek = 0;
}
- returnCode(ERR);
+ returnCode(OK);
+ }
+ returnCode(ERR);
}
diff --git a/lib/libcurses/tinfo/lib_longname.c b/lib/libcurses/tinfo/lib_longname.c
index 558453a69bb..9cbbf5fcbf5 100644
--- a/lib/libcurses/tinfo/lib_longname.c
+++ b/lib/libcurses/tinfo/lib_longname.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_longname.c,v 1.1 1999/01/18 19:10:18 millert Exp $ */
+/* $OpenBSD: lib_longname.c,v 1.2 2001/01/22 18:01:52 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,7 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
** lib_longname.c
**
@@ -43,18 +42,18 @@
#include <curses.priv.h>
-MODULE_ID("$From: lib_longname.c,v 1.7 1999/01/03 01:47:45 tom Exp $")
+MODULE_ID("$From: lib_longname.c,v 1.9 2000/12/10 02:55:07 tom Exp $")
-char *
+NCURSES_EXPORT(char *)
longname(void)
{
-char *ptr;
+ char *ptr;
- T((T_CALLED("longname()")));
+ T((T_CALLED("longname()")));
- for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--)
- if (*ptr == '|')
- returnPtr(ptr + 1);
+ for (ptr = ttytype + strlen(ttytype); ptr > ttytype; ptr--)
+ if (*ptr == '|')
+ returnPtr(ptr + 1);
- returnPtr(ttytype);
+ returnPtr(ttytype);
}
diff --git a/lib/libcurses/tinfo/lib_napms.c b/lib/libcurses/tinfo/lib_napms.c
index de4f97efce7..bf29ef488f5 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.6 2000/06/19 03:53:50 millert Exp $ */
+/* $OpenBSD: lib_napms.c,v 1.7 2001/01/22 18:01:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -60,9 +60,9 @@
#endif
#endif
-MODULE_ID("$From: lib_napms.c,v 1.9 2000/04/29 23:42:56 tom Exp $")
+MODULE_ID("$From: lib_napms.c,v 1.11 2000/12/10 02:55:07 tom Exp $")
-int
+NCURSES_EXPORT(int)
napms(int ms)
{
T((T_CALLED("napms(%d)"), ms));
diff --git a/lib/libcurses/tinfo/lib_options.c b/lib/libcurses/tinfo/lib_options.c
index ad42bf8b41f..ca96bc3d7db 100644
--- a/lib/libcurses/tinfo/lib_options.c
+++ b/lib/libcurses/tinfo/lib_options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_options.c,v 1.8 2000/10/08 22:47:01 millert Exp $ */
+/* $OpenBSD: lib_options.c,v 1.9 2001/01/22 18:01:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -44,9 +44,9 @@
#include <term.h>
-MODULE_ID("$From: lib_options.c,v 1.40 2000/09/02 18:02:05 tom Exp $")
+MODULE_ID("$From: lib_options.c,v 1.42 2000/12/10 02:55:07 tom Exp $")
-int
+NCURSES_EXPORT(int)
idlok(WINDOW *win, bool flag)
{
T((T_CALLED("idlok(%p,%d)"), win, flag));
@@ -58,7 +58,7 @@ idlok(WINDOW *win, bool flag)
returnCode(ERR);
}
-void
+NCURSES_EXPORT(void)
idcok(WINDOW *win, bool flag)
{
T((T_CALLED("idcok(%p,%d)"), win, flag));
@@ -69,7 +69,7 @@ idcok(WINDOW *win, bool flag)
returnVoid;
}
-int
+NCURSES_EXPORT(int)
halfdelay(int t)
{
T((T_CALLED("halfdelay(%d)"), t));
@@ -82,7 +82,7 @@ halfdelay(int t)
returnCode(OK);
}
-int
+NCURSES_EXPORT(int)
nodelay(WINDOW *win, bool flag)
{
T((T_CALLED("nodelay(%p,%d)"), win, flag));
@@ -97,7 +97,7 @@ nodelay(WINDOW *win, bool flag)
returnCode(ERR);
}
-int
+NCURSES_EXPORT(int)
notimeout(WINDOW *win, bool f)
{
T((T_CALLED("notimout(%p,%d)"), win, f));
@@ -109,7 +109,7 @@ notimeout(WINDOW *win, bool f)
returnCode(ERR);
}
-void
+NCURSES_EXPORT(void)
wtimeout(WINDOW *win, int delay)
{
T((T_CALLED("wtimeout(%p,%d)"), win, delay));
@@ -119,7 +119,7 @@ wtimeout(WINDOW *win, int delay)
}
}
-int
+NCURSES_EXPORT(int)
keypad(WINDOW *win, bool flag)
{
T((T_CALLED("keypad(%p,%d)"), win, flag));
@@ -131,7 +131,7 @@ keypad(WINDOW *win, bool flag)
returnCode(ERR);
}
-int
+NCURSES_EXPORT(int)
meta(WINDOW *win GCC_UNUSED, bool flag)
{
/* Ok, we stay relaxed and don't signal an error if win is NULL */
@@ -151,7 +151,7 @@ meta(WINDOW *win GCC_UNUSED, bool flag)
/* curs_set() moved here to narrow the kernel interface */
-int
+NCURSES_EXPORT(int)
curs_set(int vis)
{
int cursor = SP->_cursor;
@@ -193,7 +193,7 @@ curs_set(int vis)
returnCode(cursor == -1 ? 1 : cursor);
}
-int
+NCURSES_EXPORT(int)
typeahead(int fd)
{
T((T_CALLED("typeahead(%d)"), fd));
@@ -218,10 +218,10 @@ has_key_internal(int keycode, struct tries *tp)
return (TRUE);
else
return (has_key_internal(keycode, tp->child)
- || has_key_internal(keycode, tp->sibling));
+ || has_key_internal(keycode, tp->sibling));
}
-int
+NCURSES_EXPORT(int)
has_key(int keycode)
{
T((T_CALLED("has_key(%d)"), keycode));
@@ -236,7 +236,7 @@ has_key(int keycode)
* flush, then the next wgetch may get the escape sequence that corresponds to
* the terminal state _before_ switching modes.
*/
-int
+NCURSES_EXPORT(int)
_nc_keypad(bool flag)
{
if (flag && keypad_xmit) {
diff --git a/lib/libcurses/tinfo/lib_print.c b/lib/libcurses/tinfo/lib_print.c
index a42bccf6f21..0bb6b5a4c6b 100644
--- a/lib/libcurses/tinfo/lib_print.c
+++ b/lib/libcurses/tinfo/lib_print.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_print.c,v 1.2 1999/03/02 06:23:28 millert Exp $ */
+/* $OpenBSD: lib_print.c,v 1.3 2001/01/22 18:01:53 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,49 +33,44 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$From: lib_print.c,v 1.11 1999/02/27 19:59:05 tom Exp $")
+MODULE_ID("$From: lib_print.c,v 1.13 2000/12/10 02:55:07 tom Exp $")
-int mcprint(char *data, int len)
+NCURSES_EXPORT(int)
+mcprint(char *data, int len)
/* ship binary character data to the printer via mc4/mc5/mc5p */
{
- char *mybuf, *switchon;
- size_t onsize, offsize, res;
+ char *mybuf, *switchon;
+ size_t onsize, offsize, res;
errno = 0;
- if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off)))
- {
+ if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) {
errno = ENODEV;
- return(ERR);
+ return (ERR);
}
- if (prtr_non)
- {
+ if (prtr_non) {
switchon = tparm(prtr_non, len);
onsize = strlen(switchon);
offsize = 0;
- }
- else
- {
+ } else {
switchon = prtr_on;
onsize = strlen(prtr_on);
offsize = strlen(prtr_off);
}
- if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *)0)
- {
+ if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *) 0) {
errno = ENOMEM;
- return(ERR);
+ return (ERR);
}
(void) strcpy(mybuf, switchon);
memcpy(mybuf + onsize, data, len);
if (offsize)
- (void) strcpy(mybuf + onsize + len, prtr_off);
+ (void) strcpy(mybuf + onsize + len, prtr_off);
/*
* We're relying on the atomicity of UNIX writes here. The
@@ -94,5 +89,5 @@ int mcprint(char *data, int len)
(void) sleep(0);
free(mybuf);
- return(res);
+ return (res);
}
diff --git a/lib/libcurses/tinfo/lib_raw.c b/lib/libcurses/tinfo/lib_raw.c
index be87b5a3049..eb10b64e30b 100644
--- a/lib/libcurses/tinfo/lib_raw.c
+++ b/lib/libcurses/tinfo/lib_raw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_raw.c,v 1.6 2000/10/08 22:47:01 millert Exp $ */
+/* $OpenBSD: lib_raw.c,v 1.7 2001/01/22 18:01:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -50,7 +50,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$From: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $")
+MODULE_ID("$From: lib_raw.c,v 1.10 2000/12/10 02:55:07 tom Exp $")
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -74,7 +74,7 @@ MODULE_ID("$From: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $")
#define AFTER(s)
#endif /* TRACE */
-int
+NCURSES_EXPORT(int)
raw(void)
{
T((T_CALLED("raw()")));
@@ -102,7 +102,7 @@ raw(void)
returnCode(ERR);
}
-int
+NCURSES_EXPORT(int)
cbreak(void)
{
T((T_CALLED("cbreak()")));
@@ -127,7 +127,7 @@ cbreak(void)
returnCode(_nc_set_tty_mode(&cur_term->Nttyb));
}
-void
+NCURSES_EXPORT(void)
qiflush(void)
{
T((T_CALLED("qiflush()")));
@@ -146,7 +146,7 @@ qiflush(void)
#endif
}
-int
+NCURSES_EXPORT(int)
noraw(void)
{
T((T_CALLED("noraw()")));
@@ -170,7 +170,7 @@ noraw(void)
returnCode(_nc_set_tty_mode(&cur_term->Nttyb));
}
-int
+NCURSES_EXPORT(int)
nocbreak(void)
{
T((T_CALLED("nocbreak()")));
@@ -192,7 +192,7 @@ nocbreak(void)
returnCode(_nc_set_tty_mode(&cur_term->Nttyb));
}
-void
+NCURSES_EXPORT(void)
noqiflush(void)
{
T((T_CALLED("noqiflush()")));
@@ -211,7 +211,7 @@ noqiflush(void)
#endif
}
-int
+NCURSES_EXPORT(int)
intrflush(WINDOW *win GCC_UNUSED, bool flag)
{
T((T_CALLED("intrflush(%d)"), flag));
diff --git a/lib/libcurses/tinfo/lib_setup.c b/lib/libcurses/tinfo/lib_setup.c
index 77003ad61ab..1db8a06bc1b 100644
--- a/lib/libcurses/tinfo/lib_setup.c
+++ b/lib/libcurses/tinfo/lib_setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_setup.c,v 1.10 2000/10/08 22:47:01 millert Exp $ */
+/* $OpenBSD: lib_setup.c,v 1.11 2001/01/22 18:01:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -50,7 +50,7 @@
#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$From: lib_setup.c,v 1.60 2000/09/02 18:13:12 tom Exp $")
+MODULE_ID("$From: lib_setup.c,v 1.64 2000/12/10 02:55:07 tom Exp $")
/****************************************************************************
*
@@ -96,16 +96,21 @@ static int _use_env = TRUE;
static void do_prototype(void);
-void
+NCURSES_EXPORT(void)
use_env(bool f)
{
_use_env = f;
}
-int LINES = 0, COLS = 0, TABSIZE = 0;
+NCURSES_EXPORT_VAR(int)
+LINES = 0;
+NCURSES_EXPORT_VAR(int)
+COLS = 0;
+NCURSES_EXPORT_VAR(int)
+TABSIZE = 0;
-static void
-_nc_get_screensize(int *linep, int *colp)
+ static void
+ _nc_get_screensize(int *linep, int *colp)
/* Obtain lines/columns values from the environment and/or terminfo entry */
{
/* figure out the size of the screen */
@@ -135,7 +140,7 @@ _nc_get_screensize(int *linep, int *colp)
*colp = screendata[0];
*linep = screendata[1];
T(("EMX screen size: environment LINES = %d COLUMNS = %d",
- *linep, *colp));
+ *linep, *colp));
}
#endif
#if HAVE_SIZECHANGE
@@ -167,11 +172,12 @@ _nc_get_screensize(int *linep, int *colp)
#endif /* HAVE_SIZECHANGE */
/* if we can't get dynamic info about the size, use static */
- if (*linep <= 0 || *colp <= 0)
- if (lines > 0 && columns > 0) {
- *linep = (int) lines;
- *colp = (int) columns;
- }
+ if (*linep <= 0) {
+ *linep = (int) lines;
+ }
+ if (*colp <= 0) {
+ *colp = (int) columns;
+ }
/* the ultimate fallback, assume fixed 24x80 size */
if (*linep <= 0 || *colp <= 0) {
@@ -198,7 +204,7 @@ _nc_get_screensize(int *linep, int *colp)
}
#if USE_SIZECHANGE
-void
+NCURSES_EXPORT(void)
_nc_update_screensize(void)
{
int my_lines, my_cols;
@@ -267,18 +273,20 @@ grab_entry(const char *const tn, TERMTYPE * const tp)
*/
if (status == 1) {
int n;
- for_each_boolean(n, tp)
+ for_each_boolean(n, tp) {
if (!VALID_BOOLEAN(tp->Booleans[n]))
- tp->Booleans[n] = FALSE;
- for_each_string(n, tp)
+ tp->Booleans[n] = FALSE;
+ }
+ for_each_string(n, tp) {
if (tp->Strings[n] == CANCELLED_STRING)
- tp->Strings[n] = ABSENT_STRING;
+ tp->Strings[n] = ABSENT_STRING;
+ }
}
return (status);
}
#endif
-char ttytype[NAMESIZE] = "";
+NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = "";
/*
* setupterm(termname, Filedes, errret)
@@ -288,8 +296,9 @@ char ttytype[NAMESIZE] = "";
*
*/
-int
-setupterm(NCURSES_CONST char *tname, int Filedes, int *errret)
+NCURSES_EXPORT(int)
+setupterm
+(NCURSES_CONST char *tname, int Filedes, int *errret)
{
struct term *term_ptr;
int status;
@@ -304,7 +313,7 @@ setupterm(NCURSES_CONST char *tname, int Filedes, int *errret)
}
if (strlen(tname) > MAX_NAME_SIZE) {
ret_error(-1, "TERM environment must be <= %d characters.\n",
- MAX_NAME_SIZE);
+ MAX_NAME_SIZE);
}
T(("your terminal name is %s", tname));
diff --git a/lib/libcurses/tinfo/lib_termcap.c b/lib/libcurses/tinfo/lib_termcap.c
index 3c3e11afc6b..94173a7a576 100644
--- a/lib/libcurses/tinfo/lib_termcap.c
+++ b/lib/libcurses/tinfo/lib_termcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_termcap.c,v 1.7 2000/10/08 22:47:02 millert Exp $ */
+/* $OpenBSD: lib_termcap.c,v 1.8 2001/01/22 18:01:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -41,15 +41,17 @@
#define __INTERNAL_CAPS_VISIBLE
#include <term_entry.h>
-MODULE_ID("$From: lib_termcap.c,v 1.37 2000/09/16 20:30:16 tom Exp $")
+MODULE_ID("$From: lib_termcap.c,v 1.39 2000/12/10 02:56:30 tom Exp $")
/*
some of the code in here was contributed by:
Magnus Bengtsson, d6mbeng@dtek.chalmers.se
*/
-char *UP = 0;
-char *BC = 0;
+NCURSES_EXPORT_VAR(char *)
+UP = 0;
+NCURSES_EXPORT_VAR(char *)
+BC = 0;
/***************************************************************************
*
@@ -66,8 +68,9 @@ char *BC = 0;
*
***************************************************************************/
-int
-tgetent(char *bufp GCC_UNUSED, const char *name)
+NCURSES_EXPORT(int)
+tgetent
+(char *bufp GCC_UNUSED, const char *name)
{
int errcode;
@@ -110,7 +113,7 @@ tgetent(char *bufp GCC_UNUSED, const char *name)
*
***************************************************************************/
-int
+NCURSES_EXPORT(int)
tgetflag(NCURSES_CONST char *id)
{
int i;
@@ -138,7 +141,7 @@ tgetflag(NCURSES_CONST char *id)
*
***************************************************************************/
-int
+NCURSES_EXPORT(int)
tgetnum(NCURSES_CONST char *id)
{
int i;
@@ -167,8 +170,9 @@ tgetnum(NCURSES_CONST char *id)
*
***************************************************************************/
-char *
-tgetstr(NCURSES_CONST char *id, char **area)
+NCURSES_EXPORT(char *)
+tgetstr
+(NCURSES_CONST char *id, char **area)
{
int i;
@@ -178,7 +182,7 @@ tgetstr(NCURSES_CONST char *id, char **area)
for_each_string(i, tp) {
const char *capname = ExtStrname(tp, i, strcodes);
if (!strncmp(id, capname, 2)) {
- TR(TRACE_DATABASE,("found match : %s", _nc_visbuf(tp->Strings[i])));
+ TR(TRACE_DATABASE, ("found match : %s", _nc_visbuf(tp->Strings[i])));
/* setupterm forces canceled strings to null */
if (area != 0
&& *area != 0
diff --git a/lib/libcurses/tinfo/lib_termname.c b/lib/libcurses/tinfo/lib_termname.c
index ad6353e01e9..f063c300fb8 100644
--- a/lib/libcurses/tinfo/lib_termname.c
+++ b/lib/libcurses/tinfo/lib_termname.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_termname.c,v 1.2 1999/08/15 11:40:55 millert Exp $ */
+/* $OpenBSD: lib_termname.c,v 1.3 2001/01/22 18:01:53 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,20 +29,22 @@
****************************************************************************/
#include <curses.priv.h>
-#include <tic.h> /* for MAX_ALIAS */
+#include <tic.h> /* for MAX_ALIAS */
-MODULE_ID("$From: lib_termname.c,v 1.2 1999/07/24 21:02:40 tom Exp $")
+MODULE_ID("$From: lib_termname.c,v 1.6 2000/12/10 02:55:08 tom Exp $")
-char *termname(void)
+NCURSES_EXPORT(char *)
+termname(void)
{
-char *name = getenv("TERM");
-static char ret[MAX_ALIAS+1];
+ char *name = getenv("TERM");
+ static char ret[MAX_ALIAS + 1];
- T(("termname() called"));
+ T(("termname() called"));
- if (name != 0) {
- (void) strncpy(ret, name, sizeof(ret) - 1);
- name = ret;
- }
- return name;
+ if (name != 0) {
+ ret[0] = '\0';
+ (void) strncat(ret, name, sizeof(ret) - 1);
+ name = ret;
+ }
+ return name;
}
diff --git a/lib/libcurses/tinfo/lib_tgoto.c b/lib/libcurses/tinfo/lib_tgoto.c
index b305935cdee..c54cb39443c 100644
--- a/lib/libcurses/tinfo/lib_tgoto.c
+++ b/lib/libcurses/tinfo/lib_tgoto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_tgoto.c,v 1.1 2000/10/08 22:47:02 millert Exp $ */
+/* $OpenBSD: lib_tgoto.c,v 1.2 2001/01/22 18:01:53 millert Exp $ */
/****************************************************************************
* Copyright (c) 2000 Free Software Foundation, Inc. *
@@ -37,7 +37,7 @@
#include <ctype.h>
#include <termcap.h>
-MODULE_ID("$From: lib_tgoto.c,v 1.2 2000/09/24 00:19:14 tom Exp $")
+MODULE_ID("$From: lib_tgoto.c,v 1.5 2000/12/10 01:33:16 tom Exp $")
#if !PURE_TERMINFO
static bool
@@ -45,20 +45,24 @@ is_termcap(const char *string)
{
bool result = TRUE;
- while ((*string != '\0') && result) {
- if (*string == '%') {
- switch (*++string) {
- case 'p':
+ if (string == 0 || *string == '\0') {
+ result = FALSE; /* tparm() handles empty strings */
+ } else {
+ while ((*string != '\0') && result) {
+ if (*string == '%') {
+ switch (*++string) {
+ case 'p':
+ result = FALSE;
+ break;
+ case '\0':
+ string--;
+ break;
+ }
+ } else if (string[0] == '$' && string[1] == '<') {
result = FALSE;
- break;
- case '\0':
- string--;
- break;
}
- } else if (string[0] == '$' && string[1] == '<') {
- result = FALSE;
+ string++;
}
- string++;
}
return result;
}
@@ -110,7 +114,7 @@ tgoto_internal(const char *string, int x, int y)
*value %= 1000;
break;
case '+':
- *value += (*++string & 0xff);
+ *value += CharOf(*++string);
/* FALLTHRU */
case '.':
/*
@@ -183,8 +187,9 @@ tgoto_internal(const char *string, int x, int y)
* Retained solely for upward compatibility. Note the intentional reversing of
* the last two arguments when invoking tparm().
*/
-char *
-tgoto(const char *string, int x, int y)
+NCURSES_EXPORT(char *)
+tgoto
+(const char *string, int x, int y)
{
char *result;
diff --git a/lib/libcurses/tinfo/lib_ti.c b/lib/libcurses/tinfo/lib_ti.c
index df4b8a3a5a2..3c1595aef0c 100644
--- a/lib/libcurses/tinfo/lib_ti.c
+++ b/lib/libcurses/tinfo/lib_ti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_ti.c,v 1.5 2000/03/10 01:35:04 millert Exp $ */
+/* $OpenBSD: lib_ti.c,v 1.6 2001/01/22 18:01:54 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -38,9 +38,9 @@
#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$From: lib_ti.c,v 1.20 2000/02/13 01:01:26 tom Exp $")
+MODULE_ID("$From: lib_ti.c,v 1.22 2000/12/10 02:55:08 tom Exp $")
-int
+NCURSES_EXPORT(int)
tigetflag(NCURSES_CONST char *str)
{
int i;
@@ -61,7 +61,7 @@ tigetflag(NCURSES_CONST char *str)
returnCode(ABSENT_BOOLEAN);
}
-int
+NCURSES_EXPORT(int)
tigetnum(NCURSES_CONST char *str)
{
int i;
@@ -83,7 +83,7 @@ tigetnum(NCURSES_CONST char *str)
returnCode(CANCELLED_NUMERIC); /* Solaris returns a -1 instead */
}
-char *
+NCURSES_EXPORT(char *)
tigetstr(NCURSES_CONST char *str)
{
int i;
diff --git a/lib/libcurses/tinfo/lib_tparm.c b/lib/libcurses/tinfo/lib_tparm.c
index 536301ca9c4..e5c496dd1c3 100644
--- a/lib/libcurses/tinfo/lib_tparm.c
+++ b/lib/libcurses/tinfo/lib_tparm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lib_tparm.c,v 1.6 2000/10/22 18:27:23 millert Exp $ */
+/* $OpenBSD: lib_tparm.c,v 1.7 2001/01/22 18:01:54 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,2000 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <term.h>
#include <tic.h>
-MODULE_ID("$From: lib_tparm.c,v 1.48 2000/10/14 17:45:00 Sergei.Ivanov Exp $")
+MODULE_ID("$From: lib_tparm.c,v 1.51 2000/12/10 02:55:08 tom Exp $")
/*
* char *
@@ -128,7 +128,7 @@ static size_t out_size;
static size_t out_used;
#if NO_LEAKS
-void
+NCURSES_EXPORT(void)
_nc_free_tparm(void)
{
if (out_buff != 0) {
@@ -288,7 +288,7 @@ parse_format(const char *s, char *format, int *len)
}
break;
default:
- if (isdigit(*s)) {
+ if (isdigit(CharOf(*s))) {
value = (value * 10) + (*s - '0');
if (value > 10000)
err = TRUE;
@@ -726,8 +726,9 @@ tparam_internal(const char *string, va_list ap)
return (out_buff);
}
-char *
-tparm(NCURSES_CONST char *string,...)
+NCURSES_EXPORT(char *)
+tparm
+(NCURSES_CONST char *string,...)
{
va_list ap;
char *result;
diff --git a/lib/libcurses/tinfo/lib_tputs.c b/lib/libcurses/tinfo/lib_tputs.c
index 6084d441902..fb20e9dc782 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.8 2000/10/08 22:47:02 millert Exp $ */
+/* $OpenBSD: lib_tputs.c,v 1.9 2001/01/22 18:01:54 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -47,16 +47,18 @@
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$From: lib_tputs.c,v 1.51 2000/10/08 00:22:24 tom Exp $")
+MODULE_ID("$From: lib_tputs.c,v 1.55 2000/12/10 02:55:08 tom Exp $");
-char PC = 0; /* used by termcap library */
-short ospeed = 0; /* used by termcap library */
+NCURSES_EXPORT_VAR(char)
+PC = 0; /* used by termcap library */
+NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
-int _nc_nulls_sent = 0; /* used by 'tack' program */
+NCURSES_EXPORT_VAR(int)
+_nc_nulls_sent = 0; /* used by 'tack' program */
-static int (*my_outch) (int c) = _nc_outch;
+ static int (*my_outch) (int c) = _nc_outch;
-int
+NCURSES_EXPORT(int)
delay_output(int ms)
{
T((T_CALLED("delay_output(%d)"), ms));
@@ -77,13 +79,13 @@ delay_output(int ms)
returnCode(OK);
}
-void
+NCURSES_EXPORT(void)
_nc_flush(void)
{
(void) fflush(NC_OUTPUT);
}
-int
+NCURSES_EXPORT(int)
_nc_outch(int ch)
{
#ifdef TRACE
@@ -111,7 +113,7 @@ _nc_outch(int ch)
* No surrogates supported (we're storing only one 16-bit Unicode value per
* cell).
*/
-int
+NCURSES_EXPORT(int)
_nc_utf8_outch(int ch)
{
static const unsigned byteMask = 0xBF;
@@ -170,14 +172,15 @@ _nc_utf8_outch(int ch)
}
#endif
-int
+NCURSES_EXPORT(int)
putp(const char *string)
{
return tputs(string, 1, _nc_outch);
}
-int
-tputs(const char *string, int affcnt, int (*outc) (int))
+NCURSES_EXPORT(int)
+tputs
+(const char *string, int affcnt, int (*outc) (int))
{
bool always_delay;
bool normal_delay;
@@ -264,25 +267,26 @@ tputs(const char *string, int affcnt, int (*outc) (int))
bool mandatory;
string++;
- if ((!isdigit(*string) && *string != '.') || !strchr(string, '>')) {
+ if ((!isdigit(CharOf(*string)) && *string != '.')
+ || !strchr(string, '>')) {
(*outc) ('$');
(*outc) ('<');
continue;
}
number = 0;
- while (isdigit(*string)) {
+ while (isdigit(CharOf(*string))) {
number = number * 10 + (*string - '0');
string++;
}
number *= 10;
if (*string == '.') {
string++;
- if (isdigit(*string)) {
+ if (isdigit(CharOf(*string))) {
number += (*string - '0');
string++;
}
- while (isdigit(*string))
+ while (isdigit(CharOf(*string)))
string++;
}
diff --git a/lib/libcurses/tinfo/lib_ttyflags.c b/lib/libcurses/tinfo/lib_ttyflags.c
index 9a4825e8384..615e0092564 100644
--- a/lib/libcurses/tinfo/lib_ttyflags.c
+++ b/lib/libcurses/tinfo/lib_ttyflags.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: lib_ttyflags.c,v 1.3 1999/11/28 17:49:54 millert Exp $ */
+/* $OpenBSD: lib_ttyflags.c,v 1.4 2001/01/22 18:01:54 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -38,9 +38,9 @@
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
+#include <term.h> /* cur_term */
-MODULE_ID("$From: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $")
+MODULE_ID("$From: lib_ttyflags.c,v 1.5 2000/12/10 02:55:08 tom Exp $")
#undef tabs
@@ -58,89 +58,94 @@ MODULE_ID("$From: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $")
# endif
#endif
-int _nc_get_tty_mode(TTY *buf)
+NCURSES_EXPORT(int)
+_nc_get_tty_mode(TTY * buf)
{
- if (cur_term == 0
- || GET_TTY(cur_term->Filedes, buf) != 0)
- return(ERR);
- TR(TRACE_BITS,("_nc_get_tty_mode: %s", _nc_tracebits()));
- return (OK);
+ if (cur_term == 0
+ || GET_TTY(cur_term->Filedes, buf) != 0)
+ return (ERR);
+ TR(TRACE_BITS, ("_nc_get_tty_mode: %s", _nc_tracebits()));
+ return (OK);
}
-int _nc_set_tty_mode(TTY *buf)
+NCURSES_EXPORT(int)
+_nc_set_tty_mode(TTY * buf)
{
- if (cur_term == 0
- || SET_TTY(cur_term->Filedes, buf) != 0)
- return(ERR);
- TR(TRACE_BITS,("_nc_set_tty_mode: %s", _nc_tracebits()));
- return (OK);
+ if (cur_term == 0
+ || SET_TTY(cur_term->Filedes, buf) != 0)
+ return (ERR);
+ TR(TRACE_BITS, ("_nc_set_tty_mode: %s", _nc_tracebits()));
+ return (OK);
}
-int def_shell_mode(void)
+NCURSES_EXPORT(int)
+def_shell_mode(void)
{
- T((T_CALLED("def_shell_mode()")));
+ T((T_CALLED("def_shell_mode()")));
- /*
- * Turn off the XTABS bit in the tty structure if it was on. If XTABS
- * was on, remove the tab and backtab capabilities.
- */
+ /*
+ * Turn off the XTABS bit in the tty structure if it was on. If XTABS
+ * was on, remove the tab and backtab capabilities.
+ */
- if (_nc_get_tty_mode(&cur_term->Ottyb) != OK)
- returnCode(ERR);
+ if (_nc_get_tty_mode(&cur_term->Ottyb) != OK)
+ returnCode(ERR);
#ifdef TERMIOS
- if (cur_term->Ottyb.c_oflag & tabs)
- tab = back_tab = NULL;
+ if (cur_term->Ottyb.c_oflag & tabs)
+ tab = back_tab = NULL;
#else
- if (cur_term->Ottyb.sg_flags & XTABS)
- tab = back_tab = NULL;
+ if (cur_term->Ottyb.sg_flags & XTABS)
+ tab = back_tab = NULL;
#endif
- returnCode(OK);
+ returnCode(OK);
}
-int def_prog_mode(void)
+NCURSES_EXPORT(int)
+def_prog_mode(void)
{
- T((T_CALLED("def_prog_mode()")));
+ T((T_CALLED("def_prog_mode()")));
- if (_nc_get_tty_mode(&cur_term->Nttyb) != OK)
- returnCode(ERR);
+ if (_nc_get_tty_mode(&cur_term->Nttyb) != OK)
+ returnCode(ERR);
#ifdef TERMIOS
- cur_term->Nttyb.c_oflag &= ~tabs;
+ cur_term->Nttyb.c_oflag &= ~tabs;
#else
- cur_term->Nttyb.sg_flags &= ~XTABS;
+ cur_term->Nttyb.sg_flags &= ~XTABS;
#endif
- returnCode(OK);
+ returnCode(OK);
}
-int reset_prog_mode(void)
+NCURSES_EXPORT(int)
+reset_prog_mode(void)
{
- T((T_CALLED("reset_prog_mode()")));
-
- if (cur_term != 0) {
- _nc_set_tty_mode(&cur_term->Nttyb);
- if (SP) {
- if (stdscr && stdscr->_use_keypad)
- _nc_keypad(TRUE);
- NC_BUFFERED(TRUE);
- }
- returnCode(OK);
+ T((T_CALLED("reset_prog_mode()")));
+
+ if (cur_term != 0) {
+ _nc_set_tty_mode(&cur_term->Nttyb);
+ if (SP) {
+ if (stdscr && stdscr->_use_keypad)
+ _nc_keypad(TRUE);
+ NC_BUFFERED(TRUE);
}
- returnCode(ERR);
+ returnCode(OK);
+ }
+ returnCode(ERR);
}
-int reset_shell_mode(void)
+NCURSES_EXPORT(int)
+reset_shell_mode(void)
{
- T((T_CALLED("reset_shell_mode()")));
-
- if (cur_term != 0) {
- if (SP)
- {
- _nc_keypad(FALSE);
- _nc_flush();
- NC_BUFFERED(FALSE);
- }
- returnCode(_nc_set_tty_mode(&cur_term->Ottyb));
+ T((T_CALLED("reset_shell_mode()")));
+
+ if (cur_term != 0) {
+ if (SP) {
+ _nc_keypad(FALSE);
+ _nc_flush();
+ NC_BUFFERED(FALSE);
}
- returnCode(ERR);
+ returnCode(_nc_set_tty_mode(&cur_term->Ottyb));
+ }
+ returnCode(ERR);
}
/*
@@ -148,18 +153,20 @@ int reset_shell_mode(void)
**
*/
-static TTY buf;
+static TTY buf;
-int savetty(void)
+NCURSES_EXPORT(int)
+savetty(void)
{
- T((T_CALLED("savetty()")));
+ T((T_CALLED("savetty()")));
- returnCode(_nc_get_tty_mode(&buf));
+ returnCode(_nc_get_tty_mode(&buf));
}
-int resetty(void)
+NCURSES_EXPORT(int)
+resetty(void)
{
- T((T_CALLED("resetty()")));
+ T((T_CALLED("resetty()")));
- returnCode(_nc_set_tty_mode(&buf));
+ returnCode(_nc_set_tty_mode(&buf));
}
diff --git a/lib/libcurses/tinfo/make_keys.c b/lib/libcurses/tinfo/make_keys.c
index 1f36655815a..d04a9a71608 100644
--- a/lib/libcurses/tinfo/make_keys.c
+++ b/lib/libcurses/tinfo/make_keys.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: make_keys.c,v 1.6 2000/03/13 23:53:40 millert Exp $ */
+/* $OpenBSD: make_keys.c,v 1.7 2001/01/22 18:01:54 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -39,98 +39,104 @@
*/
#include <curses.priv.h>
-MODULE_ID("$From: make_keys.c,v 1.8 2000/03/12 02:55:50 Todd.C.Miller Exp $")
+MODULE_ID("$From: make_keys.c,v 1.10 2000/12/10 02:55:08 tom Exp $")
#include <names.c>
#define UNKNOWN (SIZEOF(strnames) + SIZEOF(strfnames))
-static size_t lookup(const char *name)
+static size_t
+lookup(const char *name)
{
- size_t n;
- bool found = FALSE;
- for (n = 0; strnames[n] != 0; n++) {
- if (!strcmp(name, strnames[n])) {
- found = TRUE;
- break;
- }
+ size_t n;
+ bool found = FALSE;
+ for (n = 0; strnames[n] != 0; n++) {
+ if (!strcmp(name, strnames[n])) {
+ found = TRUE;
+ break;
}
- if (!found) {
- for (n = 0; strfnames[n] != 0; n++) {
- if (!strcmp(name, strfnames[n])) {
- found = TRUE;
- break;
- }
- }
+ }
+ if (!found) {
+ for (n = 0; strfnames[n] != 0; n++) {
+ if (!strcmp(name, strfnames[n])) {
+ found = TRUE;
+ break;
+ }
}
- return found ? n : UNKNOWN;
+ }
+ return found ? n : UNKNOWN;
}
-static void make_keys(FILE *ifp, FILE *ofp)
+static void
+make_keys(FILE * ifp, FILE * ofp)
{
- char buffer[BUFSIZ];
- char from[BUFSIZ];
- char to[BUFSIZ];
- int maxlen = 16;
+ char buffer[BUFSIZ];
+ char from[BUFSIZ];
+ char to[BUFSIZ];
+ int maxlen = 16;
- while (fgets(buffer, sizeof(buffer), ifp) != 0) {
- if (*buffer == '#')
- continue;
- if (sscanf(buffer, "%s %s", to, from) == 2) {
- int code = lookup(from);
- if (code == UNKNOWN)
- continue;
- if ((int)strlen(from) > maxlen)
- maxlen = strlen(from);
- fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n",
- code,
- maxlen, maxlen,
- to,
- from);
- }
+ while (fgets(buffer, sizeof(buffer), ifp) != 0) {
+ if (*buffer == '#')
+ continue;
+ if (sscanf(buffer, "%s %s", to, from) == 2) {
+ int code = lookup(from);
+ if (code == UNKNOWN)
+ continue;
+ if ((int) strlen(from) > maxlen)
+ maxlen = strlen(from);
+ fprintf(ofp, "\t{ %4d, %-*.*s },\t/* %s */\n",
+ code,
+ maxlen, maxlen,
+ to,
+ from);
}
+ }
}
-static void write_list(FILE *ofp, const char **list)
+static void
+write_list(FILE * ofp, const char **list)
{
- while (*list != 0)
- fprintf(ofp, "%s\n", *list++);
+ while (*list != 0)
+ fprintf(ofp, "%s\n", *list++);
}
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
- static const char *prefix[] = {
- "#ifndef NCU_KEYS_H",
- "#define NCU_KEYS_H 1",
- "",
- "/* This file was generated by MAKE_KEYS */",
- "",
- "#if BROKEN_LINKER",
- "static",
- "#endif",
- "struct tinfo_fkeys _nc_tinfo_fkeys[] = {",
- 0
- };
- static const char *suffix[] = {
- "\t{ 0, 0} };",
- "",
- "#endif /* NCU_KEYS_H */",
- 0
- };
+ static const char *prefix[] =
+ {
+ "#ifndef NCU_KEYS_H",
+ "#define NCU_KEYS_H 1",
+ "",
+ "/* This file was generated by MAKE_KEYS */",
+ "",
+ "#if BROKEN_LINKER",
+ "static",
+ "#endif",
+ "struct tinfo_fkeys _nc_tinfo_fkeys[] = {",
+ 0
+ };
+ static const char *suffix[] =
+ {
+ "\t{ 0, 0} };",
+ "",
+ "#endif /* NCU_KEYS_H */",
+ 0
+ };
- write_list(stdout, prefix);
- if (argc > 1) {
- int n;
- for (n = 1; n < argc; n++) {
- FILE *fp = fopen(argv[n], "r");
- if (fp != 0) {
- make_keys(fp, stdout);
- fclose(fp);
- }
- }
- } else {
- make_keys(stdin, stdout);
+ write_list(stdout, prefix);
+ if (argc > 1) {
+ int n;
+ for (n = 1; n < argc; n++) {
+ FILE *fp = fopen(argv[n], "r");
+ if (fp != 0) {
+ make_keys(fp, stdout);
+ fclose(fp);
+ }
}
- write_list(stdout, suffix);
- return EXIT_SUCCESS;
+ } else {
+ make_keys(stdin, stdout);
+ }
+ write_list(stdout, suffix);
+ return EXIT_SUCCESS;
}
diff --git a/lib/libcurses/tinfo/name_match.c b/lib/libcurses/tinfo/name_match.c
index 77099d601be..6db7ac7057f 100644
--- a/lib/libcurses/tinfo/name_match.c
+++ b/lib/libcurses/tinfo/name_match.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: name_match.c,v 1.2 1999/03/11 21:03:57 millert Exp $ */
+/* $OpenBSD: name_match.c,v 1.3 2001/01/22 18:01:55 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1999,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -36,7 +36,7 @@
#include <term.h>
#include <tic.h>
-MODULE_ID("$From: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $")
+MODULE_ID("$From: name_match.c,v 1.10 2000/12/10 02:55:08 tom Exp $")
/*
* _nc_first_name(char *names)
@@ -44,19 +44,20 @@ MODULE_ID("$From: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $")
* Extract the primary name from a compiled entry.
*/
-char *_nc_first_name(const char *const sp)
+NCURSES_EXPORT(char *)
+_nc_first_name(const char *const sp)
/* get the first name from the given name list */
{
- static char buf[MAX_NAME_SIZE+1];
- register unsigned n;
+ static char buf[MAX_NAME_SIZE + 1];
+ register unsigned n;
- for (n = 0; n < sizeof(buf)-1; n++) {
- if ((buf[n] = sp[n]) == '\0'
- || (buf[n] == '|'))
- break;
- }
- buf[n] = '\0';
- return(buf);
+ for (n = 0; n < sizeof(buf) - 1; n++) {
+ if ((buf[n] = sp[n]) == '\0'
+ || (buf[n] == '|'))
+ break;
+ }
+ buf[n] = '\0';
+ return (buf);
}
/*
@@ -65,34 +66,36 @@ char *_nc_first_name(const char *const sp)
* Is the given name matched in namelist?
*/
-int _nc_name_match(const char *const namelst, const char *const name, const char *const delim)
+NCURSES_EXPORT(int)
+_nc_name_match
+(const char *const namelst, const char *const name, const char *const delim)
{
- const char *s, *d, *t;
- int code, found;
+ const char *s, *d, *t;
+ int code, found;
- if ((s = namelst) != 0) {
- while (*s != '\0') {
- for (d = name; *d != '\0'; d++) {
- if (*s != *d)
- break;
- s++;
- }
- found = FALSE;
- for (code = TRUE; *s != '\0'; code = FALSE, s++) {
- for (t = delim; *t != '\0'; t++) {
- if (*s == *t) {
- found = TRUE;
- break;
- }
- }
- if (found)
- break;
- }
- if (code && *d == '\0')
- return code;
- if (*s++ == 0)
- break;
+ if ((s = namelst) != 0) {
+ while (*s != '\0') {
+ for (d = name; *d != '\0'; d++) {
+ if (*s != *d)
+ break;
+ s++;
+ }
+ found = FALSE;
+ for (code = TRUE; *s != '\0'; code = FALSE, s++) {
+ for (t = delim; *t != '\0'; t++) {
+ if (*s == *t) {
+ found = TRUE;
+ break;
+ }
}
+ if (found)
+ break;
+ }
+ if (code && *d == '\0')
+ return code;
+ if (*s++ == 0)
+ break;
}
- return FALSE;
+ }
+ return FALSE;
}
diff --git a/lib/libcurses/tinfo/parse_entry.c b/lib/libcurses/tinfo/parse_entry.c
index 3a88ec027e2..2327915b9db 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.8 2000/10/08 22:47:02 millert Exp $ */
+/* $OpenBSD: parse_entry.c,v 1.9 2001/01/22 18:01:55 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.48 2000/10/03 09:38:48 tom Exp $")
+MODULE_ID("$From: parse_entry.c,v 1.52 2001/01/13 22:44:29 tom Exp $")
#ifdef LINT
static short const parametrized[] =
@@ -197,8 +197,9 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type)
* push back token
*/
-int
-_nc_parse_entry(struct entry *entryp, int literal, bool silent)
+NCURSES_EXPORT(int)
+_nc_parse_entry
+(struct entry *entryp, int literal, bool silent)
{
int token_type;
struct name_table_entry const *entry_ptr;
@@ -466,12 +467,12 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent)
} else
postprocess_terminfo(&entryp->tterm);
}
- _nc_wrap_entry(entryp);
+ _nc_wrap_entry(entryp, FALSE);
return (OK);
}
-int
+NCURSES_EXPORT(int)
_nc_capcmp(const char *s, const char *t)
/* compare two string capabilities, stripping out padding */
{
@@ -483,15 +484,21 @@ _nc_capcmp(const char *s, const char *t)
for (;;) {
if (s[0] == '$' && s[1] == '<') {
for (s += 2;; s++)
- if (!(isdigit(*s) || *s == '.' || *s == '*' || *s == '/' ||
- *s == '>'))
+ if (!(isdigit(CharOf(*s))
+ || *s == '.'
+ || *s == '*'
+ || *s == '/'
+ || *s == '>'))
break;
}
if (t[0] == '$' && t[1] == '<') {
for (t += 2;; t++)
- if (!(isdigit(*t) || *t == '.' || *t == '*' || *t == '/' ||
- *t == '>'))
+ if (!(isdigit(CharOf(*t))
+ || *t == '.'
+ || *t == '*'
+ || *t == '/'
+ || *t == '>'))
break;
}
@@ -509,7 +516,7 @@ _nc_capcmp(const char *s, const char *t)
}
static void
-append_acs0(string_desc *dst, int code, int src)
+append_acs0(string_desc * dst, int code, int src)
{
if (src != 0) {
char temp[3];
@@ -521,7 +528,7 @@ append_acs0(string_desc *dst, int code, int src)
}
static void
-append_acs(string_desc *dst, int code, char *src)
+append_acs(string_desc * dst, int code, char *src)
{
if (src != 0 && strlen(src) == 1) {
append_acs0(dst, code, *src);
@@ -659,12 +666,12 @@ postprocess_termcap(TERMTYPE * tp, bool has_base)
} else if (PRESENT(carriage_return) && PRESENT(scroll_forward)) {
_nc_str_init(&result, buf, sizeof(buf));
if (_nc_safe_strcat(&result, carriage_return)
- && _nc_safe_strcat(&result, scroll_forward))
+ && _nc_safe_strcat(&result, scroll_forward))
newline = _nc_save_str(buf);
} else if (PRESENT(carriage_return) && PRESENT(cursor_down)) {
_nc_str_init(&result, buf, sizeof(buf));
if (_nc_safe_strcat(&result, carriage_return)
- && _nc_safe_strcat(&result, cursor_down))
+ && _nc_safe_strcat(&result, cursor_down))
newline = _nc_save_str(buf);
}
}
@@ -815,13 +822,15 @@ postprocess_termcap(TERMTYPE * tp, bool has_base)
}
}
- if (!hard_copy) {
- if (WANTED(key_backspace))
- key_backspace = _nc_save_str(C_BS);
- if (WANTED(key_left))
- key_left = _nc_save_str(C_BS);
- if (WANTED(key_down))
- key_down = _nc_save_str(C_LF);
+ if (!has_base) {
+ if (!hard_copy) {
+ if (WANTED(key_backspace))
+ key_backspace = _nc_save_str(C_BS);
+ if (WANTED(key_left))
+ key_left = _nc_save_str(C_BS);
+ if (WANTED(key_down))
+ key_down = _nc_save_str(C_LF);
+ }
}
/*
@@ -843,17 +852,17 @@ postprocess_termcap(TERMTYPE * tp, bool has_base)
_nc_str_init(&result, buf2, sizeof(buf2));
_nc_safe_strcat(&result, acs_chars);
- append_acs (&result, 'j', acs_lrcorner);
- append_acs (&result, 'k', acs_urcorner);
- append_acs (&result, 'l', acs_ulcorner);
- append_acs (&result, 'm', acs_llcorner);
- append_acs (&result, 'n', acs_plus);
- append_acs (&result, 'q', acs_hline);
- append_acs (&result, 't', acs_ltee);
- append_acs (&result, 'u', acs_rtee);
- append_acs (&result, 'v', acs_btee);
- append_acs (&result, 'w', acs_ttee);
- append_acs (&result, 'x', acs_vline);
+ append_acs(&result, 'j', acs_lrcorner);
+ append_acs(&result, 'k', acs_urcorner);
+ append_acs(&result, 'l', acs_ulcorner);
+ append_acs(&result, 'm', acs_llcorner);
+ append_acs(&result, 'n', acs_plus);
+ append_acs(&result, 'q', acs_hline);
+ append_acs(&result, 't', acs_ltee);
+ append_acs(&result, 'u', acs_rtee);
+ append_acs(&result, 'v', acs_btee);
+ append_acs(&result, 'w', acs_ttee);
+ append_acs(&result, 'x', acs_vline);
if (buf2[0]) {
acs_chars = _nc_save_str(buf2);
@@ -885,17 +894,17 @@ postprocess_terminfo(TERMTYPE * tp)
_nc_str_init(&result, buf2, sizeof(buf2));
_nc_safe_strcat(&result, acs_chars);
- append_acs0 (&result, 'l', box_chars_1[0]); /* ACS_ULCORNER */
- append_acs0 (&result, 'q', box_chars_1[1]); /* ACS_HLINE */
- append_acs0 (&result, 'k', box_chars_1[2]); /* ACS_URCORNER */
- append_acs0 (&result, 'x', box_chars_1[3]); /* ACS_VLINE */
- append_acs0 (&result, 'j', box_chars_1[4]); /* ACS_LRCORNER */
- append_acs0 (&result, 'm', box_chars_1[5]); /* ACS_LLCORNER */
- append_acs0 (&result, 'w', box_chars_1[6]); /* ACS_TTEE */
- append_acs0 (&result, 'u', box_chars_1[7]); /* ACS_RTEE */
- append_acs0 (&result, 'v', box_chars_1[8]); /* ACS_BTEE */
- append_acs0 (&result, 't', box_chars_1[9]); /* ACS_LTEE */
- append_acs0 (&result, 'n', box_chars_1[10]); /* ACS_PLUS */
+ append_acs0(&result, 'l', box_chars_1[0]); /* ACS_ULCORNER */
+ append_acs0(&result, 'q', box_chars_1[1]); /* ACS_HLINE */
+ append_acs0(&result, 'k', box_chars_1[2]); /* ACS_URCORNER */
+ append_acs0(&result, 'x', box_chars_1[3]); /* ACS_VLINE */
+ append_acs0(&result, 'j', box_chars_1[4]); /* ACS_LRCORNER */
+ append_acs0(&result, 'm', box_chars_1[5]); /* ACS_LLCORNER */
+ append_acs0(&result, 'w', box_chars_1[6]); /* ACS_TTEE */
+ append_acs0(&result, 'u', box_chars_1[7]); /* ACS_RTEE */
+ append_acs0(&result, 'v', box_chars_1[8]); /* ACS_BTEE */
+ append_acs0(&result, 't', box_chars_1[9]); /* ACS_LTEE */
+ append_acs0(&result, 'n', box_chars_1[10]); /* ACS_PLUS */
if (buf2[0]) {
acs_chars = _nc_save_str(buf2);
diff --git a/lib/libcurses/tinfo/read_entry.c b/lib/libcurses/tinfo/read_entry.c
index 7ebc4785572..2d6f4ba4ba6 100644
--- a/lib/libcurses/tinfo/read_entry.c
+++ b/lib/libcurses/tinfo/read_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_entry.c,v 1.11 2000/10/22 18:27:23 millert Exp $ */
+/* $OpenBSD: read_entry.c,v 1.12 2001/01/22 18:01:55 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -43,7 +43,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$From: read_entry.c,v 1.69 2000/10/10 00:57:40 Todd.Miller Exp $")
+MODULE_ID("$From: read_entry.c,v 1.72 2000/12/10 02:55:08 tom Exp $")
#if !HAVE_TELL
#define tell(fd) 0 /* lseek() is POSIX, but not tell() - odd... */
@@ -72,7 +72,7 @@ static bool keep_tic_directory = FALSE;
* Record the "official" location of the terminfo directory, according to
* the place where we're writing to, or the normal default, if not.
*/
-const char *
+NCURSES_EXPORT(const char *)
_nc_tic_dir(const char *path)
{
static const char *result = TERMINFO;
@@ -95,7 +95,7 @@ _nc_tic_dir(const char *path)
* has chdir'd to it. If we let it be changed, then if $TERMINFO has a
* relative path, we'll lose track of the actual directory.
*/
-void
+NCURSES_EXPORT(void)
_nc_keep_tic_dir(const char *path)
{
_nc_tic_dir(path);
@@ -375,8 +375,9 @@ read_termtype(int fd, TERMTYPE * ptr)
return (1);
}
-int
-_nc_read_file_entry(const char *const filename, TERMTYPE * ptr)
+NCURSES_EXPORT(int)
+_nc_read_file_entry
+(const char *const filename, TERMTYPE * ptr)
/* return 1 if read, 0 if not found or garbled */
{
int code, fd = -1;
@@ -435,7 +436,7 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const
for (;;) {
int c = *a;
- if (c == 0 || c == ':') {
+ if (c == 0 || c == NCURSES_PATHSEP) {
*a = 0;
if ((b + 1) >= a)
b = TERMINFO;
@@ -463,8 +464,9 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const
* overrun the file buffer.
*/
-int
-_nc_read_entry(const char *const tn, char *const filename, TERMTYPE * const tp)
+NCURSES_EXPORT(int)
+_nc_read_entry
+(const char *const tn, char *const filename, TERMTYPE * const tp)
{
char *envp;
char ttn[MAX_ALIAS + 3];
diff --git a/lib/libcurses/tinfo/read_termcap.c b/lib/libcurses/tinfo/read_termcap.c
index fe7aa25c5ad..5240db23745 100644
--- a/lib/libcurses/tinfo/read_termcap.c
+++ b/lib/libcurses/tinfo/read_termcap.c
@@ -55,7 +55,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$From: read_termcap.c,v 1.51 2000/10/21 00:34:11 Philip.Guenther Exp $")
+MODULE_ID("$From: read_termcap.c,v 1.55 2000/12/10 02:55:08 tom Exp $")
#if !PURE_TERMINFO
@@ -784,7 +784,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
pvec = pathvec;
tbuf = bp;
p = pathbuf;
- cp = use_terminfo_vars() ? getenv("TERMCAP") : NULL;
+ cp = use_terminfo_vars()? getenv("TERMCAP") : NULL;
/*
* TERMCAP can have one of two things in it. It can be the name of a file
@@ -821,10 +821,10 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
*fname++ = pathbuf; /* tokenize path into vector of names */
while (*++p) {
- if (*p == ' ' || *p == ':') {
+ if (*p == ' ' || *p == NCURSES_PATHSEP) {
*p = '\0';
while (*++p)
- if (*p != ' ' && *p != ':')
+ if (*p != ' ' && *p != NCURSES_PATHSEP)
break;
if (*p == '\0')
break;
@@ -917,8 +917,9 @@ add_tc(char *termpaths[], char *path, int count)
#define ADD_TC(path, count) filecount = add_tc(termpaths, path, count)
#endif /* !USE_GETCAP */
-int
-_nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp)
+NCURSES_EXPORT(int)
+_nc_read_termcap_entry
+(const char *const tn, TERMTYPE * const tp)
{
int found = FALSE;
ENTRY *ep;
@@ -989,7 +990,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp)
char *cp;
for (cp = tc; *cp; cp++) {
- if (*cp == ':')
+ if (*cp == NCURSES_PATHSEP)
*cp = '\0';
else if (cp == tc || cp[-1] == '\0') {
ADD_TC(cp, filecount);
@@ -1102,8 +1103,10 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp)
return (found);
}
#else
-extern void _nc_read_termcap(void);
-void
+extern
+NCURSES_EXPORT(void)
+_nc_read_termcap(void);
+NCURSES_EXPORT(void)
_nc_read_termcap(void)
{
}
diff --git a/lib/libcurses/tinfo/setbuf.c b/lib/libcurses/tinfo/setbuf.c
index d798cce9611..cfe3771b036 100644
--- a/lib/libcurses/tinfo/setbuf.c
+++ b/lib/libcurses/tinfo/setbuf.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: setbuf.c,v 1.3 1999/03/02 06:23:29 millert Exp $ */
+/* $OpenBSD: setbuf.c,v 1.4 2001/01/22 18:01:57 millert Exp $ */
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -33,8 +33,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
-
/*
** setbuf.c
**
@@ -44,7 +42,7 @@
#include <curses.priv.h>
-MODULE_ID("$From: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $")
+MODULE_ID("$From: setbuf.c,v 1.7 2000/12/10 02:55:08 tom Exp $")
/*
* If the output file descriptor is connected to a tty (the typical case) it
@@ -101,45 +99,47 @@ MODULE_ID("$From: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $")
* do indeed get confused by changing setbuf on/off, and will overrun the
* buffer. So we disable this by default (there may yet be a workaround).
*/
-void _nc_set_buffer(FILE *ofp, bool buffered)
+NCURSES_EXPORT(void)
+_nc_set_buffer(FILE * ofp, bool buffered)
{
- /* optional optimization hack -- do before any output to ofp */
+ /* optional optimization hack -- do before any output to ofp */
#if HAVE_SETVBUF || HAVE_SETBUFFER
- unsigned buf_len;
- char *buf_ptr;
+ unsigned buf_len;
+ char *buf_ptr;
- if (getenv("NCURSES_NO_SETBUF") != 0)
- return;
+ if (getenv("NCURSES_NO_SETBUF") != 0)
+ return;
- fflush(ofp);
- if ((SP->_buffered = buffered) != 0) {
- buf_len = min(LINES * (COLS + 6), 2800);
- if ((buf_ptr = SP->_setbuf) == 0) {
- if ((buf_ptr = typeMalloc(char, buf_len)) == NULL)
- return;
- SP->_setbuf = buf_ptr;
- /* Don't try to free this! */
- }
+ fflush(ofp);
+ if ((SP->_buffered = buffered) != 0) {
+ buf_len = min(LINES * (COLS + 6), 2800);
+ if ((buf_ptr = SP->_setbuf) == 0) {
+ if ((buf_ptr = typeMalloc(char, buf_len)) == NULL)
+ return;
+ SP->_setbuf = buf_ptr;
+ /* Don't try to free this! */
+ }
#if !USE_SETBUF_0
- else return;
+ else
+ return;
#endif
- } else {
+ } else {
#if !USE_SETBUF_0
- return;
+ return;
#else
- buf_len = 0;
- buf_ptr = 0;
+ buf_len = 0;
+ buf_ptr = 0;
#endif
- }
+ }
#if HAVE_SETVBUF
-#ifdef SETVBUF_REVERSED /* pre-svr3? */
- (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF);
+#ifdef SETVBUF_REVERSED /* pre-svr3? */
+ (void) setvbuf(ofp, buf_ptr, buf_len, buf_len ? _IOFBF : _IOLBF);
#else
- (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len);
+ (void) setvbuf(ofp, buf_ptr, buf_len ? _IOFBF : _IOLBF, buf_len);
#endif
#elif HAVE_SETBUFFER
- (void) setbuffer(ofp, buf_ptr, (int)buf_len);
+ (void) setbuffer(ofp, buf_ptr, (int) buf_len);
#endif
#endif /* HAVE_SETVBUF || HAVE_SETBUFFER */
diff --git a/lib/libcurses/tinfo/strings.c b/lib/libcurses/tinfo/strings.c
index 28b55f0b9dc..4e3fcf1ea53 100644
--- a/lib/libcurses/tinfo/strings.c
+++ b/lib/libcurses/tinfo/strings.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strings.c,v 1.1 2000/10/08 22:47:03 millert Exp $ */
+/* $OpenBSD: strings.c,v 1.2 2001/01/22 18:01:57 millert Exp $ */
/****************************************************************************
* Copyright (c) 2000 Free Software Foundation, Inc. *
@@ -38,15 +38,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id")
+MODULE_ID("$From: strings.c,v 1.3 2000/12/10 02:55:08 tom Exp $")
/****************************************************************************
* Useful string functions (especially for mvcur)
****************************************************************************/
#if !HAVE_STRSTR
-char *
-_nc_strstr(const char *haystack, const char *needle)
+NCURSES_EXPORT(char *)
+_nc_strstr
+(const char *haystack, const char *needle)
{
size_t len1 = strlen(haystack);
size_t len2 = strlen(needle);
@@ -66,8 +67,9 @@ _nc_strstr(const char *haystack, const char *needle)
/*
* Initialize the descriptor so we can append to it.
*/
-string_desc *
-_nc_str_init(string_desc * dst, char *src, size_t len)
+NCURSES_EXPORT(string_desc *)
+_nc_str_init
+(string_desc * dst, char *src, size_t len)
{
if (dst != 0) {
dst->s_head = src;
@@ -82,8 +84,9 @@ _nc_str_init(string_desc * dst, char *src, size_t len)
/*
* Initialize the descriptor for only tracking the amount of memory used.
*/
-string_desc *
-_nc_str_null(string_desc * dst, size_t len)
+NCURSES_EXPORT(string_desc *)
+_nc_str_null
+(string_desc * dst, size_t len)
{
return _nc_str_init(dst, 0, len);
}
@@ -91,8 +94,9 @@ _nc_str_null(string_desc * dst, size_t len)
/*
* Copy a descriptor
*/
-string_desc *
-_nc_str_copy(string_desc * dst, string_desc * src)
+NCURSES_EXPORT(string_desc *)
+_nc_str_copy
+(string_desc * dst, string_desc * src)
{
*dst = *src;
return dst;
@@ -101,7 +105,7 @@ _nc_str_copy(string_desc * dst, string_desc * src)
/*
* Replaces strcat into a fixed buffer, returning false on failure.
*/
-bool
+NCURSES_EXPORT(bool)
_nc_safe_strcat(string_desc * dst, const char *src)
{
if (src != 0) {
@@ -122,7 +126,7 @@ _nc_safe_strcat(string_desc * dst, const char *src)
/*
* Replaces strcpy into a fixed buffer, returning false on failure.
*/
-bool
+NCURSES_EXPORT(bool)
_nc_safe_strcpy(string_desc * dst, const char *src)
{
if (src != 0) {
diff --git a/lib/libcurses/tinfo/write_entry.c b/lib/libcurses/tinfo/write_entry.c
index b282d069c81..c7a5958a4bf 100644
--- a/lib/libcurses/tinfo/write_entry.c
+++ b/lib/libcurses/tinfo/write_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write_entry.c,v 1.9 2000/10/08 22:47:03 millert Exp $ */
+/* $OpenBSD: write_entry.c,v 1.10 2001/01/22 18:01:57 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -54,7 +54,7 @@
#define TRACE_OUT(p) /*nothing */
#endif
-MODULE_ID("$From: write_entry.c,v 1.53 2000/10/04 02:32:14 tom Exp $")
+MODULE_ID("$From: write_entry.c,v 1.56 2000/12/10 02:55:08 tom Exp $")
static int total_written;
@@ -111,7 +111,7 @@ make_directory(const char *path)
return rc;
}
-void
+NCURSES_EXPORT(void)
_nc_set_writedir(char *dir)
/* set the write directory for compiled entries */
{
@@ -119,7 +119,7 @@ _nc_set_writedir(char *dir)
char actual[PATH_MAX];
if (dir == 0
- && use_terminfo_vars())
+ && use_terminfo_vars())
dir = getenv("TERMINFO");
if (dir != 0)
@@ -133,7 +133,7 @@ _nc_set_writedir(char *dir)
destination = home;
if (make_directory(destination) < 0)
_nc_err_abort("%s: permission denied (errno %d)",
- destination, errno);
+ destination, errno);
}
}
@@ -166,7 +166,7 @@ check_writeable(int code)
static bool verified[sizeof(dirnames)];
char dir[2];
- char *s;
+ char *s = 0;
if (code == 0 || (s = strchr(dirnames, code)) == 0)
_nc_err_abort("Illegal terminfo subdirectory \"%c\"", code);
@@ -277,7 +277,7 @@ _nc_write_entry(TERMTYPE * const tp)
if (stat(filename, &statbuf) < 0
|| (start_time = statbuf.st_mtime) == 0) {
_nc_syserr_abort("error obtaining time from %s/%s",
- _nc_tic_dir(0), filename);
+ _nc_tic_dir(0), filename);
}
}
while (*other_names != '\0') {
@@ -303,7 +303,7 @@ _nc_write_entry(TERMTYPE * const tp)
if (strcmp(filename, linkname) == 0) {
_nc_warning("self-synonym ignored");
} else if (stat(linkname, &statbuf) >= 0 &&
- statbuf.st_mtime < start_time) {
+ statbuf.st_mtime < start_time) {
_nc_warning("alias %s multiply defined.", ptr);
} else if (_nc_access(linkname, W_OK) == 0)
#if HAVE_LINK
@@ -335,10 +335,16 @@ _nc_write_entry(TERMTYPE * const tp)
*/
if (code == 0 && errno == EEXIST)
_nc_warning("can't link %s to %s", filename, linkname);
- else if (code == 0 && errno == EPERM)
+ else if (code == 0 && (errno == EPERM || errno == ENOENT))
write_file(linkname, tp);
- else
+ else {
+#if MIXEDCASE_FILENAMES
_nc_syserr_abort("can't link %s to %s", filename, linkname);
+#else
+ _nc_warning("can't link %s to %s (errno=%d)", filename,
+ linkname, errno);
+#endif
+ }
} else {
DEBUG(1, ("Linked %s", linkname));
}
@@ -522,7 +528,7 @@ write_object(FILE * fp, TERMTYPE * tp)
TRACE_OUT(("WRITE %d booleans @%ld", tp->ext_Booleans, ftell(fp)));
if (tp->ext_Booleans
&& fwrite(tp->Booleans + BOOLCOUNT, sizeof(char),
- tp->ext_Booleans, fp) != tp->ext_Booleans)
+ tp->ext_Booleans, fp) != tp->ext_Booleans)
return (ERR);
if (even_boundary(tp->ext_Booleans))
@@ -551,7 +557,7 @@ write_object(FILE * fp, TERMTYPE * tp)
for (i = 0; i < tp->ext_Strings; i++) {
if (VALID_STRING(tp->Strings[i + STRCOUNT])) {
TRACE_OUT(("WRITE ext_Strings[%d]=%s", i,
- _nc_visbuf(tp->Strings[i + STRCOUNT])));
+ _nc_visbuf(tp->Strings[i + STRCOUNT])));
if (!WRITE_STRING(tp->Strings[i + STRCOUNT]))
return (ERR);
}
@@ -576,7 +582,7 @@ write_object(FILE * fp, TERMTYPE * tp)
/*
* Returns the total number of entries written by this process
*/
-int
+NCURSES_EXPORT(int)
_nc_tic_written(void)
{
return total_written;