ncurses 6.2 - patch 20210306

+ improved test/test_parm.c, by limiting the tests to capabilities
  that might have parameters or padding, and combined with tputs test.
+ improve discussion of padding versus tparm and tputs in
  man/curs_terminfo.3x
+ update portability note for FreeBSD in man/tput.1
This commit is contained in:
Thomas E. Dickey 2021-03-07 01:58:37 +00:00
parent 3934889cc6
commit 21b36e89c0
16 changed files with 273 additions and 128 deletions

9
NEWS
View File

@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.3636 2021/02/28 01:10:59 tom Exp $
-- $Id: NEWS,v 1.3638 2021/03/06 22:42:18 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@ -46,6 +46,13 @@ See the AUTHORS file for the corresponding full names.
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
20210306
+ improved test/test_parm.c, by limiting the tests to capabilities
that might have parameters or padding, and combined with tputs test.
+ improve discussion of padding versus tparm and tputs in
man/curs_terminfo.3x
+ update portability note for FreeBSD in man/tput.1
20210227
+ modify tic/infocmp to eliminate unnecessary "\" to escape ":" in
terminfo format.

View File

@ -1 +1 @@
5:0:10 6.2 20210227
5:0:10 6.2 20210306

View File

@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.1402 2021/02/27 11:12:00 tom Exp $
# $Id: dist.mk,v 1.1403 2021/03/06 12:54:29 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
@ -38,7 +38,7 @@ SHELL = /bin/sh
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 6
NCURSES_MINOR = 2
NCURSES_PATCH = 20210227
NCURSES_PATCH = 20210306
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -27,7 +27,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_terminfo.3x,v 1.72 2021/01/02 23:50:04 tom Exp $
.\" $Id: curs_terminfo.3x,v 1.74 2021/03/06 16:05:19 tom Exp $
.TH curs_terminfo 3X ""
.ie \n(.g .ds `` \(lq
.el .ds `` ``
@ -280,6 +280,12 @@ the prototype expects \fBlong\fP (integer) values.
.bP
Aside from the \fBset_attributes\fP (\fBsgr\fP) capability,
most terminal capabilities require no more than one or two parameters.
.bP
Padding information is ignored by \fBtparm\fP;
it is interpreted by \fBtputs\fP.
.bP
The capability string is null-terminated.
Use \*(``\\200\*('' where an ASCII NUL is needed in the output.
.PP
\fBtiparm\fP is a newer form of \fBtparm\fP which uses \fI<stdarg.h>\fP
rather than a fixed-parameter list.
@ -287,7 +293,10 @@ Its numeric parameters are integers (int) rather than longs.
.\" ***************************************************************************
.SS Output Functions
.PP
The \fBtputs\fR routine applies padding information to the string
The \fBtputs\fR routine applies padding information
(i.e., by interpreting marker embedded in the terminfo capability
such as \*(``$<5>\*('' as 5 milliseconds)
to the string
\fIstr\fR and outputs it:
.bP
The \fIstr\fR parameter must be a terminfo string

View File

@ -1,6 +1,6 @@
'\" t
.\"***************************************************************************
.\" Copyright 2018,2020 Thomas E. Dickey *
.\" Copyright 2018-2020,2021 Thomas E. Dickey *
.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@ -28,7 +28,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: tput.1,v 1.65 2020/12/19 22:17:47 tom Exp $
.\" $Id: tput.1,v 1.66 2021/03/06 15:56:23 tom Exp $
.TH @TPUT@ 1 ""
.ds d @TERMINFO@
.ds n 1
@ -547,6 +547,9 @@ A few platforms such as FreeBSD recognize termcap names rather
than terminfo capability names in their respective \fBtput\fP commands.
Since 2010, NetBSD's \fBtput\fP uses terminfo names.
Before that, it (like FreeBSD) recognized termcap names.
.IP
Beginning in 2021, FreeBSD uses the ncurses \fBtput\fP,
configured for both terminfo (tested first) and termcap (as a fallback).
.PP
Because (apparently) \fIall\fP of the certified Unix systems
support the full set of capability names, the reasoning for documenting

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210227) unstable; urgency=low
ncurses6 (6.2+20210306) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 27 Feb 2021 06:12:01 -0500
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 06 Mar 2021 07:54:29 -0500
ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210227) unstable; urgency=low
ncurses6 (6.2+20210306) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 27 Feb 2021 06:12:01 -0500
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 06 Mar 2021 07:54:29 -0500
ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210227) unstable; urgency=low
ncurses6 (6.2+20210306) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 27 Feb 2021 06:12:01 -0500
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 06 Mar 2021 07:54:29 -0500
ncurses6 (5.9-20120608) unstable; urgency=low

View File

@ -1,4 +1,4 @@
; $Id: mingw-ncurses.nsi,v 1.445 2021/02/27 11:12:00 tom Exp $
; $Id: mingw-ncurses.nsi,v 1.446 2021/03/06 12:54:29 tom Exp $
; TODO add examples
; TODO bump ABI to 6
@ -10,7 +10,7 @@
!define VERSION_MAJOR "6"
!define VERSION_MINOR "2"
!define VERSION_YYYY "2021"
!define VERSION_MMDD "0227"
!define VERSION_MMDD "0306"
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
!define MY_ABI "5"

View File

@ -3,7 +3,7 @@
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 6.2
Release: 20210227
Release: 20210306
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz

View File

@ -1,7 +1,7 @@
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 6.2
Release: 20210227
Release: 20210306
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz

View File

@ -1,7 +1,7 @@
Summary: Curses library with POSIX thread support.
Name: ncursest6
Version: 6.2
Release: 20210227
Release: 20210306
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz

View File

@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: README,v 1.72 2021/02/13 22:53:41 tom Exp $
-- $Id: README,v 1.73 2021/03/07 00:08:58 tom Exp $
-------------------------------------------------------------------------------
The programs in this directory are used to test and demonstrate ncurses.
@ -326,8 +326,8 @@ erase test: cardfile demo_menus filter firework firstlast hanoi lrtest ncurse
erasechar test: ncurses
erasechar_sp test: sp_tinfo
erasewchar test: ncurses
exit_curses -
exit_terminfo test: demo_tabs demo_termcap demo_terminfo dots dots_mvcur dots_termcap list_keys railroad sp_tinfo test_arrays test_sgr test_termattrs test_tparm test_vid_puts test_vidputs
exit_curses test: back_ground background blue bs cardfile chgat clip_printw color_content color_set demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_new_pair demo_panels demo_tabs demo_termcap demo_terminfo ditto dots dots_curses dots_mvcur dots_termcap dots_xcurses dup_field echochar extended_color filter firework firstlast foldkeys form_driver_w gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight list_keys lrtest move_field movewindow ncurses newdemo padview pair_content picsmap railroad rain redraw savescreen sp_tinfo tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_arrays test_get_wstr test_getstr test_instr test_inwstr test_opaque test_setupterm test_sgr test_termattrs test_tparm test_vid_puts test_vidputs testaddch testcurs testscanw view worm xmas
exit_terminfo lib: ncurses
extended_color_content test: color_content extended_color
extended_color_content_sp test: extended_color
extended_pair_content test: extended_color pair_content
@ -423,9 +423,9 @@ is_leaveok test: test_opaque
is_linetouched lib: form
is_nodelay test: test_opaque
is_notimeout test: test_opaque
is_pad -
is_pad test: test_opaque
is_scrollok test: ncurses test_opaque
is_subwin -
is_subwin test: test_opaque
is_syncok test: test_opaque
is_term_resized -
is_term_resized_sp -
@ -696,7 +696,7 @@ tiparm -
touchline test: chgat clip_printw insdelln
touchwin test: chgat clip_printw demo_menus filter firstlast inch_wide inchs ins_wide insdelln inserts movewindow ncurses popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_get_wstr test_getstr test_instr test_inwstr test_opaque xmas
tparm test: dots dots_mvcur test_sgr test_tparm progs: tic tput
tputs test: dots dots_mvcur dots_termcap railroad test_vid_puts test_vidputs progs: clear_cmd reset_cmd tabs
tputs test: dots dots_mvcur dots_termcap railroad test_tparm test_vid_puts test_vidputs progs: clear_cmd reset_cmd tabs
tputs_sp test: sp_tinfo
trace -
ttytype test: demo_terminfo test_sgr
@ -775,7 +775,7 @@ wget_wch test: ins_wide ncurses test_add_wchstr test_addwstr
wget_wstr test: test_get_wstr
wgetbkgrnd lib: ncurses
wgetch test: cardfile chgat clip_printw demo_defkey demo_keyok demo_menus demo_panels ditto dump_window dup_field edit_field gdc insdelln inserts knight move_field movewindow ncurses newdemo popup_msg rain redraw test_addchstr test_addstr test_opaque testcurs worm
wgetdelay -
wgetdelay test: test_opaque
wgetn_wstr test: ncurses test_get_wstr
wgetnstr test: ncurses test_getstr
wgetparent test: test_opaque

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2019,2020 Thomas E. Dickey *
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 1998-2017,2018 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -30,7 +30,7 @@
/****************************************************************************
* Author: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: test.priv.h,v 1.191 2020/09/12 23:54:42 tom Exp $ */
/* $Id: test.priv.h,v 1.193 2021/03/07 00:38:34 tom Exp $ */
#ifndef __TEST_PRIV_H
#define __TEST_PRIV_H 1
@ -914,11 +914,14 @@ extern int TABSIZE;
#if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H
#include <nc_alloc.h>
#if HAVE_EXIT_TERMINFO && defined(USE_TINFO)
#if HAVE_EXIT_TERMINFO && (defined(USE_TERMINFO) || defined(USE_TINFO))
#undef ExitProgram
#define ExitProgram(code) exit_terminfo(code)
#elif HAVE_EXIT_CURSES
#undef ExitProgram
#define ExitProgram(code) exit_curses(code)
#endif
#else
#else /* not ncurses-tree */
#define typeMalloc(type,n) (type *) malloc((size_t)(n) * sizeof(type))
#define typeCalloc(type,elts) (type *) calloc((size_t)(elts), sizeof(type))
#define typeRealloc(type,n,p) (type *) realloc(p, (size_t)(n) * sizeof(type))

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2007-2008,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,7 +27,7 @@
* authorization. *
****************************************************************************/
/*
* $Id: test_opaque.c,v 1.10 2020/02/02 23:34:34 tom Exp $
* $Id: test_opaque.c,v 1.12 2021/03/06 23:53:34 tom Exp $
*
* Author: Thomas E Dickey
*
@ -45,6 +45,9 @@
bool is_scrollok(const WINDOW *win);
bool is_syncok(const WINDOW *win);
int wgetscrreg (const WINDOW *, int *, int *);
bool is_pad(const WINDOW *win);
bool is_subwin(const WINDOW *win);
int wgetdelay(const WINDOW *win);
*/
#include <test.priv.h>
@ -209,6 +212,8 @@ static struct {
};
/* *INDENT-ON* */
#define bool2c(c) ((c) ? 'T' : 'F')
/*
* Display and/or allow update for the properties accessed in the opaque
* window. Some may change state after refreshing the window, so we
@ -227,18 +232,35 @@ show_opaque(WINDOW *stswin, WINDOW *txtwin, bool before, int active)
show_keyword(stswin, n, active, bool_funcs[n].name);
to_result(stswin, n, before);
wprintw(stswin, "%c", bool_funcs[n].func(txtwin, -1) ? 'T' : 'F');
wprintw(stswin, "%c", bool2c(bool_funcs[n].func(txtwin, -1)));
}
show_keyword(stswin, n, active, "is_pad");
to_result(stswin, n, TRUE);
wprintw(stswin, "%c", bool2c(is_pad(txtwin)));
++n;
show_keyword(stswin, n, active, "is_subwin");
to_result(stswin, n, TRUE);
wprintw(stswin, "%c", bool2c(is_subwin(txtwin)));
++n;
show_keyword(stswin, n, active, "wgetparent");
to_result(stswin, n, TRUE);
wprintw(stswin, "%p", (void *) wgetparent(txtwin));
++n;
show_keyword(stswin, n, active, "wgetdelay");
to_result(stswin, n, TRUE);
wprintw(stswin, "%d", wgetdelay(txtwin));
++n;
show_keyword(stswin, n, active, "wgetscrreg");
to_result(stswin, n, TRUE);
if (wgetscrreg(txtwin, &top, &bottom) == OK)
wprintw(stswin, "%d,%d", top, bottom);
else
wprintw(stswin, "none");
wnoutrefresh(stswin);
return active;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2021 Thomas E. Dickey *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -29,7 +29,7 @@
/*
* Author: Thomas E. Dickey
*
* $Id: test_tparm.c,v 1.4 2020/05/31 00:51:32 tom Exp $
* $Id: test_tparm.c,v 1.17 2021/03/06 23:39:14 tom Exp $
*
* Exercise tparm, either for all possible capabilities with fixed parameters,
* or one capability with all possible parameters.
@ -53,8 +53,35 @@ failed(const char *msg)
#if HAVE_TIGETSTR
static int a_opt;
static int p_opt;
static int v_opt;
/*
* Total tests (and failures):
*/
static long total_tests;
static long total_fails;
/*
* Total characters formatted for tputs:
*/
static long total_nulls;
static long total_ctrls;
static long total_print;
static int
output_func(int ch)
{
if (ch == 0) {
total_nulls++;
} else if (ch < 32 || (ch >= 127 && ch < 160)) {
total_ctrls++;
} else {
total_print++;
}
return ch;
}
static int
isNumeric(char *source)
{
@ -65,21 +92,30 @@ isNumeric(char *source)
return result;
}
static char *
validate(const char *name)
static int
relevant(const char *name, const char *value)
{
char *value = tigetstr(name);
if (!VALID_STRING(value)) {
if (v_opt > 1) {
int code = 1;
if (VALID_STRING(value)) {
if (strstr(value, "%p") == 0
&& strstr(value, "%d") == 0
&& strstr(value, "%s") == 0
&& (!p_opt || strstr(value, "$<") == 0)) {
if (v_opt > 2)
printf("? %s noparams\n", name);
code = 0;
}
} else {
if (v_opt > 2) {
printf("? %s %s\n",
(value == ABSENT_STRING)
? "absent"
: "cancel",
name);
}
value = 0;
code = 0;
}
return value;
return code;
}
static int
@ -108,34 +144,37 @@ increment(int *all_parms, int *num_parms, int len_parms, int end_parms)
}
static void
test_tparm(const char *name, int *number)
test_tparm(const char *name, const char *format, int *number)
{
char *format = tigetstr(name);
if ((format = validate(name)) != 0) {
char *result = tparm(format,
number[0],
number[1],
number[2],
number[3],
number[4],
number[5],
number[6],
number[7],
number[8]);
if (v_opt > 1)
printf(".. %2d = %2d %2d %2d %2d %2d %2d %2d %2d %2d %s\n",
result != 0 ? (int) strlen(result) : -1,
number[0],
number[1],
number[2],
number[3],
number[4],
number[5],
number[6],
number[7],
number[8],
name);
char *result = tparm(format,
number[0],
number[1],
number[2],
number[3],
number[4],
number[5],
number[6],
number[7],
number[8]);
total_tests++;
if (result != NULL) {
tputs(result, 1, output_func);
} else {
total_fails++;
}
if (v_opt > 1)
printf(".. %2d = %2d %2d %2d %2d %2d %2d %2d %2d %2d %s\n",
result != 0 ? (int) strlen(result) : -1,
number[0],
number[1],
number[2],
number[3],
number[4],
number[5],
number[6],
number[7],
number[8],
name);
}
static void
@ -145,12 +184,14 @@ usage(void)
{
"Usage: test_tparm [options] [capability] [value1 [value2 [...]]]",
"",
"Print all distinct combinations of given capability.",
"Use tparm/tputs for all distinct combinations of given capability.",
"",
"Options:",
" -T TERM override $TERM; this may be a comma-separated list or \"-\"",
" to read a list from standard-input",
" -a if capability is given, test all combinations of values",
" -a test all combinations of parameters",
" [value1...] forms a vector of maximum parameter-values.",
" -p test capabilities with no parameters but having padding",
" -r NUM repeat tests NUM times",
" -v show values and results",
};
@ -164,6 +205,8 @@ usage(void)
#define PLURAL(n) n, (n != 1) ? "s" : ""
#define COLONS(n) (n >= 1) ? ":" : ""
#define NUMFORM "%10ld"
int
main(int argc, char *argv[])
{
@ -172,22 +215,31 @@ main(int argc, char *argv[])
char *old_term = getenv("TERM");
int r_opt = 1;
char *t_opt = 0;
int len_names = 0; /* cur # of items in all_names[] */
int use_names = 10; /* max # of items in all_names[] */
char **all_names = typeCalloc(char *, use_names);
int all_parms[10]; /* workspace for "-a" option */
int len_terms = 0; /* cur # of items in all_terms[] */
int use_terms = 10; /* max # of items in all_terms[] */
char **all_terms = typeCalloc(char *, use_terms);
int len_parms = 0; /* cur # of items in num_parms[], str_parms[] */
int use_parms = argc + 10; /* max # of items in num_parms[], str_parms[] */
int *num_parms = typeCalloc(int, use_parms);
char **str_parms = typeCalloc(char *, use_parms);
if (all_names == 0 || all_terms == 0 || num_parms == 0 || str_parms == 0)
int len_caps = 0; /* cur # of items in all_caps[] */
int max_caps = 10; /* max # of items in all_caps[] */
char **all_caps = typeCalloc(char *, max_caps);
int all_parms[10]; /* workspace for "-a" option */
int len_terms = 0; /* cur # of items in all_terms[] */
int max_terms = 10; /* max # of items in all_terms[] */
char **all_terms = typeCalloc(char *, max_terms);
int use_caps;
char **cap_name;
char **cap_data;
int len_parms = 0; /* cur # of items in num_parms[], str_parms[] */
int max_parms = argc + 10; /* max # of items in num_parms[], str_parms[] */
int *num_parms = typeCalloc(int, max_parms);
char **str_parms = typeCalloc(char *, max_parms);
long use_parms = 1;
if (all_caps == 0 || all_terms == 0 || num_parms == 0 || str_parms == 0)
failed("no memory");
while ((n = getopt(argc, argv, "T:ar:v")) != -1) {
while ((n = getopt(argc, argv, "T:apr:v")) != -1) {
switch (n) {
case 'T':
t_opt = optarg;
@ -195,6 +247,9 @@ main(int argc, char *argv[])
case 'a':
++a_opt;
break;
case 'p':
++p_opt;
break;
case 'r':
r_opt = atoi(optarg);
break;
@ -213,14 +268,14 @@ main(int argc, char *argv[])
*/
if (optind < argc) {
if (!isNumeric(argv[optind])) {
all_names[len_names++] = strdup(argv[optind++]);
all_caps[len_caps++] = strdup(argv[optind++]);
}
}
/*
* Any remaining arguments must be possible parameter values. If numeric,
* and "-a" is not set, use those as the maximum values within which the
* test parameters should vary.
* and "-a" is not set, use those as the actual values for which the
* capabilities are tested.
*/
while (optind < argc) {
if (isNumeric(argv[optind])) {
@ -232,14 +287,16 @@ main(int argc, char *argv[])
++optind;
++len_parms;
}
for (n = len_parms; n < use_parms; ++n) {
for (n = len_parms; n < max_parms; ++n) {
static char dummy[1];
str_parms[n] = dummy;
}
if (v_opt) {
printf("%d parameter%s%s\n", PLURAL(len_parms), COLONS(len_parms));
for (n = 0; n < len_parms; ++n) {
printf(" %d: %d (%s)\n", n + 1, num_parms[n], str_parms[n]);
if (v_opt > 3) {
for (n = 0; n < len_parms; ++n) {
printf(" %d: %d (%s)\n", n + 1, num_parms[n], str_parms[n]);
}
}
}
@ -260,9 +317,9 @@ main(int argc, char *argv[])
while (t != s && isspace(UChar(t[-1])))
*--t = '\0';
s = strdup(s);
if (len_terms + 2 >= use_terms) {
use_terms *= 2;
all_terms = typeRealloc(char *, use_terms, all_terms);
if (len_terms + 2 >= max_terms) {
max_terms *= 2;
all_terms = typeRealloc(char *, max_terms, all_terms);
if (all_terms == 0)
failed("no memory: all_terms");
}
@ -273,9 +330,9 @@ main(int argc, char *argv[])
char *t;
while ((t = strtok(s, ",")) != 0) {
s = 0;
if (len_terms + 2 >= use_terms) {
use_terms *= 2;
all_terms = typeRealloc(char *, use_terms, all_terms);
if (len_terms + 2 >= max_terms) {
max_terms *= 2;
all_terms = typeRealloc(char *, max_terms, all_terms);
if (all_terms == 0)
failed("no memory: all_terms");
}
@ -288,8 +345,10 @@ main(int argc, char *argv[])
all_terms[len_terms] = 0;
if (v_opt) {
printf("%d term%s:\n", PLURAL(len_terms));
for (n = 0; n < len_terms; ++n) {
printf(" %d: %s\n", n + 1, all_terms[n]);
if (v_opt > 3) {
for (n = 0; n < len_terms; ++n) {
printf(" %d: %s\n", n + 1, all_terms[n]);
}
}
}
@ -300,34 +359,45 @@ main(int argc, char *argv[])
* TODO: To address the "other" systems which do not follow SVr4,
* just use the output from infocmp on $TERM.
*/
if (len_names == 0) {
if (len_caps == 0) {
#if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES)
for (n = 0; strnames[n] != 0; ++n) {
if (len_names + 2 >= use_names) {
use_names *= 2;
all_names = typeRealloc(char *, use_names, all_names);
if (all_names == 0) {
failed("no memory: all_names");
if (len_caps + 2 >= max_caps) {
max_caps *= 2;
all_caps = typeRealloc(char *, max_caps, all_caps);
if (all_caps == 0) {
failed("no memory: all_caps");
}
}
all_names[len_names++] = strdup(strnames[n]);
all_caps[len_caps++] = strdup(strnames[n]);
}
#else
all_names[len_names++] = strdup("cup");
all_names[len_names++] = strdup("sgr");
all_caps[len_caps++] = strdup("cup");
all_caps[len_caps++] = strdup("sgr");
#endif
}
all_names[len_names] = 0;
all_caps[len_caps] = 0;
if (v_opt) {
printf("%d name%s%s\n", PLURAL(len_names), COLONS(len_names));
for (n = 0; n < len_names; ++n) {
printf(" %d: %s\n", n + 1, all_names[n]);
printf("%d name%s%s\n", PLURAL(len_caps), COLONS(len_caps));
if (v_opt > 3) {
for (n = 0; n < len_caps; ++n) {
printf(" %d: %s\n", n + 1, all_caps[n]);
}
}
}
cap_name = typeMalloc(char *, len_caps);
cap_data = typeMalloc(char *, len_caps);
if (r_opt <= 0)
r_opt = 1;
if (a_opt) {
for (n = 0; n < use_parms; ++n)
if (num_parms[n])
use_parms *= (num_parms[n] + 1);
}
for (r_run = 0; r_run < r_opt; ++r_run) {
for (t_run = 0; t_run < len_terms; ++t_run) {
int errs;
@ -336,23 +406,42 @@ main(int argc, char *argv[])
printf("** skipping %s (errs:%d)\n", all_terms[t_run], errs);
}
if (v_opt)
printf("** testing %s\n", all_terms[t_run]);
if (len_names == 1) {
if (a_opt) {
/* for each combination of values */
memset(all_parms, 0, sizeof(all_parms));
do {
test_tparm(all_names[0], all_parms);
}
while (increment(all_parms, num_parms, len_parms, 0));
} else {
/* for the given values */
test_tparm(all_names[0], num_parms);
/*
* Most of the capabilities have no parameters, e.g., they are
* function-keys or simple operations such as clear-display.
* Ignore those, since they do not really exercise tparm.
*/
use_caps = 0;
for (n = 0; n < len_caps; ++n) {
char *value = tigetstr(all_caps[n]);
if (relevant(all_caps[n], value)) {
cap_name[use_caps] = all_caps[n];
cap_data[use_caps] = value;
use_caps++;
}
}
if (v_opt) {
printf("[%d:%d] %d cap%s * %ld param%s \"%s\"\n",
r_run + 1, r_opt,
PLURAL(use_caps),
PLURAL(use_parms),
all_terms[t_run]);
}
if (a_opt) {
/* for each combination of values */
memset(all_parms, 0, sizeof(all_parms));
do {
for (n_run = 0; n_run < use_caps; ++n_run) {
test_tparm(cap_name[n_run], cap_data[n_run], all_parms);
}
}
while (increment(all_parms, num_parms, len_parms, 0));
} else {
for (n_run = 0; n_run < len_names; ++n_run) {
test_tparm(all_names[n_run], num_parms);
/* for the given values */
for (n_run = 0; n_run < use_caps; ++n_run) {
test_tparm(cap_name[n_run], cap_data[n_run], all_parms);
}
}
if (cur_term != 0) {
@ -362,11 +451,21 @@ main(int argc, char *argv[])
}
}
}
printf("Tests:\n");
printf(NUMFORM " total\n", total_tests);
if (total_fails)
printf(NUMFORM " failed\n", total_fails);
printf("Characters:\n");
printf(NUMFORM " nulls\n", total_nulls);
printf(NUMFORM " controls\n", total_ctrls);
printf(NUMFORM " printable\n", total_print);
printf(NUMFORM " total\n", total_nulls + total_ctrls + total_print);
#if NO_LEAKS
for (n = 0; n < len_names; ++n) {
free(all_names[n]);
for (n = 0; n < len_caps; ++n) {
free(all_caps[n]);
}
free(all_names);
free(all_caps);
free(old_term);
for (n = 0; n < len_terms; ++n) {
free(all_terms[n]);
@ -374,6 +473,8 @@ main(int argc, char *argv[])
free(all_terms);
free(num_parms);
free(str_parms);
free(cap_name);
free(cap_data);
#endif
ExitProgram(EXIT_SUCCESS);