From 0c12f3c8ff417105269bda50a3a2fe06c0bfdebf Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 24 Jul 2011 00:36:27 +0000 Subject: [PATCH] ncurses 5.9 - patch 20110723 + add a check in start_color() to limit color-pairs to 256 when extended colors are not supported (patch by David Benjamin). + modify setcchar to omit no-longer-needed OR'ing of color pair in the SetAttr() macro (patch by David Benjamin). + add kich1 to sun terminfo entry (Yuri Pankov) + use bold rather than reverse for smso in sun-color terminfo entry (Yuri Pankov). + improve generation of termcap using tic/infocmp -C option, e.g., to correspond with 4.2BSD (prompted by discussion with Yuri Pankov regarding Schilling's test program): + translate %02 and %03 to %2 and %3 respectively. + suppress string capabilities which use %s, not supported by tgoto + use \040 rather than \s + expand null characters as \200 rather than \0 + modify configure script to support shared libraries for DragonFlyBSD. --- Ada95/aclocal.m4 | 10 +-- Ada95/configure | 4 +- NEWS | 19 ++++- aclocal.m4 | 10 +-- configure | 4 +- dist.mk | 4 +- misc/terminfo.src | 18 +++-- ncurses/base/lib_color.c | 9 ++- ncurses/tinfo/captoinfo.c | 148 +++++++++++++++++++---------------- ncurses/widechar/lib_cchar.c | 4 +- 10 files changed, 134 insertions(+), 96 deletions(-) diff --git a/Ada95/aclocal.m4 b/Ada95/aclocal.m4 index c24faf62..cc2ecfc9 100644 --- a/Ada95/aclocal.m4 +++ b/Ada95/aclocal.m4 @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey dnl -dnl $Id: aclocal.m4,v 1.33 2011/07/17 00:39:55 tom Exp $ +dnl $Id: aclocal.m4,v 1.34 2011/07/17 18:54:59 tom Exp $ dnl Macros used in NCURSES Ada95 auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -1627,7 +1627,7 @@ ifdef([AC_FUNC_FSEEKO],[ ]) ]) dnl --------------------------------------------------------------------------- -dnl CF_LD_RPATH_OPT version: 4 updated: 2011/06/04 20:09:13 +dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41 dnl --------------- dnl For the given system and compiler, find the compiler flags to pass to the dnl loader to use the "rpath" feature. @@ -1651,7 +1651,7 @@ linux*|gnu*|k*bsd*-gnu) #(vi openbsd[[2-9]].*|mirbsd*) #(vi LD_RPATH_OPT="-Wl,-rpath," ;; -freebsd*) #(vi +dragonfly*|freebsd*) #(vi LD_RPATH_OPT="-rpath " ;; netbsd*) #(vi @@ -2942,7 +2942,7 @@ define([CF_REMOVE_LIB], $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'` ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 67 updated: 2011/07/02 15:36:04 +dnl CF_SHARED_OPTS version: 68 updated: 2011/07/17 14:48:41 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -3128,7 +3128,7 @@ CF_EOF MK_SHARED_LIB='${LD} -Bshareable -o $[@]' test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel ;; - freebsd*) #(vi + dragonfly*|freebsd*) #(vi CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" diff --git a/Ada95/configure b/Ada95/configure index 93814f4f..1a3b7b67 100644 --- a/Ada95/configure +++ b/Ada95/configure @@ -7423,7 +7423,7 @@ linux*|gnu*|k*bsd*-gnu) #(vi openbsd[2-9].*|mirbsd*) #(vi LD_RPATH_OPT="-Wl,-rpath," ;; -freebsd*) #(vi +dragonfly*|freebsd*) #(vi LD_RPATH_OPT="-rpath " ;; netbsd*) #(vi @@ -7735,7 +7735,7 @@ echo "${ECHO_T}$cf_cv_ldflags_search_paths_first" >&6 MK_SHARED_LIB='${LD} -Bshareable -o $@' test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel ;; - freebsd*) #(vi + dragonfly*|freebsd*) #(vi CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" diff --git a/NEWS b/NEWS index d2947af5..de116f0b 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1734 2011/07/16 22:24:30 tom Exp $ +-- $Id: NEWS,v 1.1743 2011/07/23 22:02:25 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,23 @@ 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. +20110723 + + add a check in start_color() to limit color-pairs to 256 when + extended colors are not supported (patch by David Benjamin). + + modify setcchar to omit no-longer-needed OR'ing of color pair in + the SetAttr() macro (patch by David Benjamin). + + add kich1 to sun terminfo entry (Yuri Pankov) + + use bold rather than reverse for smso in sun-color terminfo entry + (Yuri Pankov). + + improve generation of termcap using tic/infocmp -C option, e.g., + to correspond with 4.2BSD (prompted by discussion with Yuri Pankov + regarding Schilling's test program): + + translate %02 and %03 to %2 and %3 respectively. + + suppress string capabilities which use %s, not supported by tgoto + + use \040 rather than \s + + expand null characters as \200 rather than \0 + + modify configure script to support shared libraries for DragonFlyBSD. + 20110716 + replace an assert() in _nc_Free_Argument() with a regular null pointer check (report/analysis by Franjo Ivancic). diff --git a/aclocal.m4 b/aclocal.m4 index 8c22b223..18e2491c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1995-on dnl -dnl $Id: aclocal.m4,v 1.562 2011/07/17 00:38:58 tom Exp $ +dnl $Id: aclocal.m4,v 1.563 2011/07/17 18:55:21 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -2805,7 +2805,7 @@ AC_SUBST(LDFLAGS_STATIC) AC_SUBST(LDFLAGS_SHARED) ]) dnl --------------------------------------------------------------------------- -dnl CF_LD_RPATH_OPT version: 4 updated: 2011/06/04 20:09:13 +dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41 dnl --------------- dnl For the given system and compiler, find the compiler flags to pass to the dnl loader to use the "rpath" feature. @@ -2829,7 +2829,7 @@ linux*|gnu*|k*bsd*-gnu) #(vi openbsd[[2-9]].*|mirbsd*) #(vi LD_RPATH_OPT="-Wl,-rpath," ;; -freebsd*) #(vi +dragonfly*|freebsd*) #(vi LD_RPATH_OPT="-rpath " ;; netbsd*) #(vi @@ -5118,7 +5118,7 @@ CF_VERBOSE(...checked $1 [$]$1) AC_SUBST(EXTRA_LDFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 67 updated: 2011/07/02 15:36:04 +dnl CF_SHARED_OPTS version: 68 updated: 2011/07/17 14:48:41 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -5304,7 +5304,7 @@ CF_EOF MK_SHARED_LIB='${LD} -Bshareable -o $[@]' test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel ;; - freebsd*) #(vi + dragonfly*|freebsd*) #(vi CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" diff --git a/configure b/configure index c93c4901..bfc628e2 100755 --- a/configure +++ b/configure @@ -5547,7 +5547,7 @@ linux*|gnu*|k*bsd*-gnu) #(vi openbsd[2-9].*|mirbsd*) #(vi LD_RPATH_OPT="-Wl,-rpath," ;; -freebsd*) #(vi +dragonfly*|freebsd*) #(vi LD_RPATH_OPT="-rpath " ;; netbsd*) #(vi @@ -5859,7 +5859,7 @@ echo "${ECHO_T}$cf_cv_ldflags_search_paths_first" >&6 MK_SHARED_LIB='${LD} -Bshareable -o $@' test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel ;; - freebsd*) #(vi + dragonfly*|freebsd*) #(vi CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)" diff --git a/dist.mk b/dist.mk index f5c7c716..583fe1a2 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.825 2011/07/16 14:59:49 tom Exp $ +# $Id: dist.mk,v 1.826 2011/07/17 18:43:33 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 = 20110716 +NCURSES_PATCH = 20110723 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/misc/terminfo.src b/misc/terminfo.src index 8780ae45..a2885fc8 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src @@ -6,8 +6,8 @@ # Report bugs and new terminal descriptions to # bug-ncurses@gnu.org # -# $Revision: 1.392 $ -# $Date: 2011/07/16 20:24:43 $ +# $Revision: 1.393 $ +# $Date: 2011/07/21 09:29:09 $ # # The original header is preserved below for reference. It is noted that there # is a "newer" version which differs in some cosmetic details (but actually @@ -5099,10 +5099,10 @@ sun-il|Sun Microsystems console with working insert-line, kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, kf2=\E[225z, kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, khome=\E[214z, - knp=\E[222z, kopt=\E[194z, kpp=\E[216z, kres=\E[193z, - kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, rs2=\E[s, - sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, smso=\E[7m, - u8=\E[1t, u9=\E[11t, + kich1=\E[247z, knp=\E[222z, kopt=\E[194z, kpp=\E[216z, + kres=\E[193z, kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, + rs2=\E[s, sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, + smso=\E[7m, u8=\E[1t, u9=\E[11t, # On some versions of CGSIX framebuffer firmware (SparcStation 5), / # flake out on the last line. Unfortunately, without them the terminal has no # way to scroll. @@ -5170,7 +5170,7 @@ sun-color|Sun Microsystems Workstation console with color support (IA systems), setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - use=sun, + smso=\E[1m, use=sun, #### Iris consoles # @@ -22423,4 +22423,8 @@ v3220|LANPAR Vision II model 3220/3221/3222, # * add linux2.2, linux2.6, linux3.0 entries to give context for E3 -TD # * add SI/SO change to linux2.6 entry (Debian #515609) -TD # +# 2011-07-21 +# * add kich1 to sun (Yuri Pankov) +# * use bold rather than reverse for smso in sun-color (Yuri Pankov). +# ######## SHANTIH! SHANTIH! SHANTIH! diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c index 50d580ec..f0d2006b 100644 --- a/ncurses/base/lib_color.c +++ b/ncurses/base/lib_color.c @@ -45,7 +45,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_color.c,v 1.101 2011/05/28 21:57:59 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.103 2011/07/23 22:00:34 tom Exp $") #ifdef USE_TERM_DRIVER #define CanChange InfoOf(SP_PARM).canchange @@ -331,6 +331,13 @@ NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0) default_bg(NCURSES_SP_ARG), NCURSES_SP_NAME(_nc_outch)); } +#if !NCURSES_EXT_COLORS + /* + * Without ext-colors, we cannot represent more than 256 color pairs. + */ + if (maxpairs > 256) + maxpairs = 256; +#endif if (maxpairs > 0 && maxcolors > 0) { SP_PARM->_pair_limit = maxpairs; diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c index a0da44de..faedb58c 100644 --- a/ncurses/tinfo/captoinfo.c +++ b/ncurses/tinfo/captoinfo.c @@ -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 * @@ -93,7 +93,7 @@ #include #include -MODULE_ID("$Id: captoinfo.c,v 1.58 2010/12/04 20:08:19 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.64 2011/07/23 20:36:28 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -469,73 +469,9 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized) break; } break; -#ifdef REVISIBILIZE - case '\\': - dp = save_char(dp, *s++); - dp = save_char(dp, *s++); - break; - case '\n': - dp = save_string(dp, "\\n"); - s++; - break; - case '\t': - dp = save_string(dp, "\\t"); - s++; - break; - case '\r': - dp = save_string(dp, "\\r"); - s++; - break; - case '\200': - dp = save_string(dp, "\\0"); - s++; - break; - case '\f': - dp = save_string(dp, "\\f"); - s++; - break; - case '\b': - dp = save_string(dp, "\\b"); - s++; - break; - case ' ': - dp = save_string(dp, "\\s"); - s++; - break; - case '^': - dp = save_string(dp, "\\^"); - s++; - break; - case ':': - dp = save_string(dp, "\\:"); - s++; - break; - case ',': - dp = save_string(dp, "\\,"); - s++; - break; - default: - if (*s == '\033') { - dp = save_string(dp, "\\E"); - s++; - } else if (*s > 0 && *s < 32) { - dp = save_char(dp, '^'); - dp = save_char(dp, *s + '@'); - s++; - } else if (*s <= 0 || *s >= 127) { - dp = save_char(dp, '\\'); - dp = save_char(dp, ((*s & 0300) >> 6) + '0'); - dp = save_char(dp, ((*s & 0070) >> 3) + '0'); - dp = save_char(dp, (*s & 0007) + '0'); - s++; - } else - dp = save_char(dp, *s++); - break; -#else default: dp = save_char(dp, *s++); break; -#endif } } @@ -640,12 +576,14 @@ save_tc_inequality(char *bufptr, int c1, int c2) NCURSES_EXPORT(char *) _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameterized) { + int strict_bsd = 1; /* FIXME - consider making this an option */ int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; const char *padding; const char *trimmed = 0; int in0, in1, in2; char ch1 = 0, ch2 = 0; char *bufptr = init_string(); + char octal[4]; int len; bool syntax_error = FALSE; @@ -685,8 +623,61 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz } else if (str[1] == ',') { bufptr = save_char(bufptr, *++str); } else { + int xx1, xx2; + bufptr = save_char(bufptr, *str++); - bufptr = save_char(bufptr, *str); + xx1 = *str; + if (strict_bsd) { + if (isdigit(UChar(xx1))) { + int pad = 0; + + if (!isdigit(UChar(str[1]))) + pad = 2; + else if (str[1] && !isdigit(UChar(str[2]))) + pad = 1; + + /* + * Test for "\0", "\00" or "\000" and transform those + * into "\200". + */ + if (xx1 == '0' + && ((pad == 2) || (str[1] == '0')) + && ((pad >= 1) || (str[2] == '0'))) { + xx2 = '2'; + } else { + xx2 = '0'; + pad = 0; /* FIXME - optionally pad to 3 digits */ + } + while (pad-- > 0) { + bufptr = save_char(bufptr, xx2); + xx2 = '0'; + } + } else if (strchr("E\\:nrtbf", xx1) == 0) { + /* + * Note: termcap documentation claims that ":" must be + * escaped as "\072", however the documentation is + * incorrect - read the code. + */ + switch (xx1) { + case 'l': + xx1 = 'n'; + break; + case 's': + bufptr = save_char(bufptr, '0'); + bufptr = save_char(bufptr, '4'); + xx1 = '0'; + break; + default: + /* should not happen, but handle this anyway */ + sprintf(octal, "%03o", UChar(xx1)); + bufptr = save_char(bufptr, octal[0]); + bufptr = save_char(bufptr, octal[1]); + xx1 = octal[2]; + continue; + } + } + } + bufptr = save_char(bufptr, xx1); } } else if (str[0] == '$' && str[1] == '<') { /* discard padding */ str += 2; @@ -772,8 +763,25 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz case '8': case '9': bufptr = save_char(bufptr, '%'); - while (isdigit(UChar(*str))) - bufptr = save_char(bufptr, *str++); + ch1 = 0; + ch2 = 0; + while (isdigit(UChar(*str))) { + ch2 = ch1; + ch1 = *str++; + if (strict_bsd) { + if (ch1 > '3') + return 0; + } else { + bufptr = save_char(bufptr, ch1); + } + } + if (strict_bsd) { + if (ch2 != 0 && ch2 != '0') + return 0; + if (ch1 < '2') + ch1 = 'd'; + bufptr = save_char(bufptr, ch1); + } if (strchr("doxX.", *str)) { if (*str != 'd') /* termcap doesn't have octal, hex */ return 0; @@ -794,6 +802,8 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz * termcap notation. */ case 's': + if (strict_bsd) + return 0; bufptr = save_string(bufptr, "%s"); break; diff --git a/ncurses/widechar/lib_cchar.c b/ncurses/widechar/lib_cchar.c index 67b1aa43..0a1fe82f 100644 --- a/ncurses/widechar/lib_cchar.c +++ b/ncurses/widechar/lib_cchar.c @@ -35,7 +35,7 @@ #include -MODULE_ID("$Id: lib_cchar.c,v 1.22 2011/05/28 21:15:43 tom Exp $") +MODULE_ID("$Id: lib_cchar.c,v 1.23 2011/07/23 21:31:51 David.Benjamin Exp $") /* * The SuSv2 description leaves some room for interpretation. We'll assume wch @@ -80,7 +80,7 @@ setcchar(cchar_t *wcval, memset(wcval, 0, sizeof(*wcval)); if (len != 0) { - SetAttr(*wcval, attrs | (attr_t) ColorPair(color_pair)); + SetAttr(*wcval, attrs); SetPair(CHDEREF(wcval), color_pair); memcpy(&wcval->chars, wch, len * sizeof(wchar_t)); TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len, -- 2.44.0