]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.9 - patch 20120721
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 22 Jul 2012 00:50:03 +0000 (00:50 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 22 Jul 2012 00:50:03 +0000 (00:50 +0000)
+ improved form_request_by_name() and menu_request_by_name().
+ eliminate two fixed-size buffers in toe.c
+ extend use_tioctl() to have expected behavior when use_env(FALSE) and
  use_tioctl(TRUE) are called.
+ modify ncurses test-program, adding -E and -T options to demonstrate
  use_env() versus use_tioctl().

13 files changed:
NEWS
dist.mk
form/frm_driver.c
form/frm_req_name.c
man/curs_util.3x
menu/m_req_name.c
ncurses/base/lib_mouse.c
ncurses/tinfo/lib_setup.c
ncurses/tinfo/tinfo_driver.c
package/debian/changelog
package/ncurses.spec
progs/toe.c
test/ncurses.c

diff --git a/NEWS b/NEWS
index 68dfa623c8783e0c10613f82316b065a3d1f5cd4..585aa61be00c5ed988bb3072ec5755037fd72c83 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1927 2012/07/14 23:02:40 tom Exp $
+-- $Id: NEWS,v 1.1931 2012/07/21 23:24:40 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,14 @@ 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.
 
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20120721
+       + improved form_request_by_name() and menu_request_by_name().
+       + eliminate two fixed-size buffers in toe.c
+       + extend use_tioctl() to have expected behavior when use_env(FALSE) and
+         use_tioctl(TRUE) are called.
+       + modify ncurses test-program, adding -E and -T options to demonstrate
+         use_env() versus use_tioctl().
+
 20120714
        + add use_tioctl() function (adapted from patch by Werner Fink,
          Novell #769788):
 20120714
        + add use_tioctl() function (adapted from patch by Werner Fink,
          Novell #769788):
diff --git a/dist.mk b/dist.mk
index ffd6bf9f06c4ae5409452ca47352f62f898ad0bb..abef7d87db532f1c8e44e96e8fb7afae559f359f 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.882 2012/07/14 17:09:16 tom Exp $
+# $Id: dist.mk,v 1.883 2012/07/21 16:14:00 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
 # 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
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 5
 NCURSES_MINOR = 9
-NCURSES_PATCH = 20120714
+NCURSES_PATCH = 20120721
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 5aac0060551ba656b6dfa54ec8ee152195e53673..6390bdeee37bcd7ef75ba39d3cc5dc8339523e16 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_driver.c,v 1.101 2012/06/10 00:28:04 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.102 2012/07/21 23:23:08 tom Exp $")
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
@@ -4229,7 +4229,10 @@ form_driver(FORM *form, int c)
 
   if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) &&
       ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c))
 
   if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) &&
       ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c))
-    BI = &(bindings[c - MIN_FORM_COMMAND]);
+    {
+      TR(TRACE_CALLS, ("form_request %s", form_request_name(c)));
+      BI = &(bindings[c - MIN_FORM_COMMAND]);
+    }
 
   if (BI)
     {
 
   if (BI)
     {
@@ -4256,9 +4259,13 @@ form_driver(FORM *form, int c)
          Generic_Method fct = Generic_Methods[method];
 
          if (fct)
          Generic_Method fct = Generic_Methods[method];
 
          if (fct)
-           res = fct(BI->cmd, form);
+           {
+             res = fct(BI->cmd, form);
+           }
          else
          else
-           res = (BI->cmd) (form);
+           {
+             res = (BI->cmd) (form);
+           }
        }
     }
 #ifdef NCURSES_MOUSE_VERSION
        }
     }
 #ifdef NCURSES_MOUSE_VERSION
index 99abd7e3c1d9742538775306aa99caf750c55e42..c24db1a8a9241ca5c066efad136df67da64a5a9c 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 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            *
  *                                                                          *
  * 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 @@
 
 #include "form.priv.h"
 
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_req_name.c,v 1.17 2009/10/10 16:17:01 tom Exp $")
+MODULE_ID("$Id: frm_req_name.c,v 1.18 2012/07/21 23:17:23 tom Exp $")
 
 static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
 {
 
 static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
 {
@@ -144,23 +144,26 @@ form_request_by_name(const char *str)
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
-  unsigned int i = 0;
-  char buf[16];
+  size_t i = 0;
+  char buf[16];                        /* longest name is 10 chars */
 
   T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str)));
 
 
   T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str)));
 
