aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses/tinfo
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2001-05-17 08:21:06 +0000
committerPeter Wemm <peter@FreeBSD.org>2001-05-17 08:21:06 +0000
commit7a69bbfb278952228c9aa1eca241e65fcdef425e (patch)
treee83b2ef47811e687a6c54035c9af6d4a2b7f14e1 /contrib/ncurses/ncurses/tinfo
parent18259542b2f8fa7e3f76f4bb0dd37995dfd424aa (diff)
downloadsrc-7a69bbfb278952228c9aa1eca241e65fcdef425e.tar.gz
src-7a69bbfb278952228c9aa1eca241e65fcdef425e.zip
Import ncurses-5.2-20010512 onto the vendor branch
Obtained from: ftp://dickey.his.com/ncurses/
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=76726
Diffstat (limited to 'contrib/ncurses/ncurses/tinfo')
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKcaptab.awk7
-rwxr-xr-xcontrib/ncurses/ncurses/tinfo/MKfallback.sh4
-rw-r--r--contrib/ncurses/ncurses/tinfo/MKnames.awk8
-rw-r--r--contrib/ncurses/ncurses/tinfo/access.c12
-rw-r--r--contrib/ncurses/ncurses/tinfo/add_tries.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/alloc_entry.c64
-rw-r--r--contrib/ncurses/ncurses/tinfo/alloc_ttype.c12
-rw-r--r--contrib/ncurses/ncurses/tinfo/captoinfo.c63
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_error.c127
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_expand.c260
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_hash.c362
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_parse.c101
-rw-r--r--contrib/ncurses/ncurses/tinfo/comp_scan.c232
-rw-r--r--contrib/ncurses/ncurses/tinfo/doalloc.c31
-rw-r--r--contrib/ncurses/ncurses/tinfo/free_ttype.c11
-rw-r--r--contrib/ncurses/ncurses/tinfo/getenv_num.c26
-rw-r--r--contrib/ncurses/ncurses/tinfo/home_terminfo.c4
-rw-r--r--contrib/ncurses/ncurses/tinfo/init_keytry.c38
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_acs.c210
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_baudrate.c14
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_cur_term.c46
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_data.c35
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_has_cap.c29
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_kernel.c72
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_longname.c19
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_napms.c4
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_options.c28
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_print.c33
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_raw.c16
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_setup.c49
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_termcap.c24
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_termname.c26
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_tgoto.c39
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_ti.c8
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_tparm.c32
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_tputs.c38
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_ttyflags.c139
-rw-r--r--contrib/ncurses/ncurses/tinfo/make_keys.c154
-rw-r--r--contrib/ncurses/ncurses/tinfo/name_match.c79
-rw-r--r--contrib/ncurses/ncurses/tinfo/parse_entry.c99
-rw-r--r--contrib/ncurses/ncurses/tinfo/read_entry.c18
-rw-r--r--contrib/ncurses/ncurses/tinfo/read_termcap.c25
-rw-r--r--contrib/ncurses/ncurses/tinfo/setbuf.c58
-rw-r--r--contrib/ncurses/ncurses/tinfo/strings.c26
-rw-r--r--contrib/ncurses/ncurses/tinfo/write_entry.c30
45 files changed, 1449 insertions, 1269 deletions
diff --git a/contrib/ncurses/ncurses/tinfo/MKcaptab.awk b/contrib/ncurses/ncurses/tinfo/MKcaptab.awk
index 910af94b7a48..ff9601ba62c5 100644
--- a/contrib/ncurses/ncurses/tinfo/MKcaptab.awk
+++ b/contrib/ncurses/ncurses/tinfo/MKcaptab.awk
@@ -1,5 +1,5 @@
#!/bin/sh
-# $Id: MKcaptab.awk,v 1.11 1999/01/24 02:46:42 Jeffrey.C.Honig Exp $
+# $Id: MKcaptab.awk,v 1.12 2000/12/10 00:14:12 tom Exp $
AWK=${1-awk}
DATA=${2-../include/Caps}
@@ -11,6 +11,7 @@ cat <<'EOF'
*/
#include <ncurses_cfg.h>
+#include <curses.priv.h>
#include <tic.h>
#include <term.h>
@@ -58,12 +59,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/contrib/ncurses/ncurses/tinfo/MKfallback.sh b/contrib/ncurses/ncurses/tinfo/MKfallback.sh
index 2a76f6239b2b..de3e23a877c2 100755
--- a/contrib/ncurses/ncurses/tinfo/MKfallback.sh
+++ b/contrib/ncurses/ncurses/tinfo/MKfallback.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $Id: MKfallback.sh,v 1.9 1999/06/15 22:57:45 tom Exp $
+# $Id: MKfallback.sh,v 1.10 2000/12/10 00:14:39 tom Exp $
#
# MKfallback.sh -- create fallback table for entry reads
#
@@ -50,7 +50,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/contrib/ncurses/ncurses/tinfo/MKnames.awk b/contrib/ncurses/ncurses/tinfo/MKnames.awk
index b97eccc15e38..455efc01dea3 100644
--- a/contrib/ncurses/ncurses/tinfo/MKnames.awk
+++ b/contrib/ncurses/ncurses/tinfo/MKnames.awk
@@ -1,4 +1,4 @@
-# $Id: MKnames.awk,v 1.10 1999/01/16 23:36:34 tom Exp $
+# $Id: 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"
@@ -10,7 +10,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"
@@ -80,7 +80,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"
@@ -90,7 +90,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/contrib/ncurses/ncurses/tinfo/access.c b/contrib/ncurses/ncurses/tinfo/access.c
index 6fbe92176045..c8071d81dbe0 100644
--- a/contrib/ncurses/ncurses/tinfo/access.c
+++ b/contrib/ncurses/ncurses/tinfo/access.c
@@ -33,9 +33,9 @@
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$Id: access.c,v 1.4 2000/10/08 01:25:06 tom Exp $")
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/add_tries.c b/contrib/ncurses/ncurses/tinfo/add_tries.c
index 601fb663b7b6..f83249ccf01a 100644
--- a/contrib/ncurses/ncurses/tinfo/add_tries.c
+++ b/contrib/ncurses/ncurses/tinfo/add_tries.c
@@ -39,12 +39,12 @@
#include <curses.priv.h>
-MODULE_ID("$Id: add_tries.c,v 1.2 2000/03/18 22:23:56 tom Exp $")
+MODULE_ID("$Id: 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;
@@ -61,7 +61,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/contrib/ncurses/ncurses/tinfo/alloc_entry.c b/contrib/ncurses/ncurses/tinfo/alloc_entry.c
index 17489372e464..e668e364f178 100644
--- a/contrib/ncurses/ncurses/tinfo/alloc_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/alloc_entry.c
@@ -47,7 +47,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: alloc_entry.c,v 1.32 2000/03/12 00:16:31 tom Exp $")
+MODULE_ID("$Id: alloc_entry.c,v 1.35 2001/01/13 22:40:17 tom Exp $")
#define ABSENT_OFFSET -1
#define CANCELLED_OFFSET -2
@@ -57,7 +57,7 @@ MODULE_ID("$Id: 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 */
{
@@ -90,7 +90,7 @@ _nc_init_entry(TERMTYPE * const tp)
next_free = 0;
}
-ENTRY *
+NCURSES_EXPORT(ENTRY *)
_nc_copy_entry(ENTRY * oldp)
{
ENTRY *newp = typeCalloc(ENTRY, 1);
@@ -102,7 +102,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 */
{
@@ -118,14 +118,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)
@@ -158,18 +179,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
@@ -182,8 +205,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/contrib/ncurses/ncurses/tinfo/alloc_ttype.c b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c
index eac7c80f0328..c13c5d6c29ed 100644
--- a/contrib/ncurses/ncurses/tinfo/alloc_ttype.c
+++ b/contrib/ncurses/ncurses/tinfo/alloc_ttype.c
@@ -43,7 +43,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: alloc_ttype.c,v 1.10 2000/08/12 21:56:24 tom Exp $")
+MODULE_ID("$Id: alloc_ttype.c,v 1.12 2000/12/10 02:55:07 tom Exp $")
#if NCURSES_XNAMES
/*
@@ -370,8 +370,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);
@@ -455,8 +456,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/contrib/ncurses/ncurses/tinfo/captoinfo.c b/contrib/ncurses/ncurses/tinfo/captoinfo.c
index da1382683942..9b68cd2d25c3 100644
--- a/contrib/ncurses/ncurses/tinfo/captoinfo.c
+++ b/contrib/ncurses/ncurses/tinfo/captoinfo.c
@@ -39,7 +39,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.
@@ -92,7 +92,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: captoinfo.c,v 1.37 2000/04/01 20:07:34 tom Exp $")
+MODULE_ID("$Id: 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 */
@@ -194,7 +194,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++;
}
@@ -268,13 +268,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;
@@ -291,9 +294,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') {
@@ -349,7 +352,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;
@@ -461,7 +464,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;
@@ -542,7 +545,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;
@@ -566,8 +569,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
@@ -594,7 +597,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);
@@ -629,13 +632,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;
@@ -649,13 +651,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++);
}
@@ -667,8 +669,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 '%' */
@@ -692,7 +697,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, "%+");
@@ -732,7 +737,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/contrib/ncurses/ncurses/tinfo/comp_error.c b/contrib/ncurses/ncurses/tinfo/comp_error.c
index 3767063da0a6..a39de8114de2 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_error.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_error.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,7 +31,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
* comp_error.c -- Error message routines
*
@@ -41,92 +40,98 @@
#include <tic.h>
-MODULE_ID("$Id: comp_error.c,v 1.17 1999/10/30 23:00:16 tom Exp $")
+MODULE_ID("$Id: comp_error.c,v 1.21 2000/12/10 02:55:07 tom Exp $")
-bool _nc_suppress_warnings = FALSE;
-int _nc_curr_line = 0; /* current line # in input */
-int _nc_curr_col = 0; /* current column # in input */
+NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE;
+NCURSES_EXPORT_VAR(int)
+_nc_curr_line = 0; /* current line # in input */
+NCURSES_EXPORT_VAR(int)
+_nc_curr_col = 0; /* current column # in input */
-static const char *sourcename;
-static char termtype[MAX_NAME_SIZE+1];
+ static const char *sourcename;
+ static char termtype[MAX_NAME_SIZE + 1];
-void _nc_set_source(const char *const name)
+NCURSES_EXPORT(void)
+_nc_set_source(const char *const name)
{
- sourcename = name;
+ sourcename = name;
}
-void _nc_set_type(const char *const name)
+NCURSES_EXPORT(void)
+_nc_set_type(const char *const name)
{
- if (name)
- strncpy( termtype, name, MAX_NAME_SIZE );
- else
- termtype[0] = '\0';
+ termtype[0] = '\0';
+ if (name)
+ strncat(termtype, name, sizeof(termtype) - 1);
}
-void _nc_get_type(char *name)
+NCURSES_EXPORT(void)
+_nc_get_type(char *name)
{
- strcpy( name, termtype );
+ strcpy(name, termtype);
}
-static inline void where_is_problem(void)
+static inline void
+where_is_problem(void)
{
- fprintf (stderr, "\"%s\"", sourcename);
- if (_nc_curr_line >= 0)
- fprintf (stderr, ", line %d", _nc_curr_line);
- if (_nc_curr_col >= 0)
- fprintf (stderr, ", col %d", _nc_curr_col);
- if (termtype[0])
- fprintf (stderr, ", terminal '%s'", termtype);
- fputc(':', stderr);
- fputc(' ', stderr);
+ fprintf(stderr, "\"%s\"", sourcename);
+ if (_nc_curr_line >= 0)
+ fprintf(stderr, ", line %d", _nc_curr_line);
+ if (_nc_curr_col >= 0)
+ fprintf(stderr, ", col %d", _nc_curr_col);
+ if (termtype[0])
+ fprintf(stderr, ", terminal '%s'", termtype);
+ fputc(':', stderr);
+ fputc(' ', stderr);
}
-void _nc_warning(const char *const fmt, ...)
+NCURSES_EXPORT(void)
+_nc_warning(const char *const fmt,...)
{
-va_list argp;
+ va_list argp;
- if (_nc_suppress_warnings)
- return;
+ if (_nc_suppress_warnings)
+ return;
- where_is_problem();
- va_start(argp,fmt);
- vfprintf (stderr, fmt, argp);
- fprintf (stderr, "\n");
- va_end(argp);
+ where_is_problem();
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ fprintf(stderr, "\n");
+ va_end(argp);
}
-
-void _nc_err_abort(const char *const fmt, ...)
+NCURSES_EXPORT(void)
+_nc_err_abort(const char *const fmt,...)
{
-va_list argp;
-
- where_is_problem();
- va_start(argp,fmt);
- vfprintf (stderr, fmt, argp);
- fprintf (stderr, "\n");
- va_end(argp);
- exit(EXIT_FAILURE);
+ va_list argp;
+
+ where_is_problem();
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ fprintf(stderr, "\n");
+ va_end(argp);
+ exit(EXIT_FAILURE);
}
-
-void _nc_syserr_abort(const char *const fmt, ...)
+NCURSES_EXPORT(void)
+_nc_syserr_abort(const char *const fmt,...)
{
-va_list argp;
+ va_list argp;
- where_is_problem();
- va_start(argp,fmt);
- vfprintf (stderr, fmt, argp);
- fprintf (stderr, "\n");
- va_end(argp);
+ where_is_problem();
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ fprintf(stderr, "\n");
+ va_end(argp);
- /* If we're debugging, try to show where the problem occurred - this
- * will dump core.
- */
+ /* If we're debugging, try to show where the problem occurred - this
+ * will dump core.
+ */
#if defined(TRACE) || !defined(NDEBUG)
- abort();
+ abort();
#else
- /* Dumping core in production code is not a good idea.
- */
- exit(EXIT_FAILURE);
+ /* Dumping core in production code is not a good idea.
+ */
+ exit(EXIT_FAILURE);
#endif
}
diff --git a/contrib/ncurses/ncurses/tinfo/comp_expand.c b/contrib/ncurses/ncurses/tinfo/comp_expand.c
index eb552fadabda..cf6339dcadec 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_expand.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_expand.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -35,13 +35,14 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$Id: comp_expand.c,v 1.11 1999/03/07 00:51:07 tom Exp $")
+MODULE_ID("$Id: 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 */
@@ -49,141 +50,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/contrib/ncurses/ncurses/tinfo/comp_hash.c b/contrib/ncurses/ncurses/tinfo/comp_hash.c
index 7e0bdd0524fe..fb18e3ad4aec 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_hash.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_hash.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,7 +31,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
* comp_hash.c --- Routines to deal with the hashtable of capability
* names.
@@ -46,12 +45,12 @@
#ifdef MAIN_PROGRAM
#include <ctype.h>
#undef DEBUG
-#define DEBUG(level, params) /*nothing*/
+#define DEBUG(level, params) /*nothing */
#endif
-MODULE_ID("$Id: comp_hash.c,v 1.21 1999/06/26 21:25:11 tom Exp $")
+MODULE_ID("$Id: comp_hash.c,v 1.24 2000/12/10 02:55:07 tom Exp $")
-static int hash_function(const char *);
+static int hash_function(const char *);
/*
* _nc_make_hash_table()
@@ -65,32 +64,33 @@ static int hash_function(const char *);
#ifdef MAIN_PROGRAM
#undef MODULE_ID
-#define MODULE_ID(id) /*nothing*/
+#define MODULE_ID(id) /*nothing */
#include <tinfo/doalloc.c>
-static void _nc_make_hash_table(struct name_table_entry *table,
- struct name_table_entry **hash_table)
+static void
+_nc_make_hash_table(struct name_table_entry *table,
+ struct name_table_entry **hash_table)
{
-int i;
-int hashvalue;
-int collisions = 0;
+ int i;
+ int hashvalue;
+ int collisions = 0;
- for (i = 0; i < CAPTABSIZE; i++) {
- hashvalue = hash_function(table[i].nte_name);
+ for (i = 0; i < CAPTABSIZE; i++) {
+ hashvalue = hash_function(table[i].nte_name);
- if (hash_table[hashvalue] != (struct name_table_entry *) 0)
- collisions++;
+ if (hash_table[hashvalue] != (struct name_table_entry *) 0)
+ collisions++;
- if (hash_table[hashvalue] != 0)
- table[i].nte_link = (short)(hash_table[hashvalue] - table);
- hash_table[hashvalue] = &table[i];
- }
+ if (hash_table[hashvalue] != 0)
+ table[i].nte_link = (short) (hash_table[hashvalue] - table);
+ hash_table[hashvalue] = &table[i];
+ }
- DEBUG(4, ("Hash table complete: %d collisions out of %d entries", collisions, CAPTABSIZE));
+ DEBUG(4, ("Hash table complete: %d collisions out of %d entries",
+ collisions, CAPTABSIZE));
}
#endif
-
/*
* int hash_function(string)
*
@@ -105,19 +105,18 @@ static
int
hash_function(const char *string)
{
-long sum = 0;
+ long sum = 0;
- DEBUG(9, ("hashing %s", string));
- while (*string) {
- sum += (long)(*string + (*(string + 1) << 8));
- string++;
- }
+ DEBUG(9, ("hashing %s", string));
+ while (*string) {
+ sum += (long) (*string + (*(string + 1) << 8));
+ string++;
+ }
- DEBUG(9, ("sum is %ld", sum));
- return (int)(sum % HASHTABSIZE);
+ DEBUG(9, ("sum is %ld", sum));
+ return (int) (sum % HASHTABSIZE);
}
-
/*
* struct name_table_entry *
* find_entry(string)
@@ -128,23 +127,24 @@ long sum = 0;
*/
#ifndef MAIN_PROGRAM
-struct name_table_entry const *
-_nc_find_entry(const char *string, const struct name_table_entry *const *hash_table)
+NCURSES_EXPORT(struct name_table_entry const *)
+_nc_find_entry
+(const char *string, const struct name_table_entry *const *hash_table)
{
-int hashvalue;
-struct name_table_entry const *ptr;
+ int hashvalue;
+ struct name_table_entry const *ptr;
- hashvalue = hash_function(string);
+ hashvalue = hash_function(string);
- if ((ptr = hash_table[hashvalue]) != 0) {
- while (strcmp(ptr->nte_name, string) != 0) {
- if (ptr->nte_link < 0)
- return 0;
- ptr = ptr->nte_link + hash_table[HASHTABSIZE];
- }
+ if ((ptr = hash_table[hashvalue]) != 0) {
+ while (strcmp(ptr->nte_name, string) != 0) {
+ if (ptr->nte_link < 0)
+ return 0;
+ ptr = ptr->nte_link + hash_table[HASHTABSIZE];
}
+ }
- return (ptr);
+ return (ptr);
}
/*
@@ -158,19 +158,20 @@ struct name_table_entry const *ptr;
* in the table or 0 if not found.
*/
-struct name_table_entry const *
-_nc_find_type_entry(const char *string,
- int type,
- const struct name_table_entry *table)
+NCURSES_EXPORT(struct name_table_entry const *)
+_nc_find_type_entry
+(const char *string,
+ int type,
+ const struct name_table_entry *table)
{
-struct name_table_entry const *ptr;
+ struct name_table_entry const *ptr;
- for (ptr = table; ptr < table + CAPTABSIZE; ptr++) {
- if (ptr->nte_type == type && strcmp(string, ptr->nte_name) == 0)
- return(ptr);
- }
+ for (ptr = table; ptr < table + CAPTABSIZE; ptr++) {
+ if (ptr->nte_type == type && strcmp(string, ptr->nte_name) == 0)
+ return (ptr);
+ }
- return ((struct name_table_entry *)NULL);
+ return ((struct name_table_entry *) NULL);
}
#endif
@@ -187,139 +188,144 @@ struct name_table_entry const *ptr;
#define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */
-static char **parse_columns(char *buffer)
+static char **
+parse_columns(char *buffer)
{
- static char **list;
-
- int col = 0;
-
- if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0)
- return(0);
-
- if (*buffer != '#') {
- while (*buffer != '\0') {
- char *s;
- for (s = buffer; (*s != '\0') && !isspace(*s); s++)
- /*EMPTY*/;
- if (s != buffer) {
- char mark = *s;
- *s = '\0';
- if ((s - buffer) > 1
- && (*buffer == '"')
- && (s[-1] == '"')) { /* strip the quotes */
- buffer++;
- s[-1] = '\0';
- }
- list[col] = buffer;
- col++;
- if (mark == '\0')
- break;
- while (*++s && isspace(*s))
- /*EMPTY*/;
- buffer = s;
- } else
- break;
+ static char **list;
+
+ int col = 0;
+
+ if (list == 0 && (list = typeCalloc(char *, MAX_COLUMNS)) == 0)
+ return (0);
+
+ if (*buffer != '#') {
+ while (*buffer != '\0') {
+ char *s;
+ for (s = buffer; (*s != '\0') && !isspace(CharOf(*s)); s++)
+ /*EMPTY */ ;
+ if (s != buffer) {
+ char mark = *s;
+ *s = '\0';
+ if ((s - buffer) > 1
+ && (*buffer == '"')
+ && (s[-1] == '"')) { /* strip the quotes */
+ buffer++;
+ s[-1] = '\0';
}
+ list[col] = buffer;
+ col++;
+ if (mark == '\0')
+ break;
+ while (*++s && isspace(CharOf(*s)))
+ /*EMPTY */ ;
+ buffer = s;
+ } else
+ break;
}
- return col ? list : 0;
+ }
+ return col ? list : 0;
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- struct name_table_entry *name_table = typeCalloc(struct name_table_entry, CAPTABSIZE);
- struct name_table_entry **hash_table = typeCalloc(struct name_table_entry *, HASHTABSIZE);
- const char *root_name = "";
- int column = 0;
- int n;
- char buffer[BUFSIZ];
-
- static const char * typenames[] = { "BOOLEAN", "NUMBER", "STRING" };
-
- short BoolCount = 0;
- short NumCount = 0;
- short StrCount = 0;
-
- /* The first argument is the column-number (starting with 0).
- * The second is the root name of the tables to generate.
- */
- if (argc <= 2
- || (column = atoi(argv[1])) <= 0
- || (column >= MAX_COLUMNS)
- || *(root_name = argv[2]) == 0) {
- fprintf(stderr, "usage: make_hash column root_name\n");
- exit(EXIT_FAILURE);
+ struct name_table_entry *name_table = typeCalloc(struct
+ name_table_entry, CAPTABSIZE);
+ struct name_table_entry **hash_table = typeCalloc(struct name_table_entry
+ *, HASHTABSIZE);
+ const char *root_name = "";
+ int column = 0;
+ int n;
+ char buffer[BUFSIZ];
+
+ static const char *typenames[] =
+ {"BOOLEAN", "NUMBER", "STRING"};
+
+ short BoolCount = 0;
+ short NumCount = 0;
+ short StrCount = 0;
+
+ /* The first argument is the column-number (starting with 0).
+ * The second is the root name of the tables to generate.
+ */
+ if (argc <= 2
+ || (column = atoi(argv[1])) <= 0
+ || (column >= MAX_COLUMNS)
+ || *(root_name = argv[2]) == 0) {
+ fprintf(stderr, "usage: make_hash column root_name\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * Read the table into our arrays.
+ */
+ for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin);) {
+ char **list, *nlp = strchr(buffer, '\n');
+ if (nlp)
+ *nlp = '\0';
+ list = parse_columns(buffer);
+ if (list == 0) /* blank or comment */
+ continue;
+ name_table[n].nte_link = -1; /* end-of-hash */
+ name_table[n].nte_name = strdup(list[column]);
+ if (!strcmp(list[2], "bool")) {
+ name_table[n].nte_type = BOOLEAN;
+ name_table[n].nte_index = BoolCount++;
+ } else if (!strcmp(list[2], "num")) {
+ name_table[n].nte_type = NUMBER;
+ name_table[n].nte_index = NumCount++;
+ } else if (!strcmp(list[2], "str")) {
+ name_table[n].nte_type = STRING;
+ name_table[n].nte_index = StrCount++;
+ } else {
+ fprintf(stderr, "Unknown type: %s\n", list[2]);
+ exit(EXIT_FAILURE);
}
-
- /*
- * Read the table into our arrays.
- */
- for (n = 0; (n < CAPTABSIZE) && fgets(buffer, BUFSIZ, stdin); ) {
- char **list, *nlp = strchr(buffer, '\n');
- if (nlp)
- *nlp = '\0';
- list = parse_columns(buffer);
- if (list == 0) /* blank or comment */
- continue;
- name_table[n].nte_link = -1; /* end-of-hash */
- name_table[n].nte_name = strdup(list[column]);
- if (!strcmp(list[2], "bool")) {
- name_table[n].nte_type = BOOLEAN;
- name_table[n].nte_index = BoolCount++;
- } else if (!strcmp(list[2], "num")) {
- name_table[n].nte_type = NUMBER;
- name_table[n].nte_index = NumCount++;
- } else if (!strcmp(list[2], "str")) {
- name_table[n].nte_type = STRING;
- name_table[n].nte_index = StrCount++;
- } else {
- fprintf(stderr, "Unknown type: %s\n", list[2]);
- exit(EXIT_FAILURE);
- }
- n++;
+ n++;
+ }
+ _nc_make_hash_table(name_table, hash_table);
+
+ /*
+ * Write the compiled tables to standard output
+ */
+ printf("static struct name_table_entry const _nc_%s_table[] =\n",
+ root_name);
+ printf("{\n");
+ for (n = 0; n < CAPTABSIZE; n++) {
+ sprintf(buffer, "\"%s\"",
+ name_table[n].nte_name);
+ printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n",
+ buffer,
+ typenames[name_table[n].nte_type],
+ name_table[n].nte_index,
+ name_table[n].nte_link,
+ n < CAPTABSIZE - 1 ? ',' : ' ');
+ }
+ printf("};\n\n");
+
+ printf("const struct name_table_entry * const _nc_%s_hash_table[%d] =\n",
+ root_name,
+ HASHTABSIZE + 1);
+ printf("{\n");
+ for (n = 0; n < HASHTABSIZE; n++) {
+ if (hash_table[n] != 0) {
+ sprintf(buffer, "_nc_%s_table + %3ld",
+ root_name,
+ (long) (hash_table[n] - name_table));
+ } else {
+ strcpy(buffer, "0");
}
- _nc_make_hash_table(name_table, hash_table);
-
- /*
- * Write the compiled tables to standard output
- */
- printf("static struct name_table_entry const _nc_%s_table[] =\n",
- root_name);
- printf("{\n");
- for (n = 0; n < CAPTABSIZE; n++) {
- sprintf(buffer, "\"%s\"",
- name_table[n].nte_name);
- printf("\t{ %15s,\t%10s,\t%3d, %3d }%c\n",
- buffer,
- typenames[name_table[n].nte_type],
- name_table[n].nte_index,
- name_table[n].nte_link,
- n < CAPTABSIZE - 1 ? ',' : ' ');
- }
- printf("};\n\n");
-
- printf("const struct name_table_entry * const _nc_%s_hash_table[%d] =\n",
- root_name,
- HASHTABSIZE+1);
- printf("{\n");
- for (n = 0; n < HASHTABSIZE; n++) {
- if (hash_table[n] != 0) {
- sprintf(buffer, "_nc_%s_table + %3ld",
- root_name,
- (long) (hash_table[n] - name_table));
- } else {
- strcpy(buffer, "0");
- }
- printf("\t%s,\n", buffer);
- }
- printf("\t_nc_%s_table\t/* base-of-table */\n", root_name);
- printf("};\n\n");
-
- printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n",
- BoolCount, NumCount, StrCount);
- printf("#error\t--> term.h and comp_captab.c disagree about the <--\n");
- printf("#error\t--> numbers of booleans, numbers and/or strings <--\n");
- printf("#endif\n\n");
-
- return EXIT_SUCCESS;
+ printf("\t%s,\n", buffer);
+ }
+ printf("\t_nc_%s_table\t/* base-of-table */\n", root_name);
+ printf("};\n\n");
+
+ printf("#if (BOOLCOUNT!=%d)||(NUMCOUNT!=%d)||(STRCOUNT!=%d)\n",
+ BoolCount, NumCount, StrCount);
+ printf("#error\t--> term.h and comp_captab.c disagree about the <--\n");
+ printf("#error\t--> numbers of booleans, numbers and/or strings <--\n");
+ printf("#endif\n\n");
+
+ return EXIT_SUCCESS;
}
#endif
diff --git a/contrib/ncurses/ncurses/tinfo/comp_parse.c b/contrib/ncurses/ncurses/tinfo/comp_parse.c
index c4083877ebca..917f95cdd1ca 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_parse.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_parse.c
@@ -52,10 +52,10 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: comp_parse.c,v 1.41 2000/10/03 09:53:49 tom Exp $")
+MODULE_ID("$Id: 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;
/****************************************************************************
*
@@ -78,10 +78,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);
@@ -97,7 +98,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 */
{
@@ -127,7 +128,7 @@ force_bar(char *dst, char *src)
{
if (strchr(src, '|') == 0) {
size_t len = strlen(src);
- if (len >= MAX_NAME_SIZE)
+ if (len > MAX_NAME_SIZE)
len = MAX_NAME_SIZE;
(void) strncpy(dst, src, len);
(void) strcpy(dst + len, "|");
@@ -136,7 +137,7 @@ force_bar(char *dst, char *src)
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? */
{
@@ -161,10 +162,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;
@@ -179,7 +180,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");
/*
@@ -209,7 +210,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 */
{
@@ -226,17 +227,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);
@@ -264,14 +266,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 */
@@ -282,7 +285,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)
@@ -330,7 +333,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
@@ -339,7 +342,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;
}
@@ -357,7 +360,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.
@@ -371,6 +374,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
@@ -392,15 +396,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;
+ }
}
}
@@ -444,14 +451,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/contrib/ncurses/ncurses/tinfo/comp_scan.c b/contrib/ncurses/ncurses/tinfo/comp_scan.c
index e1118f6f9ea9..a6ad55f4e269 100644
--- a/contrib/ncurses/ncurses/tinfo/comp_scan.c
+++ b/contrib/ncurses/ncurses/tinfo/comp_scan.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,1999,2000,2001 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 *
@@ -50,7 +50,7 @@
#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$Id: comp_scan.c,v 1.47 2000/09/24 01:15:17 tom Exp $")
+MODULE_ID("$Id: comp_scan.c,v 1.56 2001/04/21 18:53:34 tom Exp $")
/*
* Maximum length of string capability we'll accept before raising an error.
@@ -60,14 +60,22 @@ MODULE_ID("$Id: 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,7 +89,8 @@ 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);
@@ -133,8 +142,8 @@ eat_escaped_newline(int ch)
*
*/
-int
-_nc_get_token(void)
+NCURSES_EXPORT(int)
+_nc_get_token(bool silent)
{
static const char terminfo_punct[] = "@%&*!#";
long number;
@@ -202,8 +211,9 @@ _nc_get_token(void)
&& !(ch == '.' && _nc_disable_period)
#endif
&& !strchr(terminfo_punct, (char) ch)) {
- _nc_warning("Illegal character (expected alphanumeric or %s) - %s",
- terminfo_punct, unctrl(ch));
+ if (!silent)
+ _nc_warning("Illegal character (expected alphanumeric or %s) - %s",
+ terminfo_punct, unctrl((chtype) ch));
_nc_panic_mode(separator);
goto start_token;
}
@@ -230,13 +240,11 @@ _nc_get_token(void)
_nc_syntax = SYN_TERMINFO;
separator = ',';
/*
- * Fall-through here is not an accident.
- * The idea is that if we see a comma, we
- * figure this is terminfo unless we
- * subsequently run into a colon -- but
- * we don't stop looking for that colon until
- * hitting a newline. This allows commas to
- * be embedded in description fields of
+ * Fall-through here is not an accident. The idea is that
+ * if we see a comma, we figure this is terminfo unless we
+ * subsequently run into a colon -- but we don't stop
+ * looking for that colon until hitting a newline. This
+ * allows commas to be embedded in description fields of
* either syntax.
*/
/* FALLTHRU */
@@ -248,11 +256,10 @@ _nc_get_token(void)
ptr[0] = '\0';
if (_nc_syntax == ERR) {
/*
- * Grrr...what we ought to do here is barf,
- * complaining that the entry is malformed.
- * But because a couple of name fields in the
- * 8.2 termcap file end with |\, we just have
- * to assume it's termcap syntax.
+ * Grrr...what we ought to do here is barf, complaining that
+ * the entry is malformed. But because a couple of name fields
+ * in the 8.2 termcap file end with |\, we just have to assume
+ * it's termcap syntax.
*/
_nc_syntax = SYN_TERMCAP;
separator = ':';
@@ -264,8 +271,8 @@ _nc_get_token(void)
}
/*
- * This is the soonest we have the terminal name
- * fetched. Set up for following warning messages.
+ * This is the soonest we have the terminal name fetched. Set up
+ * for following warning messages.
*/
ptr = strchr(buffer, '|');
if (ptr == (char *) NULL)
@@ -276,11 +283,11 @@ _nc_get_token(void)
*ptr = ch;
/*
- * Compute the boundary between the aliases and the
- * description field for syntax-checking purposes.
+ * Compute the boundary between the aliases and the description
+ * field for syntax-checking purposes.
*/
desc = strrchr(buffer, '|');
- if (desc) {
+ if (!silent && desc) {
if (*desc == '\0')
_nc_warning("empty longname field");
else if (strchr(desc, ' ') == (char *) NULL)
@@ -290,20 +297,22 @@ _nc_get_token(void)
desc = buffer + strlen(buffer);
/*
- * Whitespace in a name field other than the long name
- * can confuse rdist and some termcap tools. Slashes
- * are a no-no. Other special characters can be
- * dangerous due to shell expansion.
+ * Whitespace in a name field other than the long name can confuse
+ * rdist and some termcap tools. Slashes are a no-no. Other
+ * special characters can be dangerous due to shell expansion.
*/
for (ptr = buffer; ptr < desc; ptr++) {
- if (isspace(*ptr)) {
- _nc_warning("whitespace in name or alias field");
+ if (isspace(CharOf(*ptr))) {
+ if (!silent)
+ _nc_warning("whitespace in name or alias field");
break;
} else if (*ptr == '/') {
- _nc_warning("slashes aren't allowed in names or aliases");
+ if (!silent)
+ _nc_warning("slashes aren't allowed in names or aliases");
break;
} else if (strchr("$[]!*?", *ptr)) {
- _nc_warning("dubious character `%c' in name or alias field", *ptr);
+ if (!silent)
+ _nc_warning("dubious character `%c' in name or alias field", *ptr);
break;
}
}
@@ -336,9 +345,9 @@ _nc_get_token(void)
type = BOOLEAN;
break;
case '@':
- if ((ch = next_char()) != separator)
+ if ((ch = next_char()) != separator && !silent)
_nc_warning("Missing separator after `%s', have %s",
- buffer, unctrl(ch));
+ buffer, unctrl((chtype) ch));
_nc_curr_token.tk_name = buffer;
type = CANCEL;
break;
@@ -352,10 +361,12 @@ _nc_get_token(void)
}
numbuf[found] = '\0';
number = strtol(numbuf, &numchk, 0);
- if (numchk == numbuf)
- _nc_warning("no value given for `%s'", buffer);
- if ((*numchk != '\0') || (ch != separator))
- _nc_warning("Missing separator");
+ if (!silent) {
+ if (numchk == numbuf)
+ _nc_warning("no value given for `%s'", buffer);
+ if ((*numchk != '\0') || (ch != separator))
+ _nc_warning("Missing separator");
+ }
_nc_curr_token.tk_name = buffer;
_nc_curr_token.tk_valnumber = number;
type = NUMBER;
@@ -363,7 +374,7 @@ _nc_get_token(void)
case '=':
ch = _nc_trans_string(ptr, buffer + sizeof(buffer));
- if (ch != separator)
+ if (!silent && ch != separator)
_nc_warning("Missing separator");
_nc_curr_token.tk_name = buffer;
_nc_curr_token.tk_valstring = ptr;
@@ -376,7 +387,8 @@ _nc_get_token(void)
default:
/* just to get rid of the compiler warning */
type = UNDEF;
- _nc_warning("Illegal character - %s", unctrl(ch));
+ if (!silent)
+ _nc_warning("Illegal character - %s", unctrl((chtype) ch));
}
} /* end else (first_column == FALSE) */
} /* end else (ch != EOF) */
@@ -428,9 +440,12 @@ _nc_get_token(void)
#endif
if (dot_flag == TRUE) /* if commented out, use the next one */
- type = _nc_get_token();
+ type = _nc_get_token(silent);
- DEBUG(3, ("token: `%s', class %d", _nc_curr_token.tk_name, type));
+ DEBUG(3, ("token: `%s', class %d",
+ _nc_curr_token.tk_name != 0 ? _nc_curr_token.tk_name :
+ "<null>",
+ type));
return (type);
}
@@ -454,11 +469,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,14 +623,14 @@ _nc_trans_string(char *ptr, char *last)
* get_token() call.
*/
-void
+NCURSES_EXPORT(void)
_nc_push_token(int tokclass)
{
/*
- * This implementation is kind of bogus, it will fail if we ever do
- * more than one pushback at a time between get_token() calls. It
- * relies on the fact that curr_tok is static storage that nothing
- * but get_token() touches.
+ * This implementation is kind of bogus, it will fail if we ever do more
+ * than one pushback at a time between get_token() calls. It relies on the
+ * fact that curr_tok is static storage that nothing but get_token()
+ * touches.
*/
pushtype = tokclass;
_nc_get_type(pushname);
@@ -627,7 +642,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 +676,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 +699,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;
@@ -708,6 +723,10 @@ static int
next_char(void)
{
if (!yyin) {
+ /*
+ * An string with an embedded null will truncate the input. This is
+ * intentional (we don't read binary files here).
+ */
if (*bufptr == '\0')
return (EOF);
if (*bufptr == '\n') {
@@ -716,52 +735,61 @@ next_char(void)
}
} else if (!bufptr || !*bufptr) {
/*
- * In theory this could be recoded to do its I/O one
- * character at a time, saving the buffer space. In
- * practice, this turns out to be quite hard to get
- * completely right. Try it and see. If you succeed,
- * don't forget to hack push_back() correspondingly.
+ * In theory this could be recoded to do its I/O one character at a
+ * time, saving the buffer space. In practice, this turns out to be
+ * quite hard to get completely right. Try it and see. If you
+ * succeed, don't forget to hack push_back() correspondingly.
*/
- static char line[LEXBUFSIZ];
+ static char *result;
+ static size_t allocated;
+ size_t used;
size_t len;
do {
- _nc_curr_file_pos = ftell(yyin);
-
- if ((bufstart = fgets(line, LEXBUFSIZ, yyin)) != NULL) {
- _nc_curr_line++;
- _nc_curr_col = 0;
- }
- bufptr = bufstart;
- } while
- (bufstart != NULL && line[0] == '#');
-
- if (bufstart == NULL || *bufstart == 0)
- return (EOF);
-
- while (iswhite(*bufptr))
- bufptr++;
-
- /*
- * Treat a trailing <cr><lf> the same as a <newline> so we can read
- * files on OS/2, etc.
- */
- if ((len = strlen(bufptr)) > 1) {
- if (bufptr[len - 1] == '\n'
- && bufptr[len - 2] == '\r') {
- len--;
- bufptr[len - 1] = '\n';
- bufptr[len] = '\0';
- }
- }
+ bufstart = 0;
+ used = 0;
+ do {
+ if (used + (LEXBUFSIZ / 4) >= allocated) {
+ allocated += (allocated + LEXBUFSIZ);
+ result = _nc_doalloc(result, allocated);
+ if (result == 0)
+ return (EOF);
+ }
+ if (used == 0)
+ _nc_curr_file_pos = ftell(yyin);
+
+ if (fgets(result + used, allocated - used, yyin) != NULL) {
+ bufstart = result;
+ if (used == 0) {
+ _nc_curr_line++;
+ _nc_curr_col = 0;
+ }
+ } else {
+ if (used != 0)
+ strcat(result, "\n");
+ }
+ if ((bufptr = bufstart) != 0) {
+ used = strlen(bufptr);
+ while (iswhite(*bufptr))
+ bufptr++;
- /*
- * If we don't have a trailing newline, it's because the line is simply
- * too long. Give up. (FIXME: We could instead reallocate the line
- * buffer and allow arbitrary-length lines).
- */
- if (len == 0 || (bufptr[len - 1] != '\n'))
- return (EOF);
+ /*
+ * Treat a trailing <cr><lf> the same as a <newline> so we
+ * can read files on OS/2, etc.
+ */
+ if ((len = strlen(bufptr)) > 1) {
+ if (bufptr[len - 1] == '\n'
+ && bufptr[len - 2] == '\r') {
+ len--;
+ bufptr[len - 1] = '\n';
+ bufptr[len] = '\0';
+ }
+ }
+ } else {
+ return (EOF);
+ }
+ } while (bufptr[len - 1] != '\n'); /* complete a line */
+ } while (result[0] == '#'); /* ignore comments */
}
first_column = (bufptr == bufstart);
@@ -793,5 +821,3 @@ end_of_stream(void)
return ((yyin ? feof(yyin) : (bufptr && *bufptr == '\0'))
? TRUE : FALSE);
}
-
-/* comp_scan.c ends here */
diff --git a/contrib/ncurses/ncurses/tinfo/doalloc.c b/contrib/ncurses/ncurses/tinfo/doalloc.c
index 84471fb6b20c..634469cdf4ac 100644
--- a/contrib/ncurses/ncurses/tinfo/doalloc.c
+++ b/contrib/ncurses/ncurses/tinfo/doalloc.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -30,7 +30,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).
@@ -40,31 +39,33 @@
#include <curses.priv.h>
-MODULE_ID("$Id: doalloc.c,v 1.5 1999/03/14 12:25:27 tom Exp $")
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/free_ttype.c b/contrib/ncurses/ncurses/tinfo/free_ttype.c
index aba1aeb9d82f..df604e41a681 100644
--- a/contrib/ncurses/ncurses/tinfo/free_ttype.c
+++ b/contrib/ncurses/ncurses/tinfo/free_ttype.c
@@ -30,7 +30,6 @@
* Author: Thomas E. Dickey <dickey@clark.net> 1999 *
****************************************************************************/
-
/*
* free_ttype.c -- allocation functions for TERMTYPE
*
@@ -44,9 +43,10 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: free_ttype.c,v 1.5 2000/07/08 00:43:58 tom Exp $")
+MODULE_ID("$Id: 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);
@@ -61,9 +61,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/contrib/ncurses/ncurses/tinfo/getenv_num.c b/contrib/ncurses/ncurses/tinfo/getenv_num.c
index 62944048175a..a90cc08d297c 100644
--- a/contrib/ncurses/ncurses/tinfo/getenv_num.c
+++ b/contrib/ncurses/ncurses/tinfo/getenv_num.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -36,21 +36,21 @@
#include <curses.priv.h>
-MODULE_ID("$Id: getenv_num.c,v 1.1 1998/09/19 21:30:23 tom Exp $")
+MODULE_ID("$Id: 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;
+ 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;
+ if ((src == 0)
+ || (value = strtol(src, &dst, 0)) < 0
+ || (dst == src)
+ || (*dst != '\0')
+ || (int) value < value)
+ value = -1;
- return (int) value;
+ return (int) value;
}
diff --git a/contrib/ncurses/ncurses/tinfo/home_terminfo.c b/contrib/ncurses/ncurses/tinfo/home_terminfo.c
index 69b8a96ffcff..47b3e382ef7e 100644
--- a/contrib/ncurses/ncurses/tinfo/home_terminfo.c
+++ b/contrib/ncurses/ncurses/tinfo/home_terminfo.c
@@ -37,13 +37,13 @@
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$Id: home_terminfo.c,v 1.3 2000/10/04 02:31:53 tom Exp $");
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/init_keytry.c b/contrib/ncurses/ncurses/tinfo/init_keytry.c
index 1134480f8def..cf840e8e93b3 100644
--- a/contrib/ncurses/ncurses/tinfo/init_keytry.c
+++ b/contrib/ncurses/ncurses/tinfo/init_keytry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -28,11 +28,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("$Id: init_keytry.c,v 1.3 2000/03/12 02:55:50 Todd.C.Miller Exp $")
+MODULE_ID("$Id: init_keytry.c,v 1.5 2000/12/10 02:55:07 tom Exp $")
/*
** _nc_init_keytry()
@@ -52,27 +52,29 @@ MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/lib_acs.c b/contrib/ncurses/ncurses/tinfo/lib_acs.c
index 6f0779157413..54554a8edd7c 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_acs.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_acs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,109 +31,133 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
-
#include <curses.priv.h>
-#include <term.h> /* ena_acs, acs_chars */
-
-MODULE_ID("$Id: 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("$Id: 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/contrib/ncurses/ncurses/tinfo/lib_baudrate.c b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
index 0d7fa27bcc3d..ff3455a7ec31 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_baudrate.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -40,7 +40,7 @@
#include <term.h> /* cur_term, pad_char */
#include <termcap.h> /* ospeed */
-MODULE_ID("$Id: lib_baudrate.c,v 1.17 2000/10/08 00:59:08 tom Exp $")
+MODULE_ID("$Id: lib_baudrate.c,v 1.19 2000/12/10 02:55:07 tom Exp $")
/*
* int
@@ -51,8 +51,8 @@ MODULE_ID("$Id: 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[] =
@@ -99,7 +99,7 @@ static struct speed const speeds[] =
#endif
};
-int
+NCURSES_EXPORT(int)
_nc_baudrate(int OSpeed)
{
static int last_OSpeed;
@@ -125,7 +125,7 @@ _nc_baudrate(int OSpeed)
return (result);
}
-int
+NCURSES_EXPORT(int)
_nc_ospeed(int BaudRate)
{
int result = 1;
@@ -142,7 +142,7 @@ _nc_ospeed(int BaudRate)
return (result);
}
-int
+NCURSES_EXPORT(int)
baudrate(void)
{
int result;
diff --git a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c
index 7d0aa127d9db..8f269e591d0c 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_cur_term.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_cur_term.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -37,34 +37,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("$Id: lib_cur_term.c,v 1.9 1999/10/30 23:00:16 tom Exp $")
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/lib_data.c b/contrib/ncurses/ncurses/tinfo/lib_data.c
index d2d0d3ff6d8e..87d60edf6ed9 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_data.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_data.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -40,17 +40,20 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_data.c,v 1.14 1999/01/31 01:34:33 Ilya.Zakharevich Exp $")
+MODULE_ID("$Id: 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
@@ -63,22 +66,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/contrib/ncurses/ncurses/tinfo/lib_has_cap.c b/contrib/ncurses/ncurses/tinfo/lib_has_cap.c
index 7121fc758f4f..6fb7b3a9c8c0 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_has_cap.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_has_cap.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,7 +31,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
** lib_has_cap.c
**
@@ -43,21 +42,23 @@
#include <term.h>
-MODULE_ID("$Id: lib_has_cap.c,v 1.1 1998/10/23 15:32:21 tom Exp $")
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/lib_kernel.c b/contrib/ncurses/ncurses/tinfo/lib_kernel.c
index 3c8c88ee2aab..ab8e4db7d283 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_kernel.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_kernel.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,7 +31,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
* lib_kernel.c
*
@@ -46,9 +45,9 @@
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
+#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_kernel.c,v 1.19 1998/12/20 00:18:45 tom Exp $")
+MODULE_ID("$Id: lib_kernel.c,v 1.21 2000/12/10 02:55:07 tom Exp $")
/*
* erasechar()
@@ -57,23 +56,21 @@ MODULE_ID("$Id: 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()
*
@@ -81,23 +78,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()
*
@@ -105,26 +100,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/contrib/ncurses/ncurses/tinfo/lib_longname.c b/contrib/ncurses/ncurses/tinfo/lib_longname.c
index 766e56c091e6..1301ee516944 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_longname.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_longname.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,7 +31,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
/*
** lib_longname.c
**
@@ -41,18 +40,18 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_longname.c,v 1.7 1999/01/03 01:47:45 tom Exp $")
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/lib_napms.c b/contrib/ncurses/ncurses/tinfo/lib_napms.c
index 1bd5c647f029..df1c2e459c41 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_napms.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_napms.c
@@ -58,9 +58,9 @@
#endif
#endif
-MODULE_ID("$Id: lib_napms.c,v 1.9 2000/04/29 23:42:56 tom Exp $")
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c
index fc3dc42bca41..581357df9944 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_options.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_options.c
@@ -42,9 +42,9 @@
#include <term.h>
-MODULE_ID("$Id: lib_options.c,v 1.40 2000/09/02 18:02:05 tom Exp $")
+MODULE_ID("$Id: 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));
@@ -56,7 +56,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));
@@ -67,7 +67,7 @@ idcok(WINDOW *win, bool flag)
returnVoid;
}
-int
+NCURSES_EXPORT(int)
halfdelay(int t)
{
T((T_CALLED("halfdelay(%d)"), t));
@@ -80,7 +80,7 @@ halfdelay(int t)
returnCode(OK);
}
-int
+NCURSES_EXPORT(int)
nodelay(WINDOW *win, bool flag)
{
T((T_CALLED("nodelay(%p,%d)"), win, flag));
@@ -95,7 +95,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));
@@ -107,7 +107,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));
@@ -117,7 +117,7 @@ wtimeout(WINDOW *win, int delay)
}
}
-int
+NCURSES_EXPORT(int)
keypad(WINDOW *win, bool flag)
{
T((T_CALLED("keypad(%p,%d)"), win, flag));
@@ -129,7 +129,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 */
@@ -149,7 +149,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;
@@ -191,7 +191,7 @@ curs_set(int vis)
returnCode(cursor == -1 ? 1 : cursor);
}
-int
+NCURSES_EXPORT(int)
typeahead(int fd)
{
T((T_CALLED("typeahead(%d)"), fd));
@@ -216,10 +216,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));
@@ -234,7 +234,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/contrib/ncurses/ncurses/tinfo/lib_print.c b/contrib/ncurses/ncurses/tinfo/lib_print.c
index 63ac648b5439..291e84cf34b0 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_print.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_print.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,49 +31,44 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: lib_print.c,v 1.11 1999/02/27 19:59:05 tom Exp $")
+MODULE_ID("$Id: 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
@@ -92,5 +87,5 @@ int mcprint(char *data, int len)
(void) sleep(0);
free(mybuf);
- return(res);
+ return (res);
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_raw.c b/contrib/ncurses/ncurses/tinfo/lib_raw.c
index 6df95714a9b1..0a65b8f46464 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_raw.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_raw.c
@@ -48,7 +48,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_raw.c,v 1.8 2000/09/02 18:08:48 tom Exp $")
+MODULE_ID("$Id: lib_raw.c,v 1.10 2000/12/10 02:55:07 tom Exp $")
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -72,7 +72,7 @@ MODULE_ID("$Id: 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()")));
@@ -100,7 +100,7 @@ raw(void)
returnCode(ERR);
}
-int
+NCURSES_EXPORT(int)
cbreak(void)
{
T((T_CALLED("cbreak()")));
@@ -125,7 +125,7 @@ cbreak(void)
returnCode(_nc_set_tty_mode(&cur_term->Nttyb));
}
-void
+NCURSES_EXPORT(void)
qiflush(void)
{
T((T_CALLED("qiflush()")));
@@ -144,7 +144,7 @@ qiflush(void)
#endif
}
-int
+NCURSES_EXPORT(int)
noraw(void)
{
T((T_CALLED("noraw()")));
@@ -168,7 +168,7 @@ noraw(void)
returnCode(_nc_set_tty_mode(&cur_term->Nttyb));
}
-int
+NCURSES_EXPORT(int)
nocbreak(void)
{
T((T_CALLED("nocbreak()")));
@@ -190,7 +190,7 @@ nocbreak(void)
returnCode(_nc_set_tty_mode(&cur_term->Nttyb));
}
-void
+NCURSES_EXPORT(void)
noqiflush(void)
{
T((T_CALLED("noqiflush()")));
@@ -209,7 +209,7 @@ noqiflush(void)
#endif
}
-int
+NCURSES_EXPORT(int)
intrflush(WINDOW *win GCC_UNUSED, bool flag)
{
T((T_CALLED("intrflush(%d)"), flag));
diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c
index 1fd0d48f3cc8..e73e7e0300aa 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_setup.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c
@@ -48,7 +48,7 @@
#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_setup.c,v 1.60 2000/09/02 18:13:12 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.64 2000/12/10 02:55:07 tom Exp $")
/****************************************************************************
*
@@ -94,16 +94,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 */
@@ -133,7 +138,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
@@ -165,11 +170,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) {
@@ -196,7 +202,7 @@ _nc_get_screensize(int *linep, int *colp)
}
#if USE_SIZECHANGE
-void
+NCURSES_EXPORT(void)
_nc_update_screensize(void)
{
int my_lines, my_cols;
@@ -265,18 +271,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)
@@ -286,8 +294,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;
@@ -302,7 +311,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/contrib/ncurses/ncurses/tinfo/lib_termcap.c b/contrib/ncurses/ncurses/tinfo/lib_termcap.c
index ecec2865fbae..c88887b45426 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_termcap.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_termcap.c
@@ -39,15 +39,17 @@
#define __INTERNAL_CAPS_VISIBLE
#include <term_entry.h>
-MODULE_ID("$Id: lib_termcap.c,v 1.37 2000/09/16 20:30:16 tom Exp $")
+MODULE_ID("$Id: 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;
/***************************************************************************
*
@@ -64,8 +66,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;
@@ -108,7 +111,7 @@ tgetent(char *bufp GCC_UNUSED, const char *name)
*
***************************************************************************/
-int
+NCURSES_EXPORT(int)
tgetflag(NCURSES_CONST char *id)
{
int i;
@@ -136,7 +139,7 @@ tgetflag(NCURSES_CONST char *id)
*
***************************************************************************/
-int
+NCURSES_EXPORT(int)
tgetnum(NCURSES_CONST char *id)
{
int i;
@@ -165,8 +168,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;
@@ -176,7 +180,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/contrib/ncurses/ncurses/tinfo/lib_termname.c b/contrib/ncurses/ncurses/tinfo/lib_termname.c
index e7057383c565..6b287e06c890 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_termname.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_termname.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -27,20 +27,22 @@
****************************************************************************/
#include <curses.priv.h>
-#include <tic.h> /* for MAX_ALIAS */
+#include <tic.h> /* for MAX_ALIAS */
-MODULE_ID("$Id: lib_termname.c,v 1.2 1999/07/24 21:02:40 tom Exp $")
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/lib_tgoto.c b/contrib/ncurses/ncurses/tinfo/lib_tgoto.c
index 73557eb7cc25..19edb4f31a11 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_tgoto.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_tgoto.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2000 Free Software Foundation, Inc. *
+ * Copyright (c) 2000,2001 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 *
@@ -35,7 +35,7 @@
#include <ctype.h>
#include <termcap.h>
-MODULE_ID("$Id: lib_tgoto.c,v 1.2 2000/09/24 00:19:14 tom Exp $")
+MODULE_ID("$Id: lib_tgoto.c,v 1.7 2001/03/24 22:25:55 tom Exp $")
#if !PURE_TERMINFO
static bool
@@ -43,20 +43,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;
}
@@ -90,7 +94,7 @@ tgoto_internal(const char *string, int x, int y)
}
}
if (*string == '%') {
- char *fmt = 0;
+ const char *fmt = 0;
switch (*++string) {
case '\0':
@@ -108,7 +112,7 @@ tgoto_internal(const char *string, int x, int y)
*value %= 1000;
break;
case '+':
- *value += (*++string & 0xff);
+ *value += CharOf(*++string);
/* FALLTHRU */
case '.':
/*
@@ -181,8 +185,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/contrib/ncurses/ncurses/tinfo/lib_ti.c b/contrib/ncurses/ncurses/tinfo/lib_ti.c
index def5ba6d5ea3..8ef866588197 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_ti.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_ti.c
@@ -36,9 +36,9 @@
#include <term_entry.h>
#include <tic.h>
-MODULE_ID("$Id: lib_ti.c,v 1.20 2000/02/13 01:01:26 tom Exp $")
+MODULE_ID("$Id: 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;
@@ -59,7 +59,7 @@ tigetflag(NCURSES_CONST char *str)
returnCode(ABSENT_BOOLEAN);
}
-int
+NCURSES_EXPORT(int)
tigetnum(NCURSES_CONST char *str)
{
int i;
@@ -81,7 +81,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/contrib/ncurses/ncurses/tinfo/lib_tparm.c b/contrib/ncurses/ncurses/tinfo/lib_tparm.c
index 6a8ca1f0419a..e62b824e5bc6 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_tparm.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_tparm.c
@@ -42,7 +42,7 @@
#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: lib_tparm.c,v 1.47 2000/10/04 00:57:13 tom Exp $")
+MODULE_ID("$Id: lib_tparm.c,v 1.52 2001/03/11 15:12:48 tom Exp $")
/*
* char *
@@ -114,8 +114,11 @@ typedef struct {
bool num_type;
} stack_frame;
+NCURSES_EXPORT_VAR(int) _nc_tparm_err = 0;
+
static stack_frame stack[STACKSIZE];
static int stack_ptr;
+static const char *tparam_base = "";
#ifdef TRACE
static const char *tname;
@@ -126,7 +129,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) {
@@ -195,6 +198,9 @@ npush(int x)
stack[stack_ptr].num_type = TRUE;
stack[stack_ptr].data.num = x;
stack_ptr++;
+ } else {
+ DEBUG(2, ("npush: stack overflow: %s", _nc_visbuf(tparam_base)));
+ _nc_tparm_err++;
}
}
@@ -206,6 +212,9 @@ npop(void)
stack_ptr--;
if (stack[stack_ptr].num_type)
result = stack[stack_ptr].data.num;
+ } else {
+ DEBUG(2, ("npop: stack underflow: %s", _nc_visbuf(tparam_base)));
+ _nc_tparm_err++;
}
return result;
}
@@ -217,6 +226,9 @@ spush(char *x)
stack[stack_ptr].num_type = FALSE;
stack[stack_ptr].data.str = x;
stack_ptr++;
+ } else {
+ DEBUG(2, ("spush: stack overflow: %s", _nc_visbuf(tparam_base)));
+ _nc_tparm_err++;
}
}
@@ -229,6 +241,9 @@ spop(void)
stack_ptr--;
if (!stack[stack_ptr].num_type && stack[stack_ptr].data.str != 0)
result = stack[stack_ptr].data.str;
+ } else {
+ DEBUG(2, ("spop: stack underflow: %s", _nc_visbuf(tparam_base)));
+ _nc_tparm_err++;
}
return result;
}
@@ -286,7 +301,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;
@@ -501,7 +516,7 @@ tparam_internal(const char *string, va_list ap)
if (*string != '%') {
save_char(*string);
} else {
- string++;
+ tparam_base = string++;
string = parse_format(string, format, &len);
switch (*string) {
default:
@@ -717,20 +732,21 @@ tparam_internal(const char *string, va_list ap)
string++;
} /* endwhile (*string) */
- if (out_buff == 0 && (out_buff = typeCalloc(char, 1)) == NULL)
- return (NULL);
+ get_space(1);
out_buff[out_used] = '\0';
T((T_RETURN("%s"), _nc_visbuf(out_buff)));
return (out_buff);
}
-char *
-tparm(NCURSES_CONST char *string,...)
+NCURSES_EXPORT(char *)
+tparm
+(NCURSES_CONST char *string,...)
{
va_list ap;
char *result;
+ _nc_tparm_err = 0;
va_start(ap, string);
#ifdef TRACE
tname = "tparm";
diff --git a/contrib/ncurses/ncurses/tinfo/lib_tputs.c b/contrib/ncurses/ncurses/tinfo/lib_tputs.c
index 93eebf88691f..63dbbd9a736b 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_tputs.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_tputs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,1999,2000,2001 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 *
@@ -45,16 +45,18 @@
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$Id: lib_tputs.c,v 1.51 2000/10/08 00:22:24 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.56 2001/04/21 18:53:53 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));
@@ -75,13 +77,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
@@ -109,7 +111,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;
@@ -168,14 +170,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;
@@ -262,25 +265,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/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
index 0e57c512b20f..d72df2d4dff3 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -36,9 +36,9 @@
*/
#include <curses.priv.h>
-#include <term.h> /* cur_term */
+#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_ttyflags.c,v 1.3 1999/10/22 21:38:55 tom Exp $")
+MODULE_ID("$Id: lib_ttyflags.c,v 1.5 2000/12/10 02:55:08 tom Exp $")
#undef tabs
@@ -56,89 +56,94 @@ MODULE_ID("$Id: 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);
}
/*
@@ -146,18 +151,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/contrib/ncurses/ncurses/tinfo/make_keys.c b/contrib/ncurses/ncurses/tinfo/make_keys.c
index 703ca5de0fea..3c98da23e019 100644
--- a/contrib/ncurses/ncurses/tinfo/make_keys.c
+++ b/contrib/ncurses/ncurses/tinfo/make_keys.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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,98 +37,104 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: make_keys.c,v 1.8 2000/03/12 02:55:50 Todd.C.Miller Exp $")
+MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/name_match.c b/contrib/ncurses/ncurses/tinfo/name_match.c
index a9e8396959d1..934b24a29dde 100644
--- a/contrib/ncurses/ncurses/tinfo/name_match.c
+++ b/contrib/ncurses/ncurses/tinfo/name_match.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -34,7 +34,7 @@
#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: name_match.c,v 1.8 1999/03/07 01:58:36 tom Exp $")
+MODULE_ID("$Id: name_match.c,v 1.10 2000/12/10 02:55:08 tom Exp $")
/*
* _nc_first_name(char *names)
@@ -42,19 +42,20 @@ MODULE_ID("$Id: 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);
}
/*
@@ -63,34 +64,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/contrib/ncurses/ncurses/tinfo/parse_entry.c b/contrib/ncurses/ncurses/tinfo/parse_entry.c
index 24bf3c37f584..ef66b30ecb4e 100644
--- a/contrib/ncurses/ncurses/tinfo/parse_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/parse_entry.c
@@ -47,7 +47,7 @@
#define __INTERNAL_CAPS_VISIBLE
#include <term_entry.h>
-MODULE_ID("$Id: parse_entry.c,v 1.48 2000/10/03 09:38:48 tom Exp $")
+MODULE_ID("$Id: parse_entry.c,v 1.53 2001/03/03 21:13:09 Todd.C.Miller Exp $")
#ifdef LINT
static short const parametrized[] =
@@ -195,14 +195,15 @@ _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;
char *ptr, *base;
- token_type = _nc_get_token();
+ token_type = _nc_get_token(silent);
if (token_type == EOF)
return (EOF);
@@ -248,9 +249,9 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent)
entryp->nuses = 0;
- for (token_type = _nc_get_token();
+ for (token_type = _nc_get_token(silent);
token_type != EOF && token_type != NAMES;
- token_type = _nc_get_token()) {
+ token_type = _nc_get_token(silent)) {
if (strcmp(_nc_curr_token.tk_name, "use") == 0
|| strcmp(_nc_curr_token.tk_name, "tc") == 0) {
entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring);
@@ -464,12 +465,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 */
{
@@ -481,15 +482,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;
}
@@ -507,7 +514,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];
@@ -519,7 +526,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);
@@ -657,12 +664,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);
}
}
@@ -813,13 +820,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);
+ }
}
/*
@@ -841,17 +850,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);
@@ -883,17 +892,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/contrib/ncurses/ncurses/tinfo/read_entry.c b/contrib/ncurses/ncurses/tinfo/read_entry.c
index deef49859a3e..006e56c3ddb1 100644
--- a/contrib/ncurses/ncurses/tinfo/read_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/read_entry.c
@@ -41,7 +41,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: read_entry.c,v 1.69 2000/10/10 00:57:40 Todd.Miller Exp $")
+MODULE_ID("$Id: 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... */
@@ -70,7 +70,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;
@@ -93,7 +93,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);
@@ -373,8 +373,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;
@@ -428,7 +429,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;
@@ -456,8 +457,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/contrib/ncurses/ncurses/tinfo/read_termcap.c b/contrib/ncurses/ncurses/tinfo/read_termcap.c
index f74c5a1eb760..da88f0b149ab 100644
--- a/contrib/ncurses/ncurses/tinfo/read_termcap.c
+++ b/contrib/ncurses/ncurses/tinfo/read_termcap.c
@@ -55,7 +55,7 @@
#include <tic.h>
#include <term_entry.h>
-MODULE_ID("$Id: read_termcap.c,v 1.50 2000/10/10 00:56:46 Todd.Miller Exp $")
+MODULE_ID("$Id: read_termcap.c,v 1.55 2000/12/10 02:55:08 tom Exp $")
#if !PURE_TERMINFO
@@ -770,7 +770,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
register char *p;
register char *cp;
- char *dummy;
+ char *dummy = NULL;
char **fname;
char *home;
int i;
@@ -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;
@@ -990,7 +991,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);
@@ -1013,7 +1014,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp)
#define PRIVATE_CAP "%s/.termcap"
- if ((h = getenv("HOME")) != NULL && *h != '\0'
+ if (use_terminfo_vars() && (h = getenv("HOME")) != NULL && *h != '\0'
&& (strlen(h) + sizeof(PRIVATE_CAP)) < PATH_MAX) {
/* user's .termcap, if any, should override it */
(void) strcpy(envhome, h);
@@ -1103,8 +1104,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/contrib/ncurses/ncurses/tinfo/setbuf.c b/contrib/ncurses/ncurses/tinfo/setbuf.c
index c0e735656907..6d0201bfb2aa 100644
--- a/contrib/ncurses/ncurses/tinfo/setbuf.c
+++ b/contrib/ncurses/ncurses/tinfo/setbuf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * 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 *
@@ -31,8 +31,6 @@
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
-
-
/*
** setbuf.c
**
@@ -42,7 +40,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: setbuf.c,v 1.5 1999/02/27 20:00:15 tom Exp $")
+MODULE_ID("$Id: 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
@@ -99,45 +97,47 @@ MODULE_ID("$Id: 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/contrib/ncurses/ncurses/tinfo/strings.c b/contrib/ncurses/ncurses/tinfo/strings.c
index 8198ec4050ad..5fa68caf7534 100644
--- a/contrib/ncurses/ncurses/tinfo/strings.c
+++ b/contrib/ncurses/ncurses/tinfo/strings.c
@@ -36,15 +36,16 @@
#include <curses.priv.h>
-MODULE_ID("$Id")
+MODULE_ID("$Id: 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);
@@ -64,8 +65,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;
@@ -80,8 +82,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);
}
@@ -89,8 +92,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;
@@ -99,7 +103,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) {
@@ -120,7 +124,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/contrib/ncurses/ncurses/tinfo/write_entry.c b/contrib/ncurses/ncurses/tinfo/write_entry.c
index af4b4fda2a3a..ffcf4027f055 100644
--- a/contrib/ncurses/ncurses/tinfo/write_entry.c
+++ b/contrib/ncurses/ncurses/tinfo/write_entry.c
@@ -52,7 +52,7 @@
#define TRACE_OUT(p) /*nothing */
#endif
-MODULE_ID("$Id: write_entry.c,v 1.53 2000/10/04 02:32:14 tom Exp $")
+MODULE_ID("$Id: write_entry.c,v 1.56 2000/12/10 02:55:08 tom Exp $")
static int total_written;
@@ -109,7 +109,7 @@ make_directory(const char *path)
return rc;
}
-void
+NCURSES_EXPORT(void)
_nc_set_writedir(char *dir)
/* set the write directory for compiled entries */
{
@@ -117,7 +117,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)
@@ -131,7 +131,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);
}
}
@@ -164,7 +164,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);
@@ -275,7 +275,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') {
@@ -301,7 +301,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
@@ -333,10 +333,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));
}
@@ -520,7 +526,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))
@@ -549,7 +555,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);
}
@@ -574,7 +580,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;