-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.2855 2017/06/10 22:10:46 tom Exp $
+-- $Id: NEWS,v 1.2859 2017/06/17 21:53:35 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.
+20170617
+ + fill in some places where TERMTYPE2 vs TERMTYPE was not used
+ (report by Allen Hewes).
+ + use ExitTerminfo() internally in error-exits for ncurses' setupterm
+ to help with leak checking.
+ + use ExitProgram() in error-exit from initscr() to help with leak
+ checking.
+ + review test-programs, adding checks for cases where the terminal
+ cannot be initialized.
+
20170610
+ add option "-xp" to picsmap.c, to use init_extended_pair().
+ make simple performance fixes for picsmap.c
-5:0:9 6.0 20170610
+5:0:9 6.0 20170617
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.1167 2017/06/10 10:38:18 tom Exp $
+# $Id: dist.mk,v 1.1168 2017/06/17 18:17:23 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 = 6
NCURSES_MINOR = 0
-NCURSES_PATCH = 20170610
+NCURSES_PATCH = 20170617
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
#include <sys/termio.h> /* needed for ISC */
#endif
-MODULE_ID("$Id: lib_initscr.c,v 1.42 2017/03/28 21:14:01 tom Exp $")
+MODULE_ID("$Id: lib_initscr.c,v 1.43 2017/06/17 18:42:45 tom Exp $")
NCURSES_EXPORT(WINDOW *)
initscr(void)
#endif
if (newterm(name, stdout, stdin) == 0) {
fprintf(stderr, "Error opening terminal: %s.\n", name);
- exit(EXIT_FAILURE);
+ ExitProgram(EXIT_FAILURE);
}
/* def_shell_mode - done in newterm/_nc_setupscreen */
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mouse.c,v 1.174 2017/06/10 23:27:20 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.175 2017/06/17 22:05:15 tom Exp $")
#include <tic.h>
/* OS/2 VIO */
#if USE_EMX_MOUSE
if (!sp->_emxmouse_thread
- && strstr(TerminalOf(sp)->type.term_names, "xterm") == 0
+ && strstr(SP_TERMTYPE term_names, "xterm") == 0
&& key_mouse) {
int handles[2];
/* we know how to recognize mouse events under "xterm" */
if (key_mouse != 0) {
if (!strcmp(key_mouse, xterm_kmous)
- || strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
+ || strstr(SP_TERMTYPE term_names, "xterm") != 0) {
init_xterm_mouse(sp);
}
- } else if (strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
+ } else if (strstr(SP_TERMTYPE term_names, "xterm") != 0) {
if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
init_xterm_mouse(sp);
}
#endif
-MODULE_ID("$Id: new_pair.c,v 1.10 2017/03/28 09:14:15 tom Exp $")
+MODULE_ID("$Id: new_pair.c,v 1.11 2017/06/17 18:43:16 tom Exp $")
#if USE_NEW_PAIR
if (next_len(sp, 0) != prev_len(sp, 0)) {
endwin();
- exit(1);
+ ExitProgram(EXIT_FAILURE);
}
}
#else
****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.573 2017/06/02 23:19:52 tom Exp $
+ * $Id: curses.priv.h,v 1.575 2017/06/17 22:21:08 tom Exp $
*
* curses.priv.h
*
#define TerminalType(tp) (tp)->type
#endif
+#ifdef CUR
+#undef CUR
+#define CUR TerminalType(cur_term).
+#endif
+
/*
* Reduce dependency on cur_term global by using terminfo data from SCREEN's
* pointer to this data.
#undef CUR
#endif
-#define SP_TERMTYPE TerminalOf(sp)->type.
+#define SP_TERMTYPE TerminalType(TerminalOf(sp)).
#include <term_entry.h>
#define getcwd(buf,len) getwd(buf)
#endif
+#define save_ttytype(termp) \
+ if (TerminalType(termp).term_names != 0) { \
+ _nc_STRNCPY(ttytype, \
+ TerminalType(termp).term_names, \
+ NAMESIZE - 1); \
+ ttytype[NAMESIZE - 1] = '\0'; \
+ }
+
/* charable.c */
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(bool) _nc_is_charable(wchar_t);
extern NCURSES_EXPORT(int) _nc_ripoffline(int, int(*)(WINDOW*, int));
/* lib_setup.c */
+#if NO_LEAKS
+#define ExitTerminfo(code) _nc_free_tinfo(code)
+#else
+#define ExitTerminfo(code) exit(code)
+#endif
+
#define SETUP_FAIL ERR
+
#define ret_error(code, fmt, arg) if (errret) {\
*errret = code;\
returnCode(SETUP_FAIL);\
} else {\
fprintf(stderr, fmt, arg);\
- exit(EXIT_FAILURE);\
+ ExitTerminfo(EXIT_FAILURE);\
}
#define ret_error1(code, fmt, arg) ret_error(code, "'%s': " fmt, arg)
returnCode(SETUP_FAIL);\
} else {\
fprintf(stderr, msg);\
- exit(EXIT_FAILURE);\
+ ExitTerminfo(EXIT_FAILURE);\
}
/* lib_tstp.c */
#include <curses.priv.h>
#include <termcap.h> /* ospeed */
-MODULE_ID("$Id: lib_cur_term.c,v 1.40 2017/04/15 21:35:08 tom Exp $")
+MODULE_ID("$Id: lib_cur_term.c,v 1.41 2017/06/17 22:21:35 tom Exp $")
#undef CUR
#define CUR TerminalType(termp).
}
#endif
#if !USE_REENTRANT
-#define MY_SIZE (size_t) (NAMESIZE - 1)
- _nc_STRNCPY(ttytype, TerminalType(termp).term_names, MY_SIZE);
- ttytype[MY_SIZE] = '\0';
+ save_ttytype(termp);
#endif
}
_nc_unlock_global(curses);
#include <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.178 2017/04/11 23:51:32 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.182 2017/06/17 22:21:50 tom Exp $")
/****************************************************************************
*
if (CURRENT_SCREEN) {
TERMINAL *termp = TerminalOf(CURRENT_SCREEN);
if (termp != 0) {
- result = termp->type.term_names;
+ result = TerminalType(termp).term_names;
}
}
#else
if (cur_term != 0) {
- result = cur_term->type.term_names;
+ result = TerminalType(cur_term).term_names;
}
#endif
return result;
&& termp->Filedes == Filedes
&& termp->_termname != 0
&& !strcmp(termp->_termname, tname)
- && _nc_name_match(termp->type.term_names, tname, "|")) {
+ && _nc_name_match(TerminalType(termp).term_names, tname, "|")) {
T(("reusing existing terminal information and mode-settings"));
code = OK;
#ifdef USE_TERM_DRIVER
termp->Filedes = (short) Filedes;
termp->_termname = strdup(tname);
} else {
+ _nc_free_termtype2(&TerminalType(termp));
+ free(my_tcb);
ret_error0(errret ? *errret : TGETENT_ERR,
"Could not find any driver to handle this terminal.\n");
}
if (status != TGETENT_YES) {
del_curterm(termp);
if (status == TGETENT_ERR) {
+ _nc_free_termtype2(&TerminalType(termp));
ret_error0(status, "terminals database is inaccessible\n");
} else if (status == TGETENT_NO) {
+ _nc_free_termtype2(&TerminalType(termp));
ret_error1(status, "unknown terminal type.\n", tname);
}
}
_nc_export_termtype2(&termp->type, &TerminalType(termp));
#endif
#if !USE_REENTRANT
-#define MY_SIZE (size_t) (NAMESIZE - 1)
- _nc_STRNCPY(ttytype, termp->type.term_names, MY_SIZE);
- ttytype[MY_SIZE] = '\0';
+ save_ttytype(termp);
#endif
termp->Filedes = (short) Filedes;
# endif
#endif
-MODULE_ID("$Id: tinfo_driver.c,v 1.51 2017/04/14 08:19:49 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.54 2017/06/17 22:22:03 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
if (status != TGETENT_YES) {
NCURSES_SP_NAME(del_curterm) (NCURSES_SP_ARGx termp);
if (status == TGETENT_ERR) {
+ _nc_free_termtype2(&TerminalType(termp));
ret_error0(status, "terminals database is inaccessible\n");
} else if (status == TGETENT_NO) {
+ _nc_free_termtype2(&TerminalType(termp));
ret_error1(status, "unknown terminal type.\n", tname);
}
}
_nc_export_termtype2(&termp->type, &TerminalType(termp));
#endif
#if !USE_REENTRANT
-#define MY_SIZE (size_t) NAMESIZE - 1
- _nc_STRNCPY(ttytype, termp->type.term_names, MY_SIZE);
- ttytype[MY_SIZE] = '\0';
+ save_ttytype(termp);
#endif
if (command_character)
if ((VALID_STRING(cursor_address)
|| (VALID_STRING(cursor_down) && VALID_STRING(cursor_home)))
&& VALID_STRING(clear_screen)) {
+ _nc_free_termtype2(&TerminalType(termp));
ret_error1(TGETENT_YES, "terminal is not really generic.\n", tname);
} else {
+ _nc_free_termtype2(&TerminalType(termp));
ret_error1(TGETENT_NO, "I need something more specific.\n", tname);
}
}
if (hard_copy) {
+ _nc_free_termtype2(&TerminalType(termp));
ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", tname);
}
if (sp != 0) {
if (key_mouse != 0) {
if (!strcmp(key_mouse, xterm_kmous)
- || strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
+ || strstr(SP_TERMTYPE term_names, "xterm") != 0) {
init_xterm_mouse(sp);
}
- } else if (strstr(TerminalOf(sp)->type.term_names, "xterm") != 0) {
+ } else if (strstr(SP_TERMTYPE term_names, "xterm") != 0) {
if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
init_xterm_mouse(sp);
}
-ncurses6 (6.0+20170610) unstable; urgency=low
+ncurses6 (6.0+20170617) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 10 Jun 2017 06:38:19 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Jun 2017 14:17:23 -0400
ncurses6 (5.9-20131005) unstable; urgency=low
-ncurses6 (6.0+20170610) unstable; urgency=low
+ncurses6 (6.0+20170617) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 10 Jun 2017 06:38:19 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Jun 2017 14:17:23 -0400
ncurses6 (5.9-20131005) unstable; urgency=low
-ncurses6 (6.0+20170610) unstable; urgency=low
+ncurses6 (6.0+20170617) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 10 Jun 2017 06:38:19 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Jun 2017 14:17:23 -0400
ncurses6 (5.9-20120608) unstable; urgency=low
-; $Id: mingw-ncurses.nsi,v 1.215 2017/06/10 10:38:18 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.216 2017/06/17 18:17:23 tom Exp $\r
\r
; TODO add examples\r
; TODO bump ABI to 6\r
!define VERSION_MAJOR "6"\r
!define VERSION_MINOR "0"\r
!define VERSION_YYYY "2017"\r
-!define VERSION_MMDD "0610"\r
+!define VERSION_MMDD "0617"\r
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
\r
!define MY_ABI "5"\r
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 6.0
-Release: 20170610
+Release: 20170617
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 6.0
-Release: 20170610
+Release: 20170617
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
* v2.0 featuring strict ANSI/POSIX conformance, November 1993.
* v2.1 with ncurses mouse support, September 1995
*
- * $Id: bs.c,v 1.67 2017/05/14 00:27:05 tom Exp $
+ * $Id: bs.c,v 1.68 2017/06/17 18:45:40 tom Exp $
*/
#include <test.priv.h>
srand((unsigned) (time(0L) + getpid())); /* Kick the random number generator */
CATCHALL(uninitgame);
+ (void) initscr();
if ((tmpname = getlogin()) != 0 &&
(your_name = strdup(tmpname)) != 0) {
your_name = strdup(dftname);
}
- (void) initscr();
keypad(stdscr, TRUE);
(void) def_prog_mode();
(void) nonl();
/****************************************************************************
- * Copyright (c) 2005-2010,2016 Free Software Foundation, Inc. *
+ * Copyright (c) 2005-2016,2017 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 *
* authorization. *
****************************************************************************/
/*
- * $Id: demo_altkeys.c,v 1.10 2016/09/04 20:17:42 tom Exp $
+ * $Id: demo_altkeys.c,v 1.11 2017/06/17 18:33:03 tom Exp $
*
* Demonstrate the define_key() function.
* Thomas Dickey - 2005/10/22
unlink(MY_LOGFILE);
- newterm(0, stdout, stdin);
+ if (newterm(0, stdout, stdin) == 0) {
+ fprintf(stderr, "Cannot initialize terminal\n");
+ ExitProgram(EXIT_FAILURE);
+ }
(void) cbreak(); /* take input chars one at a time, no wait for \n */
(void) noecho(); /* don't echo input */
* authorization. *
****************************************************************************/
/*
- * $Id: demo_new_pair.c,v 1.13 2017/04/15 17:36:00 tom Exp $
+ * $Id: demo_new_pair.c,v 1.14 2017/06/17 19:48:45 tom Exp $
*
* Demonstrate the alloc_pair() function.
*/
fprintf(stderr, "cannot open terminal for output\n");
ExitProgram(EXIT_FAILURE);
}
- if (newterm(NULL, output, stdin) == 0)
- usage();
+ if (newterm(NULL, output, stdin) == 0) {
+ fprintf(stderr, "Cannot initialize terminal\n");
+ ExitProgram(EXIT_FAILURE);
+ }
(void) cbreak(); /* read chars without wait for \n */
(void) noecho(); /* don't echo input */
update_modes();
/****************************************************************************
- * Copyright (c) 2007-2009,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2013,2017 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 *
/*
* Author: Thomas E. Dickey - 2007
*
- * $Id: dots_mvcur.c,v 1.10 2013/09/28 22:44:18 tom Exp $
+ * $Id: dots_mvcur.c,v 1.11 2017/06/17 18:25:30 tom Exp $
*
* A simple demo of the terminfo interface, and mvcur.
*/
CATCHALL(onsig);
srand((unsigned) time(0));
- sp = newterm((char *) 0, stdout, stdin);
+ if ((sp = newterm((char *) 0, stdout, stdin)) == 0) {
+ fprintf(stderr, "Cannot initialize terminal\n");
+ ExitProgram(EXIT_FAILURE);
+ }
outs(clear_screen);
outs(cursor_home);
outs(cursor_invisible);
/****************************************************************************
- * Copyright (c) 1998-2014,2016 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2016,2017 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 *
/*
* Author: Thomas E. Dickey 1998
*
- * $Id: filter.c,v 1.28 2016/09/10 21:23:23 tom Exp $
+ * $Id: filter.c,v 1.29 2017/06/17 18:16:39 tom Exp $
*
* An example of the 'filter()' function in ncurses, this program prompts
* for commands and executes them (like a command shell). It illustrates
if (i_option) {
initscr();
} else {
- (void) newterm((char *) 0, stdout, stdin);
+ if (newterm((char *) 0, stdout, stdin) == 0) {
+ fprintf(stderr, "cannot initialize terminal\n");
+ ExitProgram(EXIT_FAILURE);
+ }
}
#ifdef NCURSES_VERSION
if (a_option) {
/****************************************************************************
- * Copyright (c) 2006,2016 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2016,2017 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 *
/*
* Author: Thomas E. Dickey, 2006
*
- * $Id: foldkeys.c,v 1.5 2016/09/04 20:49:06 tom Exp $
+ * $Id: foldkeys.c,v 1.6 2017/06/17 19:36:33 tom Exp $
*
* Demonstrate a method for altering key definitions at runtime.
*
struct timeval current, previous;
#endif
+ if (newterm(0, stdout, stdin) == 0) {
+ fprintf(stderr, "Cannot initialize terminal\n");
+ ExitProgram(EXIT_FAILURE);
+ }
+
unlink(MY_LOGFILE);
- newterm(0, stdout, stdin);
(void) cbreak(); /* take input chars one at a time, no wait for \n */
(void) noecho(); /* don't echo input */
* authorization. *
****************************************************************************/
/*
- * $Id: list_keys.c,v 1.19 2017/04/08 22:57:26 tom Exp $
+ * $Id: list_keys.c,v 1.20 2017/06/17 21:11:25 tom Exp $
*
* Author: Thomas E Dickey
*
{
int width = 0;
char buffer[10];
- NCURSES_CONST char *value = tigetstr(name);
+ NCURSES_CONST char *value = tigetstr((NCURSES_CONST char *) name);
if (show && t_opt)
fputc('"', stdout);
****************************************************************************/
/*
- * $Id: sp_tinfo.c,v 1.19 2017/05/13 23:19:04 tom Exp $
+ * $Id: sp_tinfo.c,v 1.21 2017/06/17 21:19:25 tom Exp $
*
* TOTO: add option for non-sp-funcs interface
*/
tgetent_sp(result->sp, temp, name);
free(temp);
} else {
- setupterm(name, fileno(output), &error);
+ setupterm((NCURSES_CONST char *) name, fileno(output), &error);
}
result->term = cur_term;
}
}
+#define TC_PARMS data->sp, (NCURSES_CONST char *)tc
+#define TI_PARMS data->sp, (NCURSES_CONST char *)ti
+
static void
show_cap_flag(MYDATA * data, const char *ti, const char *tc)
{
const char *name = (opt_t ? tc : ti);
show_flag(data, name, (opt_t
- ? tgetflag_sp(data->sp, tc)
- : tigetflag_sp(data->sp, ti)));
+ ? tgetflag_sp(TC_PARMS)
+ : tigetflag_sp(TI_PARMS)));
}
static void
{
const char *name = (opt_t ? tc : ti);
show_number(data, name, (opt_t
- ? tgetnum_sp(data->sp, tc)
- : tigetnum_sp(data->sp, ti)));
+ ? tgetnum_sp(TC_PARMS)
+ : tigetnum_sp(TI_PARMS)));
}
static void
char tcapjunk[1024];
char *tcap_ptr = tcapjunk;
show_string(data, name, (opt_t
- ? tgetstr_sp(data->sp, tc, &tcap_ptr)
- : tigetstr_sp(data->sp, ti)));
+ ? tgetstr_sp(TC_PARMS, &tcap_ptr)
+ : tigetstr_sp(TI_PARMS)));
}
static void