-  if (str)
+  if (str != 0 && (i = strlen(str)) != 0)
     {
     {
-      strncpy(buf, str, sizeof(buf));
-      while ((i < sizeof(buf)) && (buf[i] != '\0'))
+      if (i > sizeof(buf) - 2)
+       i = sizeof(buf) - 2;
+      memcpy(buf, str, i);
+      buf[i] = '\0';
+
+      for (i = 0; buf[i] != '\0'; ++i)
        {
          buf[i] = (char)toupper(UChar(buf[i]));
        {
          buf[i] = (char)toupper(UChar(buf[i]));
-         i++;
        }
 
       for (i = 0; i < A_SIZE; i++)
        {
        }
 
       for (i = 0; i < A_SIZE; i++)
        {
-         if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
+         if (strcmp(request_names[i], buf) == 0)
            returnCode(MIN_FORM_COMMAND + (int)i);
        }
     }
            returnCode(MIN_FORM_COMMAND + (int)i);
        }
     }
index 566a43036243896c04df538b4e94785840a5454d..31411319d61b60e63b1da61a350a3634d8258951 100644 (file)
@@ -1,3 +1,4 @@
+'\" t
 .\"***************************************************************************
 .\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
 .\"***************************************************************************
 .\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
 .\"                                                                          *
@@ -26,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_util.3x,v 1.35 2012/07/15 00:23:52 tom Exp $
+.\" $Id: curs_util.3x,v 1.36 2012/07/21 18:51:10 tom Exp $
 .TH curs_util 3X ""
 .de bP
 .IP \(bu 4
 .TH curs_util 3X ""
 .de bP
 .IP \(bu 4
@@ -136,14 +137,15 @@ when determining the screen size.
 Normally ncurses looks first at the terminal database for the screen size.
 .IP
 If \fBuse_env\fP was called with \fBFALSE\fP for parameter,
 Normally ncurses looks first at the terminal database for the screen size.
 .IP
 If \fBuse_env\fP was called with \fBFALSE\fP for parameter,
-it stops here.
+it stops here unless
+If \fBuse_tioctl\fP was also called with \fBTRUE\fP for parameter.
 .bP
 Then it asks for the screen size via operating system calls.
 If successful,
 it overrides the values from the terminal database.
 .bP
 .bP
 Then it asks for the screen size via operating system calls.
 If successful,
 it overrides the values from the terminal database.
 .bP
-Finally, ncurses examines the
-\fBLINES\fR or \fBCOLUMNS\fR environment variables,
+Finally (unless \fBuse_env\fP was called with \fBFALSE\fP parameter),
+ncurses examines the \fBLINES\fR or \fBCOLUMNS\fR environment variables,
 using a value in those to override the results
 from the operating system or terminal database.
 .IP
 using a value in those to override the results
 from the operating system or terminal database.
 .IP
@@ -166,6 +168,30 @@ or from the terminal database.
 ncurses re-fetches the value of the environment variables so that
 it is still the environment variables which set the screen size.
 .PP
 ncurses re-fetches the value of the environment variables so that
 it is still the environment variables which set the screen size.
 .PP
+The \fBuse_env\fP and \fBuse_tioctl\fP routines combine as
+summarized here:
+.TS
+center tab(/);
+l l l
+_ _ _
+lw7 lw7 lw40.
+\fIuse_env\fR/\fIuse_tioctl\fR/\fISummary\fR
+TRUE/FALSE/T{
+This is the default behavior.
+ncurses uses operating system calls
+unless overridden by $LINES or $COLUMNS environment variables.
+T}
+TRUE/TRUE/T{
+ncurses updates $LINES and $COLUMNS based on operating system calls.
+T}
+FALSE/TRUE/T{
+ncurses ignores $LINES and $COLUMNS, uses operating system calls to obtain size.
+T}
+FALSE/FALSE/T{
+ncurses relies on the terminal database to determine size.
+T}
+.TE
+.PP
 The \fBputwin\fR routine writes all data associated with window \fIwin\fR into
 the file to which \fIfilep\fR points.  This information can be later retrieved
 using the \fBgetwin\fR function.
 The \fBputwin\fR routine writes all data associated with window \fIwin\fR into
 the file to which \fIfilep\fR points.  This information can be later retrieved
 using the \fBgetwin\fR function.
index cad87580207128346ed1a30d07ea9cf6229c68d0..e5f2888ed6f2d7e6a6e1e3a3ad3b7d3f569de437 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2012 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            *
  *                                                                          *
  * 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 @@
 
 #include "menu.priv.h"
 
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_req_name.c,v 1.21 2009/10/10 16:17:23 tom Exp $")
+MODULE_ID("$Id: m_req_name.c,v 1.22 2012/07/21 23:27:32 tom Exp $")
 
 static const char *request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1] =
 {
 
 static const char *request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1] =
 {
@@ -99,23 +99,26 @@ menu_request_by_name(const char *str)
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
-  unsigned int i = 0;
+  size_t i = 0;
   char buf[16];
 
   T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str)));
 
   char buf[16];
 
   T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str)));
 
