apply ncurses-5.9-20120407.patch
authorAnas Nashif <anas.nashif@intel.com>
Fri, 28 Dec 2012 01:23:02 +0000 (17:23 -0800)
committerAnas Nashif <anas.nashif@intel.com>
Fri, 28 Dec 2012 01:23:02 +0000 (17:23 -0800)
NEWS
dist.mk
misc/gen_edit.sh
misc/terminfo.src
ncurses/tinfo/comp_scan.c
progs/infocmp.c

diff --git a/NEWS b/NEWS
index 386cb39..06f1c82 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1885 2012/03/31 23:10:23 tom Exp $
+-- $Id: NEWS,v 1.1891 2012/04/07 19:17:36 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,22 @@ 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.
 
+20120407
+       + fix an inconsistency between tic/infocmp "-x" option; tic omits all
+         non-standard capabilities, while infocmp was ignoring only the user
+         definable capabilities.
+       + improve special case in tic parsing of description to allow it to be
+         followed by terminfo capabilities.  Previously the description had to
+         be the last field on an input line to allow tic to distinguish
+         between termcap and terminfo format while still allowing commas to be
+         embedded in the description.
+       + correct variable name in gen_edit.sh which broke configurability of
+         the --with-xterm-kbs option.
+       + revert 2011-07-16 change to "linux" alias, return to "linux2.2" -TD
+       + further amend 20110910 change, providing for configure-script
+         override of the "linux" terminfo entry to install and changing the
+         default for that to "linux2.2" (Debian #665959).
+
 20120331
        + update Ada95/configure to use CF_DISABLE_ECHO (cf: 20120317).
        + correct order of use-clauses in st-256color -TD
diff --git a/dist.mk b/dist.mk
index 0fe0052..bebac9a 100644 (file)
--- 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.866 2012/03/31 15:04:31 tom Exp $
+# $Id: dist.mk,v 1.868 2012/04/07 15:24:19 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 = 20120331
+NCURSES_PATCH = 20120407
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 4955711..3460afc 100755 (executable)
@@ -29,7 +29,7 @@
 #
 # Author: Thomas E. Dickey
 #
-# $Id: gen_edit.sh,v 1.4 2012/02/11 16:30:03 tom Exp $
+# $Id: gen_edit.sh,v 1.5 2012/04/01 15:04:37 tom Exp $
 # Generate a sed-script for converting the terminfo.src to the form which will
 # be installed.
 #
 #      The leaf directory names (lib, tabset, terminfo)
 #
 
-: ${datadir=@datadir@}
-: ${xterm_new=@WHICH_XTERM@}
-: ${xterm_kbs=@XTERM_KBS@}
+linux_dft=linux2.2
+
+: ${datadir=/usr/share}
+: ${WHICH_LINUX=$linux_dft}
+: ${WHICH_XTERM=xterm-new}
+: ${XTERM_KBS=BS}
 
 # If we're not installing into /usr/share/, we'll have to adjust the location
 # of the tabset files in terminfo.src (which are in a parallel directory).
@@ -50,7 +53,8 @@ s%/usr/share/tabset%$TABSET%g
 EOF
 fi
 
-if test "$xterm_new" != "xterm-new" ; then
+if test "$WHICH_XTERM" != "xterm-new" ; then
+echo "** using $WHICH_XTERM terminal description for XTerm entry" >&2
 cat <<EOF
 /^# This is xterm for ncurses/,/^$/{
        s/use=xterm-new,/use=$WHICH_XTERM,/
@@ -58,7 +62,8 @@ cat <<EOF
 EOF
 fi
 
-if test "$xterm_kbs" != "BS" ; then
+if test "$XTERM_KBS" != "BS" ; then
+echo "** using DEL for XTerm backspace-key" >&2
 cat <<EOF
 /^xterm+kbs|fragment for backspace key/,/^#/{
        s/kbs=^H,/kbs=^?,/
@@ -68,24 +73,46 @@ fi
 
 # Work around incompatibities built into Linux console.  The 2.6 series added
 # a patch to fixup the SI/SO behavior, which is closer to vt100, but the older
-# kernels do not recognize those controls.
-system=`uname -s 2>/dev/null`
-if test "x$system" = xLinux
+# kernels do not recognize those controls.  All of the kernels recognize the
+# older flavor of rmacs/smacs, but beginning in the late 1990s, changes made
+# as part of implementing UTF-8 prevent using those for line-drawing when the
+# console is in UTF-8 mode.  Taking into account the fact that it took about
+# ten years to provide (and distribute) the 2.6 series' change for SI/SO, the
+# default remains "linux2.2".
+case x$WHICH_LINUX in #(vi
+xauto)
+       system=`uname -s 2>/dev/null`
+       if test "x$system" = xLinux
+       then
+               case x`uname -r` in
+               x1.*)
+                       WHICH_LINUX=linux-c
+                       ;;
+               x2.[0-4]*)
+                       WHICH_LINUX=linux2.2
+                       ;;
+               *)
+                       WHICH_LINUX=linux3.0
+                       ;;
+               esac
+       else
+               WHICH_LINUX=$linux_dft
+       fi
+       ;;
+xlinux*)
+       # allow specific setting
+       ;;
+*)
+       WHICH_LINUX=$linux_dft
+       ;;
+esac
+
+if test $WHICH_LINUX != $linux_dft
 then
