ncurses 5.9 - patch 20110423

+ add check in test/configure for use_window, use_screen.
+ add configure-checks for getopt's variables, which may be declared
  as different types on some Unix systems.
+ add check in test/configure for some legacy curses types of the
  function pointer passed to tputs().
+ modify init_pair() to accept -1's for color value after
  assume_default_colors() has been called (Debian #337905).
+ modify test/background.c, adding commmand-line options to demonstrate
  assume_default_colors() and use_default_colors().
This commit is contained in:
Thomas E. Dickey 2011-04-24 00:53:45 +00:00
parent 48c8a4fe45
commit 950eed9ace
25 changed files with 1921 additions and 1229 deletions

4
Ada95/aclocal.m4 vendored
View File

@ -28,7 +28,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey
dnl
dnl $Id: aclocal.m4,v 1.24 2011/03/31 23:32:36 tom Exp $
dnl $Id: aclocal.m4,v 1.25 2011/04/23 15:30:49 tom Exp $
dnl Macros used in NCURSES Ada95 auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
@ -2546,7 +2546,7 @@ case ".[$]$1" in #(vi
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
dnl CF_PKG_CONFIG version: 6 updated: 2011/04/17 06:36:21
dnl -------------
dnl Check for the package-config program, unless disabled by command-line.
AC_DEFUN([CF_PKG_CONFIG],

View File

@ -1022,6 +1022,7 @@
./test/cardfile.dat
./test/chgat.c
./test/clip_printw.c
./test/color_name.h
./test/color_set.c
./test/configure
./test/configure.in

13
NEWS
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.1688 2011/04/16 16:38:35 tom Exp $
-- $Id: NEWS,v 1.1693 2011/04/23 22:28:43 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@ -45,6 +45,17 @@ 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.
20110423
+ add check in test/configure for use_window, use_screen.
+ add configure-checks for getopt's variables, which may be declared
as different types on some Unix systems.
+ add check in test/configure for some legacy curses types of the
function pointer passed to tputs().
+ modify init_pair() to accept -1's for color value after
assume_default_colors() has been called (Debian #337905).
+ modify test/background.c, adding commmand-line options to demonstrate
assume_default_colors() and use_default_colors().
20110416
+ modify configure script/source-code to only define _POSIX_SOURCE if
the checks for sigaction and/or termios fail, and if _POSIX_C_SOURCE

27
aclocal.m4 vendored
View File

@ -28,7 +28,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: aclocal.m4,v 1.554 2011/04/16 16:37:26 tom Exp $
dnl $Id: aclocal.m4,v 1.555 2011/04/23 21:38:05 tom Exp $
dnl Macros used in NCURSES auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
@ -1769,6 +1769,29 @@ rm -rf conftest*
AC_SUBST(EXTRA_CFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GETOPT_HEADER version: 4 updated: 2009/08/31 20:07:52
dnl ----------------
dnl Check for getopt's variables which are commonly defined in stdlib.h,
dnl unistd.h or (nonstandard) in getopt.h
AC_DEFUN([CF_GETOPT_HEADER],
[
AC_HAVE_HEADERS(unistd.h getopt.h)
AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
cf_cv_getopt_header=none
for cf_header in stdio.h stdlib.h unistd.h getopt.h
do
AC_TRY_COMPILE([
#include <$cf_header>],
[int x = optind; char *y = optarg],
[cf_cv_getopt_header=$cf_header
break])
done
])
if test $cf_cv_getopt_header != none ; then
AC_DEFINE(HAVE_GETOPT_HEADER)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GNAT_GENERICS version: 2 updated: 2011/03/23 20:24:41
dnl ----------------
AC_DEFUN([CF_GNAT_GENERICS],
@ -4376,7 +4399,7 @@ case ".[$]$1" in #(vi
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
dnl CF_PKG_CONFIG version: 6 updated: 2011/04/17 06:36:21
dnl -------------
dnl Check for the package-config program, unless disabled by command-line.
AC_DEFUN([CF_PKG_CONFIG],

1875
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -28,14 +28,14 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: configure.in,v 1.520 2011/03/28 00:22:26 tom Exp $
dnl $Id: configure.in,v 1.522 2011/04/23 23:48:10 tom Exp $
dnl Process this file with autoconf to produce a configure script.
dnl
dnl See http://invisible-island.net/autoconf/ for additional information.
dnl
dnl ---------------------------------------------------------------------------
AC_PREREQ(2.13.20020210)
AC_REVISION($Revision: 1.520 $)
AC_REVISION($Revision: 1.522 $)
AC_INIT(ncurses/base/lib_initscr.c)
AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
@ -883,12 +883,15 @@ AC_ARG_ENABLE(ext-funcs,
AC_MSG_RESULT($with_ext_funcs)
if test "$with_ext_funcs" = yes ; then
NCURSES_EXT_FUNCS=1
AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS)
AC_DEFINE(HAVE_CURSES_VERSION)
AC_DEFINE(HAVE_HAS_KEY)
AC_DEFINE(HAVE_RESIZETERM)
AC_DEFINE(HAVE_RESIZE_TERM)
AC_DEFINE(HAVE_TERM_ENTRY_H)
AC_DEFINE(HAVE_USE_DEFAULT_COLORS)
AC_DEFINE(HAVE_USE_SCREEN)
AC_DEFINE(HAVE_USE_WINDOW)
AC_DEFINE(HAVE_WRESIZE)
AC_DEFINE(NCURSES_EXT_FUNCS)
GENERATED_EXT_FUNCS=generated
@ -1344,6 +1347,8 @@ unistd.h \
wctype.h \
)
CF_GETOPT_HEADER
# check for ISC (this may also define _POSIX_SOURCE)
# Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
if test "$ISC" = yes ; then

View File

@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.812 2011/04/16 14:11:36 tom Exp $
# $Id: dist.mk,v 1.813 2011/04/23 14:45:18 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
@ -37,7 +37,7 @@ SHELL = /bin/sh
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 9
NCURSES_PATCH = 20110416
NCURSES_PATCH = 20110423
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -1,4 +1,4 @@
# $Id: ncurses_defs,v 1.47 2011/04/09 20:40:48 tom Exp $
# $Id: ncurses_defs,v 1.49 2011/04/23 22:09:35 tom Exp $
##############################################################################
# Copyright (c) 2000-2010,2011 Free Software Foundation, Inc. #
# #
@ -41,6 +41,7 @@ DECL_ERRNO
ETIP_NEEDS_MATH_H
GCC_NORETURN /* nothing */
GCC_UNUSED /* nothing */
HAVE_ASSUME_DEFAULT_COLORS
HAVE_BIG_CORE
HAVE_BSD_CGETENT
HAVE_BSD_SIGNAL_H
@ -157,6 +158,8 @@ HAVE_UNCTRL_H 1
HAVE_UNISTD_H
HAVE_UNLINK
HAVE_USE_DEFAULT_COLORS
HAVE_USE_SCREEN
HAVE_USE_WINDOW
HAVE_VFSCANF
HAVE_VSNPRINTF
HAVE_VSSCANF

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
* Copyright (c) 1998-2010,2011 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,7 +45,7 @@
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: lib_color.c,v 1.98 2010/04/24 22:57:53 tom Exp $")
MODULE_ID("$Id: lib_color.c,v 1.99 2011/04/23 18:22:22 tom Exp $")
#ifdef USE_TERM_DRIVER
#define CanChange InfoOf(SP_PARM).canchange
@ -439,7 +439,7 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b)
previous = SP_PARM->_color_pairs[pair];
#if NCURSES_EXT_FUNCS
if (SP_PARM->_default_color) {
if (SP_PARM->_default_color || SP_PARM->_assumed_color) {
bool isDefault = FALSE;
bool wasDefault = FALSE;
int default_pairs = SP_PARM->_default_pairs;
@ -498,8 +498,9 @@ NCURSES_SP_NAME(init_pair) (NCURSES_SP_DCLx short pair, short f, short b)
{
if ((f < 0) || !OkColorHi(f)
|| (b < 0) || !OkColorHi(b)
|| (pair < 1))
|| (pair < 1)) {
returnCode(ERR);
}
}
/*

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2005,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2011 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,7 +37,7 @@
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: lib_dft_fgbg.c,v 1.25 2009/10/24 22:15:00 tom Exp $")
MODULE_ID("$Id: lib_dft_fgbg.c,v 1.26 2011/04/23 18:28:18 tom Exp $")
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
@ -80,6 +80,7 @@ NCURSES_SP_NAME(assume_default_colors) (NCURSES_SP_DCLx int fg, int bg)
SP_PARM->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK);
if (SP_PARM->_color_pairs != 0) {
bool save = SP_PARM->_default_color;
SP_PARM->_assumed_color = TRUE;
SP_PARM->_default_color = TRUE;
init_pair(0, (short) fg, (short) bg);
SP_PARM->_default_color = save;

View File

@ -34,7 +34,7 @@
****************************************************************************/
/*
* $Id: curses.priv.h,v 1.476 2011/04/16 15:31:02 tom Exp $
* $Id: curses.priv.h,v 1.477 2011/04/23 18:05:15 tom Exp $
*
* curses.priv.h
*
@ -1019,6 +1019,7 @@ struct screen {
int _pair_count; /* count of color pairs */
int _pair_limit; /* actual limit of color-pairs */
#if NCURSES_EXT_FUNCS
bool _assumed_color; /* use assumed colors */
bool _default_color; /* use default colors */
bool _has_sgr_39_49; /* has ECMA default color support */
int _default_fg; /* assumed default foreground */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* Copyright (c) 1998-2008,2011 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,7 @@
* Author: Thomas E. Dickey 1997-on *
****************************************************************************/
/*
* $Id: progs.priv.h,v 1.34 2008/08/03 17:43:05 tom Exp $
* $Id: progs.priv.h,v 1.35 2011/04/23 22:33:09 tom Exp $
*
* progs.priv.h
*
@ -99,7 +99,7 @@ extern int errno;
#if HAVE_GETOPT_H
#include <getopt.h>
#else
#elif !defined(HAVE_GETOPT_HEADER)
/* 'getopt()' may be prototyped in <stdlib.h>, but declaring its
* variables doesn't hurt.
*/

71
test/aclocal.m4 vendored
View File

@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written *
dnl authorization. *
dnl***************************************************************************
dnl
dnl $Id: aclocal.m4,v 1.52 2011/04/09 22:22:11 tom Exp $
dnl $Id: aclocal.m4,v 1.59 2011/04/23 23:26:44 tom Exp $
dnl
dnl Author: Thomas E. Dickey
dnl
@ -1457,6 +1457,29 @@ rm -rf conftest*
AC_SUBST(EXTRA_CFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GETOPT_HEADER version: 4 updated: 2009/08/31 20:07:52
dnl ----------------
dnl Check for getopt's variables which are commonly defined in stdlib.h,
dnl unistd.h or (nonstandard) in getopt.h
AC_DEFUN([CF_GETOPT_HEADER],
[
AC_HAVE_HEADERS(unistd.h getopt.h)
AC_CACHE_CHECK(for header declaring getopt variables,cf_cv_getopt_header,[
cf_cv_getopt_header=none
for cf_header in stdio.h stdlib.h unistd.h getopt.h
do
AC_TRY_COMPILE([
#include <$cf_header>],
[int x = optind; char *y = optarg],
[cf_cv_getopt_header=$cf_header
break])
done
])
if test $cf_cv_getopt_header != none ; then
AC_DEFINE(HAVE_GETOPT_HEADER)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
dnl -------------
dnl Check if we must define _GNU_SOURCE to get a reasonable value for
@ -2256,7 +2279,7 @@ else
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
dnl CF_PKG_CONFIG version: 6 updated: 2011/04/17 06:36:21
dnl -------------
dnl Check for the package-config program, unless disabled by command-line.
AC_DEFUN([CF_PKG_CONFIG],
@ -2575,6 +2598,50 @@ ncursesw/term.h)
esac
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_TPUTS_PROTO version: 2 updated: 2011/04/23 19:25:50
dnl --------------
dnl Check for type of function-pointer passed to tputs. Some old
dnl implementations used functions that had different prototypes, making it
dnl hard to compile portable programs using tputs.
AC_DEFUN([CF_TPUTS_PROTO],[
CF_CURSES_FUNCS(tputs)
if test x$cf_cv_func_tputs = xyes
then
cf_done=no
for cf_arg in int char
do
for cf_ret in int void
do
if test $cf_ret = void
then
cf_return="/* nothing */"
else
cf_return="return value"
fi
AC_TRY_COMPILE([
#include <${cf_cv_ncurses_header:-curses.h}>
#include <$cf_cv_term_header>
static $cf_ret outc($cf_arg value) { $cf_return; }
],[
tputs("hello", 0, outc);
${cf_cv_main_return:-return}(0);
],[
CF_VERBOSE([prototype $cf_ret func($cf_arg value)])
cat >>confdefs.h <<EOF
#define TPUTS_ARG $cf_arg
#define TPUTS_PROTO(func,value) $cf_ret func(TPUTS_ARG value)
#define TPUTS_RETURN(value) $cf_return
EOF
cf_done=yes
break
])
done
test $cf_done = yes && break
done
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_TRY_PKG_CONFIG version: 4 updated: 2010/06/14 17:42:30
dnl -----------------
dnl This is a simple wrapper to use for pkg-config, for libraries which may be

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2003,2006 Free Software Foundation, Inc. *
* Copyright (c) 2003-2006,2011 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 *
@ -26,15 +26,128 @@
* authorization. *
****************************************************************************/
/*
* $Id: background.c,v 1.3 2006/06/03 16:43:08 tom Exp $
* $Id: background.c,v 1.9 2011/04/23 21:16:38 tom Exp $
*/
#include <test.priv.h>
#define NEED_COLOR_CODE 1
#define NEED_COLOR_NAME 1
#include <color_name.h>
static int default_bg = COLOR_BLACK;
static int default_fg = COLOR_WHITE;
static void
test_background(void)
{
short f, b;
pair_content(0, &f, &b);
printw("pair 0 contains (%d,%d)\n", f, b);
getch();
printw("Initializing pair 1 to red/%s\n", color_name(default_bg));
init_pair(1, COLOR_RED, (short) default_bg);
bkgdset(' ' | COLOR_PAIR(1));
printw("RED/BLACK\n");
getch();
printw("Initializing pair 2 to %s/blue\n", color_name(default_fg));
init_pair(2, (short) default_fg, COLOR_BLUE);
bkgdset(' ' | COLOR_PAIR(2));
printw("This line should be %s/blue\n", color_name(default_fg));
getch();
printw("Resetting colors to pair 0\n");
bkgdset(' ' | COLOR_PAIR(0));
printw("Default Colors\n");
getch();
printw("Resetting colors to pair 1\n");
bkgdset(' ' | COLOR_PAIR(1));
printw("This line should be red/%s\n", color_name(default_bg));
getch();
printw("Setting screen to pair 0\n");
bkgd(' ' | COLOR_PAIR(0));
getch();
printw("Setting screen to pair 1\n");
bkgd(' ' | COLOR_PAIR(1));
getch();
printw("Setting screen to pair 2\n");
bkgd(' ' | COLOR_PAIR(2));
getch();
printw("Setting screen to pair 0\n");
bkgd(' ' | COLOR_PAIR(0));
getch();
}
static void
usage(void)
{
static const char *msg[] =
{
"Usage: background [options]"
,""
,"Options:"
#if HAVE_ASSUME_DEFAULT_COLORS
," -a invoke assume_default_colors, repeat to use in init_pair"
#endif
," -b XXX specify background color"
#if HAVE_USE_DEFAULT_COLORS
," -d invoke use_default_colors, repeat to use in init_pair"
#endif
," -f XXX specify foreground color"
};
size_t n;
for (n = 0; n < SIZEOF(msg); n++)
fprintf(stderr, "%s\n", msg[n]);
ExitProgram(EXIT_FAILURE);
}
int
main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
{
short f, b;
#if HAVE_ASSUME_DEFAULT_COLORS
int a_option = 0;
#endif
#if HAVE_USE_DEFAULT_COLORS
int d_option = 0;
#endif
int n;
while ((n = getopt(argc, argv, "ab:df:")) != -1) {
switch (n) {
#if HAVE_ASSUME_DEFAULT_COLORS
case 'a':
++a_option;
break;
#endif
case 'b':
default_bg = color_code(optarg);
break;
#if HAVE_USE_DEFAULT_COLORS
case 'd':
++d_option;
break;
#endif
case 'f':
default_fg = color_code(optarg);
break;
default:
usage();
}
}
#if HAVE_USE_DEFAULT_COLORS && HAVE_ASSUME_DEFAULT_COLORS
if (a_option && d_option) {
fprintf(stderr, "Use either -a or -d option, but not both\n");
ExitProgram(EXIT_FAILURE);
}
#endif
initscr();
cbreak();
@ -43,47 +156,30 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
if (has_colors()) {
start_color();
pair_content(0, &f, &b);
printw("pair 0 contains (%d,%d)\n", f, b);
getch();
#if HAVE_USE_DEFAULT_COLORS
if (d_option) {
printw("Using default colors...\n");
use_default_colors();
if (d_option > 1) {
default_fg = -1;
default_bg = -1;
}
}
#endif
#if HAVE_ASSUME_DEFAULT_COLORS
if (a_option) {
printw("Using assumed colors %s/%s...\n",
color_name(default_fg),
color_name(default_bg));
assume_default_colors(default_fg, default_bg);
if (a_option > 1) {
default_fg = -1;
default_bg = -1;
}
}
#endif
printw("Initializing pair 1 to red/black\n");
init_pair(1, COLOR_RED, COLOR_BLACK);
bkgdset(' ' | COLOR_PAIR(1));
printw("RED/BLACK\n");
getch();
printw("Initializing pair 2 to white/blue\n");
init_pair(2, COLOR_WHITE, COLOR_BLUE);
bkgdset(' ' | COLOR_PAIR(2));
printw("WHITE/BLUE\n");
getch();
printw("Resetting colors to pair 0\n");
bkgdset(' ' | COLOR_PAIR(0));
printw("Default Colors\n");
getch();
printw("Resetting colors to pair 1\n");
bkgdset(' ' | COLOR_PAIR(1));
printw("RED/BLACK\n");
getch();
printw("Setting screen to pair 0\n");
bkgd(' ' | COLOR_PAIR(0));
getch();
printw("Setting screen to pair 1\n");
bkgd(' ' | COLOR_PAIR(1));
getch();
printw("Setting screen to pair 2\n");
bkgd(' ' | COLOR_PAIR(2));
getch();
printw("Setting screen to pair 0\n");
bkgd(' ' | COLOR_PAIR(0));
getch();
test_background();
} else {
printw("This demo requires a color terminal");

103
test/color_name.h Normal file
View File

@ -0,0 +1,103 @@
/****************************************************************************
* Copyright (c) 2011 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 *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/*
* $Id: color_name.h,v 1.2 2011/04/23 17:15:01 tom Exp $
*/
#ifndef __COLORNAME_H
#define __COLORNAME_H 1
#ifndef __TEST_PRIV_H
#include <test.priv.h>
#endif
static NCURSES_CONST char *the_color_names[] =
{
"black",
"red",
"green",
"yellow",
"blue",
"magenta",
"cyan",
"white",
"BLACK",
"RED",
"GREEN",
"YELLOW",
"BLUE",
"MAGENTA",
"CYAN",
"WHITE"
};
#ifdef NEED_COLOR_CODE
static int
color_code(const char *color)
{
int result = 0;
char *endp = 0;
size_t n;
if ((result = strtol(color, &endp, 0)) >= 0
&& (endp == 0 || *endp == 0)) {
;
} else if (!strcmp(color, "default")) {
result = -1;
} else {
for (n = 0; n < SIZEOF(the_color_names); ++n) {
if (!strcmp(the_color_names[n], color)) {
result = (int) n;
break;
}
}
}
return result;
}
#endif /* NEED_COLOR_NAME */
#ifdef NEED_COLOR_NAME
static const char *
color_name(int color)
{
static char temp[20];
const char *result = 0;
if (color > (int) SIZEOF(the_color_names)) {
sprintf(temp, "%d", color);
result = temp;
} else if (color < 0) {
result = "default";
} else {
result = the_color_names[color];
}
return result;
}
#endif /* NEED_COLOR_NAME */
#endif /* __COLORNAME_H */

713
test/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1996, etc.
dnl
dnl $Id: configure.in,v 1.93 2011/04/09 20:11:47 tom Exp $
dnl $Id: configure.in,v 1.97 2011/04/23 22:10:32 tom Exp $
dnl This is a simple configuration-script for the ncurses test programs that
dnl allows the test-directory to be separately configured against a reference
dnl system (i.e., sysvr4 curses)
@ -200,6 +200,8 @@ termios.h \
unistd.h \
)
CF_GETOPT_HEADER
AC_CHECK_FUNCS( \
gettimeofday \
strdup \
@ -219,6 +221,7 @@ wcstombs \
fi
CF_CURSES_FUNCS( \
assume_default_colors \
chgat \
color_set \
filter \
@ -245,14 +248,17 @@ tigetnum \
tigetstr \
typeahead \
use_default_colors \
vw_printw \
use_screen \
use_window \
vsscanf \
vw_printw \
wchgat \
winsstr \
wresize \
wsyncdown \
)
CF_TPUTS_PROTO
CF_NCURSES_EXT_FUNCS
if test "$cf_enable_widec" = yes

View File

@ -29,7 +29,7 @@
/*
* Author: Thomas E. Dickey <dickey@clark.net> 1999
*
* $Id: dots.c,v 1.22 2010/11/14 01:00:02 tom Exp $
* $Id: dots.c,v 1.23 2011/04/23 19:15:04 tom Exp $
*
* A simple demo of the terminfo interface.
*/
@ -46,8 +46,8 @@ static bool interrupted = FALSE;
static long total_chars = 0;
static time_t started;
static int
outc(TPUTS_ARG c)
static
TPUTS_PROTO(outc, c)
{
int rc = c;
@ -58,7 +58,7 @@ outc(TPUTS_ARG c)
} else {
rc = putc(c, stdout);
}
return rc;
TPUTS_RETURN(rc);
}
static bool

View File

@ -29,7 +29,7 @@
/*
* Author: Thomas E. Dickey - 2007
*
* $Id: dots_mvcur.c,v 1.6 2010/11/14 01:00:44 tom Exp $
* $Id: dots_mvcur.c,v 1.7 2011/04/23 19:17:20 tom Exp $
*
* A simple demo of the terminfo interface, and mvcur.
*/
@ -46,8 +46,8 @@ static bool interrupted = FALSE;
static long total_chars = 0;
static time_t started;
static int
outc(TPUTS_ARG c)
static
TPUTS_PROTO(outc, c)
{
int rc = c;
@ -59,7 +59,7 @@ outc(TPUTS_ARG c)
if (putc(c, stdout) == EOF)
rc = EOF;
}
return rc;
TPUTS_RETURN(rc);
}
static bool

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
* Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -29,7 +29,7 @@
/*
* Author: Thomas E. Dickey <dickey@clark.net> 1998
*
* $Id: filter.c,v 1.13 2010/11/13 20:55:54 tom Exp $
* $Id: filter.c,v 1.14 2011/04/23 20:13:32 tom Exp $
*/
#include <test.priv.h>
@ -143,7 +143,7 @@ main(int argc, char *argv[])
reset_shell_mode();
printf("\n");
fflush(stdout);
system(buffer);
IGNORE_RC(system(buffer));
reset_prog_mode();
touchwin(stdscr);
erase();

View File

@ -40,7 +40,7 @@ AUTHOR
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
$Id: ncurses.c,v 1.365 2011/01/22 19:48:33 tom Exp $
$Id: ncurses.c,v 1.367 2011/04/23 21:16:43 tom Exp $
***************************************************************************/
@ -490,7 +490,7 @@ ShellOut(bool message)
#ifdef __MINGW32__
system("cmd.exe");
#else
system("sh");
IGNORE_RC(system("sh"));
#endif
if (message)
addstr("returned from shellout.\n");
@ -777,7 +777,7 @@ resize_boxes(unsigned level, WINDOW *win)
}
doupdate();
}
#endif /* resize_boxes */
#endif /* resize_boxes */
#else
#define forget_boxes() /* nothing */
#define remember_boxes(level,text,frame) /* nothing */
@ -6772,7 +6772,7 @@ main(int argc, char *argv[])
use_default_colors();
min_colors = -1;
}
#if NCURSES_VERSION_PATCH >= 20000708
#if HAVE_ASSUME_DEFAULT_COLORS
if (assumed_colors)
assume_default_colors(default_fg, default_bg);
#endif

View File

@ -29,7 +29,7 @@
/*
* Author: Thomas E. Dickey - 2000
*
* $Id: railroad.c,v 1.19 2009/10/24 21:37:56 tom Exp $
* $Id: railroad.c,v 1.20 2011/04/23 19:15:04 tom Exp $
*
* A simple demo of the termcap interface.
*/
@ -55,8 +55,8 @@ static char *backup;
static bool interrupted = FALSE;
static int
outc(TPUTS_ARG c)
static
TPUTS_PROTO(outc, c)
{
int rc = OK;
@ -68,7 +68,7 @@ outc(TPUTS_ARG c)
if (putc(c, stdout) == EOF)
rc = ERR;
}
return rc;
TPUTS_RETURN(rc);
}
static void

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2006-2007,2010 Free Software Foundation, Inc. *
* Copyright (c) 2006-2010,2011 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 *
@ -26,7 +26,7 @@
* authorization. *
****************************************************************************/
/*
* $Id: redraw.c,v 1.5 2010/05/01 22:04:08 tom Exp $
* $Id: redraw.c,v 1.6 2011/04/23 20:13:21 tom Exp $
*
* Demonstrate the redrawwin() and wredrawln() functions.
* Thomas Dickey - 2006/11/4
@ -113,7 +113,7 @@ test_redraw(WINDOW *win)
* using mvcur(). It is ifdef'd for NCURSES, since X/Open does
* not define the case where the old location is unknown.
*/
system("date");
IGNORE_RC(system("date"));
mvcur(-1, -1, y, x);
break;
#endif

View File

@ -29,7 +29,7 @@
/****************************************************************************
* Author: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: test.priv.h,v 1.105 2011/04/09 20:41:51 tom Exp $ */
/* $Id: test.priv.h,v 1.112 2011/04/23 23:32:07 tom Exp $ */
#ifndef __TEST_PRIV_H
#define __TEST_PRIV_H 1
@ -58,6 +58,10 @@
/*
* Fallback definitions to accommodate broken compilers.
*/
#ifndef HAVE_ASSUME_DEFAULT_COLORS
#define HAVE_ASSUME_DEFAULT_COLORS 0
#endif
#ifndef HAVE_CURSES_VERSION
#define HAVE_CURSES_VERSION 0
#endif
@ -202,6 +206,14 @@
#define HAVE_USE_DEFAULT_COLORS 0
#endif
#ifndef HAVE_USE_SCREEN
#define HAVE_USE_SCREEN 0
#endif
#ifndef HAVE_USE_WINDOW
#define HAVE_USE_WINDOW 0
#endif
#ifndef HAVE_WRESIZE
#define HAVE_WRESIZE 0
#endif
@ -287,7 +299,7 @@
#if HAVE_GETOPT_H
#include <getopt.h>
#else
#elif !defined(HAVE_GETOPT_HEADER)
/* 'getopt()' may be prototyped in <stdlib.h>, but declaring its variables
* doesn't hurt.
*/
@ -327,13 +339,13 @@ extern int optind;
#endif
#if !USE_SOFTKEYS
#define slk_init() /* nothing */
#define slk_restore() /* nothing */
#define slk_clear() /* nothing */
#define slk_init() /* nothing */
#define slk_restore() /* nothing */
#define slk_clear() /* nothing */
#endif
#ifndef HAVE_WSYNCDOWN
#define wsyncdown(win) /* nothing */
#define wsyncdown(win) /* nothing */
#endif
#ifndef USE_WIDEC_SUPPORT
@ -657,25 +669,32 @@ extern char *strnames[], *strcodes[], *strfnames[];
* The same would be needed for HPUX 10.20
*/
#ifndef TPUTS_ARG
#if defined(sun) && !defined(_XOPEN_CURSES) && !defined(NCURSES_VERSION_PATCH)
#define TPUTS_ARG char
extern char *tgoto(char *, int, int); /* available, but not prototyped */
#else
#define TPUTS_ARG int
#endif
#if defined(sun) && !defined(_XOPEN_CURSES) && !defined(NCURSES_VERSION_PATCH)
#undef TPUTS_ARG
#define TPUTS_ARG char
extern char *tgoto(char *, int, int); /* available, but not prototyped */
#endif
#ifndef TPUTS_PROTO
#define TPUTS_PROTO(func,value) int func(TPUTS_ARG value)
#endif
#ifndef TPUTS_RETURN
#define TPUTS_RETURN(value) return value
#endif
/*
* Workarounds for Solaris's X/Open curses
*/
#if defined(sun) && defined(_XOPEN_CURSES) && !defined(NCURSES_VERSION_PATCH)
#if !defined(KEY_MIN) && defined(__KEY_MIN)
#define KEY_MIN __KEY_MIN
#endif
#if !defined(KEY_MAX) && defined(__KEY_MIN)
#define KEY_MAX __KEY_MAX
#endif
#endif
/*
* Workaround to build with Sun's default SVr4 curses.
@ -706,23 +725,10 @@ extern char *tgoto(char *, int, int); /* available, but not prototyped */
#define CONST_MENUS /* nothing */
#endif
#ifndef HAVE_USE_WINDOW
#if !defined(NCURSES_VERSION_PATCH) || (NCURSES_VERSION_PATCH < 20070915) || !NCURSES_EXT_FUNCS
#define HAVE_USE_WINDOW 0
#else
#define HAVE_USE_WINDOW 1
#endif
#endif
/*
* Simplify setting up demo of threading with these macros.
*/
#if !HAVE_USE_WINDOW
typedef int (*NCURSES_WINDOW_CB) (WINDOW *, void *);
typedef int (*NCURSES_SCREEN_CB) (SCREEN *, void *);
#endif
#if HAVE_USE_WINDOW
#define USING_WINDOW(w,func) use_window(w, (NCURSES_WINDOW_CB) func, w)
#define USING_WINDOW2(w,func,data) use_window(w, (NCURSES_WINDOW_CB) func, data)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. *
* Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -29,7 +29,7 @@
* This is an example written by Alexander V. Lukyanov <lav@yars.free.net>,
* to demonstrate an inconsistency between ncurses and SVr4 curses.
*
* $Id: testaddch.c,v 1.7 2009/08/29 19:02:25 tom Exp $
* $Id: testaddch.c,v 1.8 2011/04/23 20:13:12 tom Exp $
*/
#include <test.priv.h>
@ -63,7 +63,7 @@ main(
for (i = 0; i < 8; i++) {
back = (i & 1) ? A_BOLD | 'B' : ' ';
set = (i & 2) ? A_REVERSE : 0;
attr = (i & 4) ? COLOR_PAIR(4) : 0;
attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0);
bkgdset(back);
(void) attrset(set);
@ -74,7 +74,7 @@ main(
for (i = 0; i < 8; i++) {
back = (i & 1) ? A_BOLD | 'B' | COLOR_PAIR(1) : ' ';
set = (i & 2) ? A_REVERSE | COLOR_PAIR(2) : 0;
attr = (i & 4) ? COLOR_PAIR(4) : 0;
attr = (chtype) ((i & 4) ? COLOR_PAIR(4) : 0);
bkgdset(back);
(void) attrset(set);