-  if (str)
+  if (str != 0 && (i = strlen(str)) != 0)
     {
     {
-      strncpy(buf, str, sizeof(buf));
-      while ((i < sizeof(buf)) && (buf[i] != '\0'))
+      if (i > sizeof(buf) - 2)
+       i = sizeof(buf) - 2;
+      memcpy(buf, str, i);
+      buf[i] = '\0';
+
+      for (i = 0; buf[i] != '\0'; ++i)
        {
          buf[i] = (char)toupper(UChar(buf[i]));
        {
          buf[i] = (char)toupper(UChar(buf[i]));
-         i++;
        }
 
       for (i = 0; i < A_SIZE; i++)
        {
        }
 
       for (i = 0; i < A_SIZE; i++)
        {
-         if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
+         if (strcmp(request_names[i], buf) == 0)
            returnCode(MIN_MENU_COMMAND + (int)i);
        }
     }
            returnCode(MIN_MENU_COMMAND + (int)i);
        }
     }
index f4ad054d7ebef61af8c20b18f7bf49f2c7c52e56..6f62120904a0824f80e959bc18ba905631f03f28 100644 (file)
@@ -84,7 +84,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_mouse.c,v 1.138 2012/02/29 10:38:46 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.139 2012/07/21 23:30:50 tom Exp $")
 
 #include <tic.h>
 
 
 #include <tic.h>
 
@@ -225,7 +225,7 @@ write_event(SCREEN *sp, int down, int button, int x, int y)
     char buf[6];
     unsigned long ignore;
 
     char buf[6];
     unsigned long ignore;
 
-    strncpy(buf, key_mouse, 3);        /* should be "\033[M" */
+    strcpy(buf, "\033[M");     /* should be the same as key_mouse */
     buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
     buf[4] = ' ' + x - LEFT_COL + 1;
     buf[5] = ' ' + y - TOP_ROW + 1;
     buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
     buf[4] = ' ' + x - LEFT_COL + 1;
     buf[5] = ' ' + y - TOP_ROW + 1;
index ff5857b3730990d33e767d4df9cc8e5aa44eace6..eb0bffb1654a6c0dc0325469d674f197cac63615 100644 (file)
@@ -48,7 +48,7 @@
 #include <locale.h>
 #endif
 
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.147 2012/07/14 23:59:26 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.148 2012/07/21 18:05:41 tom Exp $")
 
 /****************************************************************************
  *
 
 /****************************************************************************
  *
@@ -304,7 +304,7 @@ _nc_get_screensize(SCREEN *sp,
     *linep = (int) lines;
     *colp = (int) columns;
 
     *linep = (int) lines;
     *colp = (int) columns;
 
-    if (_nc_prescreen.use_env) {
+    if (_nc_prescreen.use_env || _nc_prescreen.use_tioctl) {
        int value;
 
 #ifdef __EMX__
        int value;
 
 #ifdef __EMX__
@@ -340,33 +340,35 @@ _nc_get_screensize(SCREEN *sp,
        }
 #endif /* HAVE_SIZECHANGE */
 
        }
 #endif /* HAVE_SIZECHANGE */
 
-       if (_nc_prescreen.use_tioctl) {
+       if (_nc_prescreen.use_env) {
+           if (_nc_prescreen.use_tioctl) {
+               /*
+                * If environment variables are used, update them.
+                */
+               if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
+                   _nc_setenv_num("LINES", *linep);
+               }
+               if (_nc_getenv_num("COLUMNS") > 0) {
+                   _nc_setenv_num("COLUMNS", *colp);
+               }
+           }
+
            /*
            /*
-            * If environment variables are used, update them.
+            * Finally, look for environment variables.
+            *
+            * Solaris lets users override either dimension with an environment
+            * variable.
             */
             */
-           if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
-               _nc_setenv_num("LINES", *linep);
+           if ((value = _nc_getenv_num("LINES")) > 0) {
+               *linep = value;
+               T(("screen size: environment LINES = %d", *linep));
            }
            }