-       case x`uname -r` in
-       x1.*)
-cat <<EOF
-/^# This is Linux console for ncurses/,/^$/{
-       s/use=linux3.0,/use=linux-c,/
-}
-EOF
-               ;;
-       x2.[0-4]*)
+echo "** using $WHICH_LINUX terminal description for Linux console" >&2
 cat <<EOF
 /^# This is Linux console for ncurses/,/^$/{
-       s/use=linux3.0,/use=linux2.2,/
+       s/use=$linux_dft,/use=$WHICH_LINUX,/
 }
 EOF
-               ;;
-       esac
 fi
index fe3dcd1..844ee56 100644 (file)
@@ -6,8 +6,8 @@
 # Report bugs and new terminal descriptions to
 #      bug-ncurses@gnu.org
 #
-#      $Revision: 1.427 $
-#      $Date: 2012/03/27 09:57:34 $
+#      $Revision: 1.428 $
+#      $Date: 2012/04/01 13:58:39 $
 #
 # 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
@@ -942,6 +942,8 @@ linux2.2|linux 2.2.x console,
 #      http://lkml.indiana.edu/hypermail/linux/kernel/0602.2/0868.html
 # Using SI/SO has the drawback that it confuses screen.  SCS would work.
 # However, SCS is buggy (see comment in Debian #515609) -TD
+# Further, this breaks longstanding workarounds for Linux console's line
+# drawing (see Debian 665959) -TD
 linux2.6|linux 2.6.x console,
        rmacs=^O,
        sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;m%?%p9%t\016%e\017%;,
@@ -953,7 +955,7 @@ linux3.0|linux 3.0 kernels,
 
 # This is Linux console for ncurses.
 linux|linux console,
-       use=linux3.0,
+       use=linux2.2,
 
 # Subject: linux 2.6.26 vt back_color_erase
 # Changes to the Linux console driver broke bce model as reported in
@@ -22710,4 +22712,7 @@ v3220|LANPAR Vision II model 3220/3221/3222,
 # 2012-03-31
 #      * correct order of use-clauses in st-256color -TD
 #
+# 2012-04-01
+#      * revert 2011-07-16 change to "linux" alias, return to "linux2.2" -TD
+#
 ######## SHANTIH!  SHANTIH!  SHANTIH!
index a860c77..dea8259 100644 (file)
@@ -50,7 +50,7 @@
 #include <ctype.h>
 #include <tic.h>
 
-MODULE_ID("$Id: comp_scan.c,v 1.97 2012/03/24 22:24:19 tom Exp $")
+MODULE_ID("$Id: comp_scan.c,v 1.99 2012/04/01 20:37:08 tom Exp $")
 
 /*
  * Maximum length of string capability we'll accept before raising an error.
@@ -128,14 +128,19 @@ _nc_reset_input(FILE *fp, char *buf)
  *     Returns the final nonblank character on the current input buffer
  */
 static int
-last_char(void)
+last_char(int from_end)
 {
     size_t len = strlen(bufptr);
+    int result = 0;
+
     while (len--) {
-       if (!isspace(UChar(bufptr[len])))
-           return bufptr[len];
+       if (!isspace(UChar(bufptr[len]))) {
+           if (from_end < (int) len)
+               result = bufptr[(int) len - from_end];
+           break;
+       }
     }
-    return 0;
+    return result;
 }
 
 /*
@@ -341,13 +346,13 @@ _nc_get_token(bool silent)
 {
     static const char terminfo_punct[] = "@%&*!#";
 
-    char *after_list;
-    char *after_name;
+    char *after_name;          /* after primary name */
+    char *after_list;          /* after primary and alias list */
     char *numchk;
     char *tok_ptr;
     char *s;
     char numbuf[80];
-    int ch;
+    int ch, c0, c1;
     int dot_flag = FALSE;
     int type;
     long number;
@@ -460,7 +465,7 @@ _nc_get_token(bool silent)
                    after_list = tok_ptr;
                    if (after_name == 0)
                        after_name = tok_ptr;
