+ 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().
-- 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
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):
# 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
# 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)
#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
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)
{
Generic_Method fct = Generic_Methods[method];
if (fct)
- res = fct(BI->cmd, form);
+ {
+ res = fct(BI->cmd, form);
+ }
else
- res = (BI->cmd) (form);
+ {
+ res = (BI->cmd) (form);
+ }
}
}
#ifdef NCURSES_MOUSE_VERSION
/****************************************************************************
- * 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 *
#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] =
{
/* 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)));
- 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]));
- 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);
}
}
+'\" t
.\"***************************************************************************
.\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
.\" *
.\" 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
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
-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
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.
/****************************************************************************
- * 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 *
#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] =
{
/* 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)));
- 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]));
- 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);
}
}
#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>
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;
#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 $")
/****************************************************************************
*
*linep = (int) lines;
*colp = (int) columns;
- if (_nc_prescreen.use_env) {
+ if (_nc_prescreen.use_env || _nc_prescreen.use_tioctl) {
int value;
#ifdef __EMX__
}
#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;
# 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,
*linep = (int) lines;
*colp = (int) columns;
- if (useEnv) {
+ if (useEnv || useTioctl) {
int value;
#ifdef __EMX__
}
#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;
-ncurses6 (5.9-20120714) unstable; urgency=low
+ncurses6 (5.9-20120721) unstable; urgency=low
* 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
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
#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, ".."))
}
#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,
(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;
+ 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);
- strncpy(name_1, subdir->d_name, len)[len] = '\0';
- if (isDotname(name_1))
- continue;
-
_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;
continue;
}
while ((entry = readdir(entrydir)) != 0) {
- char name_2[PATH_MAX];
+ char *name_2;
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;
+ }
status = _nc_read_file_entry(name_2, <erm);
if (status <= 0) {
(void) fprintf(stderr,
"%s: couldn't open terminfo file %s.\n",
_nc_progname, name_2);
+ free(name_2);
return (EXIT_FAILURE);
}
hook(i, eargc, cn, <erm);
}
_nc_free_termtype(<erm);
+ free(name_2);
}
closedir(entrydir);
}
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 $
***************************************************************************/
," -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_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
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':
default_colors = TRUE;
break;
#endif
+ case 'E':
+ use_env(FALSE);
+ break;
case 'e':
my_e_param = atoi(optarg);
#ifdef NCURSES_VERSION
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);