-           if (_nc_getenv_num("COLUMNS") > 0) {
-               _nc_setenv_num("COLUMNS", *colp);
+           if ((value = _nc_getenv_num("COLUMNS")) > 0) {
+               *colp = value;
+               T(("screen size: environment COLUMNS = %d", *colp));
            }
        }
 
            }
        }
 
-       /*
-        * Finally, look for environment variables.
-        *
-        * Solaris lets users override either dimension with an environment
-        * variable.
-        */
-       if ((value = _nc_getenv_num("LINES")) > 0) {
-           *linep = value;
-           T(("screen size: environment LINES = %d", *linep));
-       }
-       if ((value = _nc_getenv_num("COLUMNS")) > 0) {
-           *colp = value;
-           T(("screen size: environment COLUMNS = %d", *colp));
-       }
-
        /* if we can't get dynamic info about the size, use static */
        if (*linep <= 0) {
            *linep = (int) lines;
        /* if we can't get dynamic info about the size, use static */
        if (*linep <= 0) {
            *linep = (int) lines;
index 6d49c000271ae1615bfa5720dab49e3fed59ca20..ac4f5ad9457935946219adccd97ee845b2bba943 100644 (file)
@@ -50,7 +50,7 @@
 # endif
 #endif
 
 # endif
 #endif
 
-MODULE_ID("$Id: tinfo_driver.c,v 1.21 2012/07/15 00:20:43 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.23 2012/07/22 00:45:34 tom Exp $")
 
 /*
  * SCO defines TIOCGSIZE and the corresponding struct.  Other systems (SunOS,
 
 /*
  * SCO defines TIOCGSIZE and the corresponding struct.  Other systems (SunOS,
@@ -361,7 +361,7 @@ drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp)
     *linep = (int) lines;
     *colp = (int) columns;
 
     *linep = (int) lines;
     *colp = (int) columns;
 
-    if (useEnv) {
+    if (useEnv || useTioctl) {
        int value;
 
 #ifdef __EMX__
        int value;
 
 #ifdef __EMX__
@@ -400,35 +400,35 @@ drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp)
        }
 #endif /* HAVE_SIZECHANGE */
 
        }
 #endif /* HAVE_SIZECHANGE */
 
-       if (useTioctl) {
-           char buf[128];
+       if (useEnv) {
+           if (useTioctl) {
+               /*
+                * If environment variables are used, update them.
+                */
+               if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
+                   _nc_setenv_num("LINES", *linep);
+               }
+               if (_nc_getenv_num("COLUMNS") > 0) {
+                   _nc_setenv_num("COLUMNS", *colp);
+               }
+           }
 
            /*
 
            /*
-            * If environment variables are used, update them.
+            * Finally, look for environment variables.
+            *
+            * Solaris lets users override either dimension with an environment
+            * variable.
             */
             */
-           if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
-               _nc_setenv_num("LINES", *linep);
+           if ((value = _nc_getenv_num("LINES")) > 0) {
+               *linep = value;
+               T(("screen size: environment LINES = %d", *linep));
            }
            }
-           if (_nc_getenv_num("COLUMNS") > 0) {
-               _nc_setenv_num("COLUMNS", *colp);
+           if ((value = _nc_getenv_num("COLUMNS")) > 0) {
+               *colp = value;
+               T(("screen size: environment COLUMNS = %d", *colp));
            }
        }
 
            }
        }
 
