summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1999-12-06 02:12:46 +0000
committermillert <millert@openbsd.org>1999-12-06 02:12:46 +0000
commit68631a7c13c390cb2350e2167c9aa05b71e30845 (patch)
treea6b98f59e81913727e5686ae4b992916ec429c89
parentoflow fixes; provos (diff)
downloadwireguard-openbsd-68631a7c13c390cb2350e2167c9aa05b71e30845.tar.xz
wireguard-openbsd-68631a7c13c390cb2350e2167c9aa05b71e30845.zip
update to ncurses-5.0-19991204
-rw-r--r--lib/libcurses/base/version.c5
-rw-r--r--lib/libcurses/curses.h4
-rw-r--r--lib/libcurses/curses.priv.h14
-rw-r--r--lib/libcurses/tinfo/captoinfo.c8
-rw-r--r--lib/libcurses/tinfo/write_entry.c31
-rw-r--r--usr.bin/infocmp/infocmp.c6
-rw-r--r--usr.bin/tic/MKtermsort.sh24
-rw-r--r--usr.bin/tic/dump_entry.c41
-rw-r--r--usr.bin/tic/tic.c14
9 files changed, 93 insertions, 54 deletions
diff --git a/lib/libcurses/base/version.c b/lib/libcurses/base/version.c
index a8f78015cec..df07a6f9dc0 100644
--- a/lib/libcurses/base/version.c
+++ b/lib/libcurses/base/version.c
@@ -40,9 +40,8 @@ curses_version(void)
static char my_version[80];
T((T_CALLED("curses_version()")));
- sprintf(my_version, "ncurses %d.%d.%d",
- NCURSES_VERSION_MAJOR,
- NCURSES_VERSION_MINOR,
+ sprintf(my_version, "ncurses %s.%d",
+ NCURSES_VERSION,
NCURSES_VERSION_PATCH);
returnPtr(my_version);
}
diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h
index 44844941c19..d524c426cb8 100644
--- a/lib/libcurses/curses.h
+++ b/lib/libcurses/curses.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: curses.h,v 1.38 1999/11/28 17:53:40 millert Exp $ */
+/* $OpenBSD: curses.h,v 1.39 1999/12/06 02:13:31 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -50,7 +50,7 @@
/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 5
#define NCURSES_VERSION_MINOR 0
-#define NCURSES_VERSION_PATCH 19991127
+#define NCURSES_VERSION_PATCH 19991204
/* This is defined in more than one ncurses header, for identification */
#undef NCURSES_VERSION
diff --git a/lib/libcurses/curses.priv.h b/lib/libcurses/curses.priv.h
index a4394c11b3f..02925ff0114 100644
--- a/lib/libcurses/curses.priv.h
+++ b/lib/libcurses/curses.priv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: curses.priv.h,v 1.21 1999/11/28 17:53:40 millert Exp $ */
+/* $OpenBSD: curses.priv.h,v 1.22 1999/12/06 02:13:31 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -35,7 +35,7 @@
/*
- * $From: curses.priv.h,v 1.147 1999/11/28 00:10:37 tom Exp $
+ * $From: curses.priv.h,v 1.148 1999/12/04 18:09:40 tom Exp $
*
* curses.priv.h
*
@@ -490,11 +490,17 @@ typedef struct {
line->lastchar = end
#define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
+
#define typeMalloc(type,elts) (type *)malloc((elts)*sizeof(type))
#define typeCalloc(type,elts) (type *)calloc((elts),sizeof(type))
#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (elts)*sizeof(type))
-#define FreeIfNeeded(p) if(p != 0) free(p)
-#define FreeAndNull(p) free(p); p = 0;
+
+#define FreeIfNeeded(p) if ((p) != 0) free(p)
+
+/* FreeAndNull() is not a comma-separated expression because some compilers
+ * do not accept a mixture of void with values.
+ */
+#define FreeAndNull(p) free(p); p = 0
#include <nc_alloc.h>
diff --git a/lib/libcurses/tinfo/captoinfo.c b/lib/libcurses/tinfo/captoinfo.c
index 74185ae0ccf..93035421b4c 100644
--- a/lib/libcurses/tinfo/captoinfo.c
+++ b/lib/libcurses/tinfo/captoinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: captoinfo.c,v 1.3 1999/08/15 11:40:55 millert Exp $ */
+/* $OpenBSD: captoinfo.c,v 1.4 1999/12/06 02:12:46 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -96,7 +96,7 @@
#include <ctype.h>
#include <tic.h>
-MODULE_ID("$From: captoinfo.c,v 1.24 1999/07/24 20:06:13 tom Exp $")
+MODULE_ID("$From: captoinfo.c,v 1.25 1999/12/05 02:24:05 tom Exp $")
#define MAX_PUSHED 16 /* max # args we can push onto the stack */
#define MAX_ENTRY 2048 /* maximum chars in a translated capability */
@@ -601,6 +601,10 @@ int const parametrized) /* do % translations if 1, pad translations if >=0 */
str++;
--str;
}
+ else if (str[0] == '%' && str[1] == '%') /* escaped '%' */
+ {
+ bufptr = save_string(bufptr, "%%");
+ }
else if (*str != '%' || (parametrized < 1))
bufptr = save_char(bufptr, *str);
else if (sscanf(str, "%%?%%{%d}%%>%%t%%{%d}%%+%%;", &c1,&c2) == 2)
diff --git a/lib/libcurses/tinfo/write_entry.c b/lib/libcurses/tinfo/write_entry.c
index e4dea953ffb..60f95451505 100644
--- a/lib/libcurses/tinfo/write_entry.c
+++ b/lib/libcurses/tinfo/write_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write_entry.c,v 1.4 1999/07/11 14:10:11 millert Exp $ */
+/* $OpenBSD: write_entry.c,v 1.5 1999/12/06 02:12:46 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -56,7 +56,7 @@
#define TRACE_OUT(p) /*nothing*/
#endif
-MODULE_ID("$From: write_entry.c,v 1.47 1999/07/10 20:29:22 tom Exp $")
+MODULE_ID("$From: write_entry.c,v 1.48 1999/12/04 23:02:59 tom Exp $")
static int total_written;
@@ -405,28 +405,41 @@ size_t i;
short nextfree;
short offsets[MAX_ENTRY_SIZE/2];
unsigned char buf[MAX_ENTRY_SIZE];
+unsigned last_bool = BOOLWRITE;
+unsigned last_num = NUMWRITE;
+unsigned last_str = STRWRITE;
+
+#if NCURSES_XNAMES
+ /*
+ * Normally we limit the list of values to exclude the "obsolete"
+ * capabilities. However, if we are accepting extended names, add
+ * these as well, since they are used for supporting translation
+ * to/from termcap.
+ */
+ if (_nc_user_definable) {
+ last_bool = BOOLCOUNT;
+ last_num = NUMCOUNT;
+ last_str = STRCOUNT;
+ }
+#endif
namelist = tp->term_names;
namelen = strlen(namelist) + 1;
- /*
- * BOOLWRITE, etc., are less than BOOLCOUNT because we store some
- * values internally.
- */
boolmax = 0;
- for (i = 0; i < BOOLWRITE; i++) {
+ for (i = 0; i < last_bool; i++) {
if (tp->Booleans[i])
boolmax = i+1;
}
nummax = 0;
- for (i = 0; i < NUMWRITE; i++) {
+ for (i = 0; i < last_num; i++) {
if (tp->Numbers[i] != ABSENT_NUMERIC)
nummax = i+1;
}
strmax = 0;
- for (i = 0; i < STRWRITE; i++) {
+ for (i = 0; i < last_str; i++) {
if (tp->Strings[i] != ABSENT_STRING)
strmax = i+1;
}
diff --git a/usr.bin/infocmp/infocmp.c b/usr.bin/infocmp/infocmp.c
index 403868808b6..da55421aa44 100644
--- a/usr.bin/infocmp/infocmp.c
+++ b/usr.bin/infocmp/infocmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: infocmp.c,v 1.6 1999/11/28 17:51:54 millert Exp $ */
+/* $OpenBSD: infocmp.c,v 1.7 1999/12/06 02:14:34 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <term_entry.h>
#include <dump_entry.h>
-MODULE_ID("$From: infocmp.c,v 1.45 1999/11/27 23:59:57 tom Exp $")
+MODULE_ID("$From: infocmp.c,v 1.47 1999/12/05 01:13:01 tom Exp $")
#define L_CURL "{"
#define R_CURL "}"
@@ -68,7 +68,7 @@ static int termcount; /* count of terminal entries */
static const char *tversion; /* terminfo version selected */
static int numbers = 0; /* format "%'char'" to/from "%{number}" */
-static int outform; /* output format */
+static int outform = F_TERMINFO; /* output format */
static int sortmode; /* sort_mode */
static int itrace; /* trace flag for debugging */
static int mwidth = 60;
diff --git a/usr.bin/tic/MKtermsort.sh b/usr.bin/tic/MKtermsort.sh
index ae02e353747..ae594a09bf0 100644
--- a/usr.bin/tic/MKtermsort.sh
+++ b/usr.bin/tic/MKtermsort.sh
@@ -1,11 +1,12 @@
#!/bin/sh
+# $From: MKtermsort.sh,v 1.5 1999/12/04 21:45:35 tom Exp $
#
# MKtermsort.sh -- generate indirection vectors for the various sort methods
#
# The output of this script is C source for nine arrays that list three sort
# orders for each of the three different classes of terminfo capabilities.
#
-# $OpenBSD: MKtermsort.sh,v 1.2 1999/01/18 18:57:52 millert Exp $
+# $OpenBSD: MKtermsort.sh,v 1.3 1999/12/06 02:14:33 millert Exp $
#
AWK=${1-awk}
DATA=${2-../include/Caps}
@@ -13,7 +14,7 @@ DATA=${2-../include/Caps}
echo "/*";
echo " * termsort.c --- sort order arrays for use by infocmp.";
echo " *";
-echo " * Note: this file is generated using termsort.sh, do not edit by hand.";
+echo " * Note: this file is generated using MKtermsort.sh, do not edit by hand.";
echo " */";
echo "static const int bool_terminfo_sort[] = {";
@@ -97,27 +98,26 @@ $3 == "str" {printf("%s\t%d\n", $4, i++);}
echo "};";
echo "";
-echo "static const int bool_from_termcap[] = {";
+echo "static const bool bool_from_termcap[] = {";
$AWK <$DATA '
-$3 == "bool" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";}
-$3 == "bool" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";}
+$3 == "bool" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
+$3 == "bool" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}
'
echo "};";
echo "";
-echo "static const int num_from_termcap[] = {";
+echo "static const bool num_from_termcap[] = {";
$AWK <$DATA '
-$3 == "num" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";}
-$3 == "num" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";}
+$3 == "num" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
+$3 == "num" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}
'
echo "};";
echo "";
-echo "static const int str_from_termcap[] = {";
+echo "static const bool str_from_termcap[] = {";
$AWK <$DATA '
-$3 == "str" && substr($5, 1, 1) == "-" {print "0,\t/* ", $2, " */";}
-$3 == "str" && substr($5, 1, 1) == "Y" {print "1,\t/* ", $2, " */";}
+$3 == "str" && substr($5, 1, 1) == "-" {print "\tFALSE,\t/* ", $2, " */";}
+$3 == "str" && substr($5, 1, 1) == "Y" {print "\tTRUE,\t/* ", $2, " */";}
'
echo "};";
echo "";
-
diff --git a/usr.bin/tic/dump_entry.c b/usr.bin/tic/dump_entry.c
index d1bc69ada01..1616f99fe18 100644
--- a/usr.bin/tic/dump_entry.c
+++ b/usr.bin/tic/dump_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump_entry.c,v 1.8 1999/11/28 17:58:57 millert Exp $ */
+/* $OpenBSD: dump_entry.c,v 1.9 1999/12/06 02:14:34 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999 Free Software Foundation, Inc. *
@@ -40,7 +40,7 @@
#include <termsort.c> /* this C file is generated */
#include <parametrized.h> /* so is this */
-MODULE_ID("$From: dump_entry.c,v 1.38 1999/11/27 23:00:21 tom Exp $")
+MODULE_ID("$From: dump_entry.c,v 1.41 1999/12/05 02:03:59 tom Exp $")
#define INDENT 8
@@ -74,7 +74,13 @@ static const char *separator, *trailer;
#define V_AIX 3 /* AIX */
#define V_BSD 4 /* BSD */
+#if NCURSES_XNAMES
+#define OBSOLETE(n) (!_nc_user_definable && (n[0] == 'O' && n[1] == 'T'))
+#else
#define OBSOLETE(n) (n[0] == 'O' && n[1] == 'T')
+#endif
+
+#define isObsolete(f,n) ((f == F_TERMINFO || f == F_VARIABLE) && OBSOLETE(n))
#if NCURSES_XNAMES
#define BoolIndirect(j) ((j >= BOOLCOUNT) ? (j) : ((sortmode == S_NOSORT) ? j : bool_indirect[j]))
@@ -406,6 +412,8 @@ static char * fmt_complex(char *dst, char *src, int level)
{
int percent = 0;
int n;
+ bool if_then = strstr(src, "%?") != 0;
+ bool params = !if_then && (strlen(src) > 50) && (strstr(src, "%p") != 0);
dst += strlen(dst);
while (*src != '\0') {
@@ -452,6 +460,15 @@ static char * fmt_complex(char *dst, char *src, int level)
_nc_warning("%%; without %%?");
}
break;
+ case 'p':
+ if (percent && params) {
+ dst[-1] = '\n';
+ for (n = 0; n <= level; n++)
+ *dst++ = '\t';
+ *dst++ = '%';
+ }
+ percent = 0;
+ break;
default:
percent = 0;
break;
@@ -500,8 +517,7 @@ bool outcount = 0;
if (!version_filter(BOOLEAN, i))
continue;
- else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ else if (isObsolete(outform,name))
continue;
predval = pred(BOOLEAN, i);
@@ -524,8 +540,7 @@ bool outcount = 0;
if (!version_filter(NUMBER, i))
continue;
- else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ else if (isObsolete(outform,name))
continue;
predval = pred(NUMBER, i);
@@ -557,8 +572,7 @@ bool outcount = 0;
if (!version_filter(STRING, i))
continue;
- else if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ else if (isObsolete(outform,name))
continue;
/*
@@ -608,7 +622,7 @@ bool outcount = 0;
sprintf(buffer, "%s@", name);
else if (outform == F_TERMCAP || outform == F_TCONVERR)
{
- char *srccap = _nc_tic_expand(tterm->Strings[i], FALSE, numbers);
+ char *srccap = _nc_tic_expand(tterm->Strings[i], TRUE, numbers);
char *cv = _nc_infotocap(name, srccap, parametrized[i]);
if (cv == 0)
@@ -819,8 +833,7 @@ void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GC
i = BoolIndirect(j);
name = ExtBoolname(tp,i,bool_names);
- if ((outform == F_LITERAL || outform == F_TERMINFO || outform == F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ if (isObsolete(outform,name))
continue;
(*hook)(BOOLEAN, i, name);
@@ -832,8 +845,7 @@ void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GC
i = NumIndirect(j);
name = ExtNumname(tp,i,num_names);
- if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ if (isObsolete(outform,name))
continue;
(*hook)(NUMBER, i, name);
@@ -845,8 +857,7 @@ void compare_entry(void (*hook)(int t, int i, const char *name), TERMTYPE *tp GC
i = StrIndirect(j);
name = ExtStrname(tp,i,str_names);
- if ((outform==F_LITERAL || outform==F_TERMINFO || outform==F_VARIABLE)
- && (OBSOLETE(name) && outform != F_LITERAL))
+ if (isObsolete(outform,name))
continue;
(*hook)(STRING, i, name);
diff --git a/usr.bin/tic/tic.c b/usr.bin/tic/tic.c
index 6e31152bf7c..1f29d9770cd 100644
--- a/usr.bin/tic/tic.c
+++ b/usr.bin/tic/tic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tic.c,v 1.12 1999/11/28 17:58:57 millert Exp $ */
+/* $OpenBSD: tic.c,v 1.13 1999/12/06 02:14:34 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999 Free Software Foundation, Inc. *
@@ -44,7 +44,7 @@
#include <dump_entry.h>
#include <term_entry.h>
-MODULE_ID("$From: tic.c,v 1.52 1999/09/25 22:47:54 tom Exp $")
+MODULE_ID("$From: tic.c,v 1.53 1999/12/04 22:45:52 tom Exp $")
const char *_nc_progname = "tic";
@@ -410,8 +410,14 @@ bool check_only = FALSE;
else
_nc_progname++;
- infodump = (strcmp(_nc_progname, "captoinfo") == 0);
- capdump = (strcmp(_nc_progname, "infotocap") == 0);
+ if ((infodump = (strcmp(_nc_progname, "captoinfo") == 0)) != FALSE) {
+ outform = F_TERMINFO;
+ sortmode = S_TERMINFO;
+ }
+ if ((capdump = (strcmp(_nc_progname, "infotocap") == 0)) != FALSE) {
+ outform = F_TERMCAP;
+ sortmode = S_TERMCAP;
+ }
#if NCURSES_XNAMES
use_extended_names(FALSE);
#endif