summaryrefslogtreecommitdiff
path: root/ncurses
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-12-27 17:22:58 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-12-27 17:22:58 -0800
commitb9a293aaa19b4aade08a5ba915472266f2da6dbc (patch)
tree50087c558750e694c95f367c26aa36b6911b3947 /ncurses
parentf014f6dc9a6b2af174c54bc1b49324a5d5f767eb (diff)
downloadncurses-b9a293aaa19b4aade08a5ba915472266f2da6dbc.tar.gz
ncurses-b9a293aaa19b4aade08a5ba915472266f2da6dbc.tar.bz2
ncurses-b9a293aaa19b4aade08a5ba915472266f2da6dbc.zip
apply ncurses-5.9-20110723.patch
Diffstat (limited to 'ncurses')
-rw-r--r--ncurses/base/lib_color.c9
-rw-r--r--ncurses/tinfo/captoinfo.c148
-rw-r--r--ncurses/widechar/lib_cchar.c4
3 files changed, 89 insertions, 72 deletions
diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c
index 50d580e..f0d2006 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 a0da44d..faedb58 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 <ctype.h>
#include <tic.h>
-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 67b1aa4..0a1fe82 100644
--- a/ncurses/widechar/lib_cchar.c
+++ b/ncurses/widechar/lib_cchar.c
@@ -35,7 +35,7 @@
#include <curses.priv.h>
-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,