-       /*
-        * Finally, look for environment variables.
-        *
-        * Solaris lets users override either dimension with an environment
-        * variable.
-        */
-       if ((value = _nc_getenv_num("LINES")) > 0) {
-           *linep = value;
-           T(("screen size: environment LINES = %d", *linep));
-       }
-       if ((value = _nc_getenv_num("COLUMNS")) > 0) {
-           *colp = value;
-           T(("screen size: environment COLUMNS = %d", *colp));
-       }
-
        /* if we can't get dynamic info about the size, use static */
        if (*linep <= 0) {
            *linep = (int) lines;
        /* if we can't get dynamic info about the size, use static */
        if (*linep <= 0) {
            *linep = (int) lines;
index 856fd9e1baa651c53001a49de84990abca242871..104dffd6e8666891e349e3117b3b0a4ed6acb858 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20120714) unstable; urgency=low
+ncurses6 (5.9-20120721) unstable; urgency=low
 
   * latest weekly patch
 
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 14 Jul 2012 19:07:27 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 21 Jul 2012 19:33:07 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 8d9fd3befbcc5a0ace092a0b56508839d886b6b1..7c4f8d1baa970154274de50fc878e96d9f94e165 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Release: 5.9
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Release: 5.9
-Version: 20120714
+Version: 20120721
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{release}-%{version}.tgz
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{release}-%{version}.tgz
index f1b836fe277123bc31895a57e03d7a766bcbfdd7..4924d2c1cccf32da6266f958d49c028aae7965a8 100644 (file)
@@ -44,7 +44,7 @@
 #include <hashed_db.h>
 #endif
 
 #include <hashed_db.h>
 #endif
 
-MODULE_ID("$Id: toe.c,v 1.67 2012/03/10 23:22:21 tom Exp $")
+MODULE_ID("$Id: toe.c,v 1.68 2012/07/21 22:55:59 tom Exp $")
 
 #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, ".."))
 
 
 #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, ".."))
 
@@ -345,6 +345,21 @@ show_termcap(int db_index, int db_limit, char *buffer, DescHook hook)
 }
 #endif
 
 }
 #endif
 