-               } else if (ch == ':' && last_char() != ',') {
+               } else if (ch == ':' && last_char(0) != ',') {
                    _nc_syntax = SYN_TERMCAP;
                    separator = ':';
                    break;
@@ -474,12 +479,64 @@ _nc_get_token(bool silent)
                    if (after_name == 0)
                        break;
                    /*
-                    * If we see a comma, we assume this is terminfo unless we
-                    * subsequently run into a colon.  But we don't stop
-                    * looking for a colon until hitting a newline.  This
-                    * allows commas to be embedded in description fields of
-                    * either syntax.
+                    * We saw a comma, but are not entirely sure this is
+                    * terminfo format, since we can still be parsing the
+                    * description field (for either syntax).
+                    *
+                    * A properly formatted termcap line ends with either a
+                    * colon, or a backslash after a colon.  It is possible
+                    * to have a backslash in the middle of a capability, but
+                    * then there would be no leading whitespace on the next
+                    * line - something we want to discourage.
                     */
+                   c0 = last_char(0);
+                   c1 = last_char(1);
+                   if (c1 != ':' && c0 != '\\' && c0 != ':') {
+                       bool capability = FALSE;
+
+                       /*
+                        * Since it is not termcap, assume the line is terminfo
+                        * format.  However, the comma can be embedded in a
+                        * description field.  It also can be a separator
+                        * between a description field and a capability.
+                        *
+                        * Improve the guess by checking if the next word after
+                        * the comma does not look like a capability.  In that
+                        * case, extend the description past the comma.
+                        */
+                       for (s = bufptr; isspace(UChar(*s)); ++s) {
+                           ;
+                       }
+                       if (islower(UChar(*s))) {
+                           char *name = s;
+                           while (isalnum(UChar(*s))) {
+                               ++s;
+                           }
+                           if (*s == '#' || *s == '=' || *s == '@') {
+                               /*
+                                * Checking solely with syntax allows us to
+                                * support extended capabilities with string
+                                * values.
+                                */
+                               capability = TRUE;
+                           } else if (*s == ',') {
+                               c0 = *s;
+                               *s = '\0';
+                               /*
+                                * Otherwise, we can handle predefined boolean
+                                * capabilities, still aided by syntax.
+                                */
+                               if (_nc_find_entry(name,
+                                                  _nc_get_hash_table(FALSE))) {
+                                   capability = TRUE;
+                               }
+                               *s = c0;
+                           }
+                       }
+                       if (capability) {
+                           break;
+                       }
+                   }
                } else
                    ch = eat_escaped_newline(ch);
 
index 4f0323a..2e6f67a 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <dump_entry.h>
 
-MODULE_ID("$Id: infocmp.c,v 1.114 2012/03/11 00:10:57 tom Exp $")
+MODULE_ID("$Id: infocmp.c,v 1.115 2012/04/07 19:12:01 tom Exp $")
 
 #define L_CURL "{"
 #define R_CURL "}"
@@ -333,6 +333,21 @@ dump_string(char *val, char *buf)
     }
 }
 
+/*
+ * ncurses stores two types of non-standard capabilities:
+ * a) capabilities listed past the "STOP-HERE" comment in the Caps file. 
+ *    These are used in the terminfo source file to provide data for termcaps,
+ *    e.g., when there is no equivalent capability in terminfo, as well as for
+ *    widely-used non-standard capabilities.
+ * b) user-definable capabilities, via "tic -x".
+ *
+ * However, if "-x" is omitted from the tic command, both types of
+ * non-standard capability are not loaded into the terminfo database.  This
+ * macro is used for limit-checks against the symbols that tic uses to omit
+ * the two types of non-standard entry.
+ */
+#define check_user_definable(n,limit) if (!_nc_user_definable && (n) > (limit)) break
+
 static void
 compare_predicate(PredType type, PredIdx idx, const char *name)
 /* predicate function to use for entry difference reports */
@@ -346,6 +361,7 @@ compare_predicate(PredType type, PredIdx idx, const char *name)
 
     switch (type) {
     case CMP_BOOLEAN:
+       check_user_definable(idx, BOOLWRITE);
        b1 = e1->tterm.Booleans[idx];
        b2 = e2->tterm.Booleans[idx];
        switch (compare) {
@@ -371,6 +387,7 @@ compare_predicate(PredType type, PredIdx idx, const char *name)
        break;
 
     case CMP_NUMBER:
+       check_user_definable(idx, NUMWRITE);
        n1 = e1->tterm.Numbers[idx];
        n2 = e2->tterm.Numbers[idx];
        dump_numeric(n1, buf1);
@@ -394,6 +411,7 @@ compare_predicate(PredType type, PredIdx idx, const char *name)
        break;
 
     case CMP_STRING:
+       check_user_definable(idx, STRWRITE);
        s1 = e1->tterm.Strings[idx];
        s2 = e2->tterm.Strings[idx];
        switch (compare) {