+#if USE_DATABASE
+static char *
+copy_entryname(DIRENT * src)
+{
+    size_t len = NAMLEN(src);
+    char *result = malloc(len + 1);
+    if (result == 0)
+       failed("copy entryname");
+    memcpy(result, src->d_name, len);
+    result[len] = '\0';
+
+    return result;
+}
+#endif
+
 static int
 typelist(int eargc, char *eargv[],
         bool verbosity,
 static int
 typelist(int eargc, char *eargv[],
         bool verbosity,
@@ -372,24 +387,28 @@ typelist(int eargc, char *eargv[],
                (void) printf("#\n#%s:\n#\n", eargv[i]);
 
            while ((subdir = readdir(termdir)) != 0) {
                (void) printf("#\n#%s:\n#\n", eargv[i]);
 
            while ((subdir = readdir(termdir)) != 0) {
-               size_t len = NAMLEN(subdir);
-               size_t cwd_len = len + strlen(eargv[i]) + 3;
-               char name_1[PATH_MAX];
+               size_t cwd_len;
+               char *name_1;
                DIR *entrydir;
                DIRENT *entry;
 
                DIR *entrydir;
                DIRENT *entry;
 
+               name_1 = copy_entryname(subdir);
+               if (isDotname(name_1)) {
+                   free(name_1);
+                   continue;
+               }
+
+               cwd_len = NAMLEN(subdir) + strlen(eargv[i]) + 3;
                cwd_buf = typeRealloc(char, cwd_len, cwd_buf);
                if (cwd_buf == 0)
                    failed("realloc cwd_buf");
 
                assert(cwd_buf != 0);
 
                cwd_buf = typeRealloc(char, cwd_len, cwd_buf);
                if (cwd_buf == 0)
                    failed("realloc cwd_buf");
 
                assert(cwd_buf != 0);
 
-               strncpy(name_1, subdir->d_name, len)[len] = '\0';
-               if (isDotname(name_1))
-                   continue;
-
                _nc_SPRINTF(cwd_buf, _nc_SLIMIT(cwd_len)
                _nc_SPRINTF(cwd_buf, _nc_SLIMIT(cwd_len)
-                           "%s/%.*s/", eargv[i], (int) len, name_1);
+                           "%s/%s/", eargv[i], name_1);
+               free(name_1);
+
                if (chdir(cwd_buf) != 0)
                    continue;
 
                if (chdir(cwd_buf) != 0)
                    continue;
 
@@ -399,15 +418,16 @@ typelist(int eargc, char *eargv[],
                    continue;
                }
                while ((entry = readdir(entrydir)) != 0) {
                    continue;
                }
                while ((entry = readdir(entrydir)) != 0) {
-                   char name_2[PATH_MAX];
+                   char *name_2;
                    TERMTYPE lterm;
                    char *cn;
                    int status;
 
                    TERMTYPE lterm;
                    char *cn;
                    int status;
 
-                   len = NAMLEN(entry);
-                   strncpy(name_2, entry->d_name, len)[len] = '\0';
-                   if (isDotname(name_2) || !_nc_is_file_path(name_2))
+                   name_2 = copy_entryname(entry);
+                   if (isDotname(name_2) || !_nc_is_file_path(name_2)) {
+                       free(name_2);
                        continue;
                        continue;
+                   }
 
                    status = _nc_read_file_entry(name_2, &lterm);
                    if (status <= 0) {
 
                    status = _nc_read_file_entry(name_2, &lterm);
                    if (status <= 0) {
@@ -415,6 +435,7 @@ typelist(int eargc, char *eargv[],
                        (void) fprintf(stderr,
                                       "%s: couldn't open terminfo file %s.\n",
                                       _nc_progname, name_2);
                        (void) fprintf(stderr,
                                       "%s: couldn't open terminfo file %s.\n",
                                       _nc_progname, name_2);
+                       free(name_2);
                        return (EXIT_FAILURE);
                    }
 
                        return (EXIT_FAILURE);
                    }
 
@@ -425,6 +446,7 @@ typelist(int eargc, char *eargv[],
                        hook(i, eargc, cn, &lterm);
                    }
                    _nc_free_termtype(&lterm);
                        hook(i, eargc, cn, &lterm);
                    }
                    _nc_free_termtype(&lterm);
+                   free(name_2);
                }
                closedir(entrydir);
            }
                }
                closedir(entrydir);
            }
index e17a4649f57286c6d5eb654921dff685715b797d..f5c78dbe717cdb603dcdf63dfb85ba6ea49f1232 100644 (file)
@@ -40,7 +40,7 @@ AUTHOR
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.372 2012/07/07 18:09:38 tom Exp $
+$Id: ncurses.c,v 1.373 2012/07/21 17:40:21 tom Exp $
 
 ***************************************************************************/
 
 
 ***************************************************************************/
 
@@ -6497,6 +6497,7 @@ usage(void)
        ,"  -a f,b   set default-colors (assumed white-on-black)"
        ,"  -d       use default-colors if terminal supports them"
 #endif
        ,"  -a f,b   set default-colors (assumed white-on-black)"
        ,"  -d       use default-colors if terminal supports them"
 #endif
+       ,"  -E       call use_env(FALSE) to ignore $LINES and $COLUMNS"
 #if USE_SOFTKEYS
        ,"  -e fmt   specify format for soft-keys test (e)"
 #endif
 #if USE_SOFTKEYS
        ,"  -e fmt   specify format for soft-keys test (e)"
 #endif
@@ -6509,6 +6510,9 @@ usage(void)
 #if USE_LIBPANEL
        ,"  -s msec  specify nominal time for panel-demo (default: 1, to hold)"
 #endif
 #if USE_LIBPANEL
        ,"  -s msec  specify nominal time for panel-demo (default: 1, to hold)"
 #endif
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714)
+       ,"  -T       call use_tioctl(TRUE) to allow SIGWINCH to override environment"
+#endif
 #ifdef TRACE
        ,"  -t mask  specify default trace-level (may toggle with ^T)"
 #endif
 #ifdef TRACE
        ,"  -t mask  specify default trace-level (may toggle with ^T)"
 #endif
@@ -6695,7 +6699,7 @@ main(int argc, char *argv[])
 
     setlocale(LC_ALL, "");
 
 
     setlocale(LC_ALL, "");
 
-    while ((c = getopt(argc, argv, "a:de:fhmp:s:t:")) != -1) {
+    while ((c = getopt(argc, argv, "a:dEe:fhmp:s:Tt:")) != -1) {
        switch (c) {
 #ifdef NCURSES_VERSION
        case 'a':
        switch (c) {
 #ifdef NCURSES_VERSION
        case 'a':
@@ -6706,6 +6710,9 @@ main(int argc, char *argv[])
            default_colors = TRUE;
            break;
 #endif
            default_colors = TRUE;
            break;
 #endif
+       case 'E':
+           use_env(FALSE);
+           break;
        case 'e':
            my_e_param = atoi(optarg);
 #ifdef NCURSES_VERSION
        case 'e':
            my_e_param = atoi(optarg);
 #ifdef NCURSES_VERSION
@@ -6735,6 +6742,11 @@ main(int argc, char *argv[])
            nap_msec = (int) atol(optarg);
            break;
 #endif
            nap_msec = (int) atol(optarg);
            break;
 #endif
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714)
+       case 'T':
+           use_tioctl(TRUE);
+           break;
+#endif
 #ifdef TRACE
        case 't':
            save_trace = (unsigned) strtol(optarg, 0, 0);
 #ifdef TRACE
        case 't':
            save_trace = (unsigned) strtol(optarg, 0, 0);