+ fix an infinite recursion when adding a legacy-coding 8-bit value
using insch() (report by Clemens Ladisch).
+ free home-terminfo string in del_curterm() (patch by Dan Weber).
+ continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
12 files changed:
-- 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.1389 2009/05/23 22:48:27 tom Exp $
+-- $Id: NEWS,v 1.1392 2009/05/30 19:19:59 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
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.
+20090530
+ + fix an infinite recursion when adding a legacy-coding 8-bit value
+ using insch() (report by Clemens Ladisch).
+ + free home-terminfo string in del_curterm() (patch by Dan Weber).
+ + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
+
20090523
+ continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
20090523
+ continue integrating "sp-funcs" by Juergen Pfeifer (incomplete).
# 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.701 2009/05/23 18:08:28 tom Exp $
+# $Id: dist.mk,v 1.702 2009/05/30 13:36:52 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
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 7
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 7
-NCURSES_PATCH = 20090523
+NCURSES_PATCH = 20090530
# 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)
#define CUR SP_TERMTYPE
#endif
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_dft_fgbg.c,v 1.23 2009/05/23 23:04:15 tom Exp $")
+MODULE_ID("$Id: lib_dft_fgbg.c,v 1.24 2009/05/30 20:00:00 tom Exp $")
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
/*
* Modify the behavior of color-pair 0 so that the library doesn't assume that
T((T_CALLED("assume_default_colors(%p,%d,%d)"), SP_PARM, fg, bg));
#ifdef USE_TERM_DRIVER
T((T_CALLED("assume_default_colors(%p,%d,%d)"), SP_PARM, fg, bg));
#ifdef USE_TERM_DRIVER
- if (SP_PARM != 0)
- code = CallDriver_2(SP_PARM, defaultcolors, fg, bg);
+ if (sp != 0)
+ code = CallDriver_2(sp, defaultcolors, fg, bg);
#else
if ((orig_pair || orig_colors) && !initialize_pair) {
#else
if ((orig_pair || orig_colors) && !initialize_pair) {
-MODULE_ID("$Id: lib_getch.c,v 1.102 2009/04/18 20:32:33 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.103 2009/05/30 15:50:47 tom Exp $")
#include <fifo_defs.h>
#if USE_REENTRANT
#define GetEscdelay(sp) (sp)->_ESCDELAY
#include <fifo_defs.h>
#if USE_REENTRANT
#define GetEscdelay(sp) (sp)->_ESCDELAY
+NCURSES_EXPORT(int *)
+_nc_ptr_Escdelay(SCREEN *sp)
+{
+ return ptrEscdelay(sp);
+}
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(ESCDELAY) (void)
{
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(ESCDELAY) (void)
{
- return SP ? GetEscdelay(SP) : 1000;
+ return *_nc_ptr_Escdelay(CURRENT_SCREEN);
}
#else
#define GetEscdelay(sp) ESCDELAY
}
#else
#define GetEscdelay(sp) ESCDELAY
#include <curses.priv.h>
#include <ctype.h>
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_insch.c,v 1.27 2009/04/18 23:53:33 tom Exp $")
+MODULE_ID("$Id: lib_insch.c,v 1.29 2009/05/30 16:45:16 tom Exp $")
/*
* Insert the given character, updating the current location to simplify
* inserting a string.
*/
NCURSES_EXPORT(int)
/*
* Insert the given character, updating the current location to simplify
* inserting a string.
*/
NCURSES_EXPORT(int)
-_nc_insert_ch(WINDOW *win, chtype ch)
+_nc_insert_ch(SCREEN *sp, WINDOW *win, chtype ch)
{
int code = OK;
NCURSES_CH_T wch;
int count;
NCURSES_CONST char *s;
{
int code = OK;
NCURSES_CH_T wch;
int count;
NCURSES_CONST char *s;
-#if NCURSES_SP_FUNCS || USE_REENTRANT
- SCREEN *sp = _nc_screen_of(win);
-#endif
int tabsize =
#if USE_REENTRANT
sp->_TABSIZE
int tabsize =
#if USE_REENTRANT
sp->_TABSIZE
switch (ch) {
case '\t':
for (count = (tabsize - (win->_curx % tabsize)); count > 0; count--) {
switch (ch) {
case '\t':
for (count = (tabsize - (win->_curx % tabsize)); count > 0; count--) {
- if ((code = _nc_insert_ch(win, ' ')) != OK)
+ if ((code = _nc_insert_ch(sp, win, ' ')) != OK)
WINDOW_EXT(win, addch_used) == 0 &&
#endif
is8bits(ChCharOf(ch)) &&
WINDOW_EXT(win, addch_used) == 0 &&
#endif
is8bits(ChCharOf(ch)) &&
- isprint(ChCharOf(ch))) {
+ (isprint(ChCharOf(ch)) ||
+ (ChAttrOf(ch) & A_ALTCHARSET) ||
+ (sp != 0 && sp->_legacy_coding && !iscntrl(ChCharOf(ch))))) {
if (win->_curx <= win->_maxx) {
struct ldat *line = &(win->_line[win->_cury]);
NCURSES_CH_T *end = &(line->text[win->_curx]);
if (win->_curx <= win->_maxx) {
struct ldat *line = &(win->_line[win->_cury]);
NCURSES_CH_T *end = &(line->text[win->_curx]);
} else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) {
s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
while (*s != '\0') {
} else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) {
s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
while (*s != '\0') {
- code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s));
+ code = _nc_insert_ch(sp, win, ChAttrOf(ch) | UChar(*s));
if (code != OK)
break;
++s;
if (code != OK)
break;
++s;
/* handle EILSEQ */
if (is8bits(ch)) {
s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
/* handle EILSEQ */
if (is8bits(ch)) {
s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
- while (*s != '\0') {
- code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s));
- if (code != OK)
- break;
- ++s;
+ if (strlen(s) > 1) {
+ while (*s != '\0') {
+ code = _nc_insert_ch(sp, win,
+ ChAttrOf(ch) | UChar(*s));
+ if (code != OK)
+ break;
+ ++s;
+ }
+ } else {
+ code = ERR;
oy = win->_cury;
ox = win->_curx;
oy = win->_cury;
ox = win->_curx;
- code = _nc_insert_ch(win, c);
+ code = _nc_insert_ch(_nc_screen_of(win), win, c);
win->_curx = ox;
win->_cury = oy;
win->_curx = ox;
win->_cury = oy;
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2004 Free Software Foundation, Inc. *
+ * Copyright (c) 2004,2009 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 *
#include <curses.priv.h>
#include <ctype.h>
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_insnstr.c,v 1.1 2004/02/28 23:44:56 tom Exp $")
+MODULE_ID("$Id: lib_insnstr.c,v 1.2 2009/05/30 14:53:49 tom Exp $")
NCURSES_EXPORT(int)
winsnstr(WINDOW *win, const char *s, int n)
NCURSES_EXPORT(int)
winsnstr(WINDOW *win, const char *s, int n)
T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbufn(s, n), n));
if (win != 0 && str != 0) {
T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbufn(s, n), n));
if (win != 0 && str != 0) {
+ SCREEN *sp = _nc_screen_of(win);
+
oy = win->_cury;
ox = win->_curx;
for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) {
oy = win->_cury;
ox = win->_curx;
for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) {
- _nc_insert_ch(win, (chtype) UChar(*cp));
+ _nc_insert_ch(sp, win, (chtype) UChar(*cp));
}
win->_curx = ox;
win->_cury = oy;
}
win->_curx = ox;
win->_cury = oy;
- * $Id: curses.priv.h,v 1.417 2009/05/23 23:01:44 tom Exp $
+ * $Id: curses.priv.h,v 1.420 2009/05/30 15:53:46 tom Exp $
#define SET_SCREEN_PAIR(s,p) SetPair(SCREEN_ATTRS(s), p)
#if USE_REENTRANT
#define SET_SCREEN_PAIR(s,p) SetPair(SCREEN_ATTRS(s), p)
#if USE_REENTRANT
-NCURSES_EXPORT(int *) _nc_ptr_Lines (void);
-NCURSES_EXPORT(int *) _nc_ptr_Cols (void);
+
+NCURSES_EXPORT(int *) _nc_ptr_Lines (SCREEN *);
+NCURSES_EXPORT(int *) _nc_ptr_Cols (SCREEN *);
+NCURSES_EXPORT(int *) _nc_ptr_Tabsize (SCREEN *);
+NCURSES_EXPORT(int *) _nc_ptr_Escdelay (SCREEN *);
+
#define ptrLines(sp) (sp ? &(sp->_LINES) : &(_nc_prescreen._LINES))
#define ptrCols(sp) (sp ? &(sp->_COLS) : &(_nc_prescreen._COLS))
#define ptrLines(sp) (sp ? &(sp->_LINES) : &(_nc_prescreen._LINES))
#define ptrCols(sp) (sp ? &(sp->_COLS) : &(_nc_prescreen._COLS))
-#define SET_LINES(value) *_nc_ptr_Lines() = value
-#define SET_COLS(value) *_nc_ptr_Cols() = value
+#define ptrTabsize(sp) (sp ? &(sp->_TABSIZE) : &(_nc_prescreen._TABSIZE))
+#define ptrEscdelay(sp) (sp ? &(sp->_ESCDELAY) : &(_nc_prescreen._ESCDELAY))
+
+#define SET_LINES(value) *_nc_ptr_Lines(SP_PARM) = value
+#define SET_COLS(value) *_nc_ptr_Cols(SP_PARM) = value
+#define SET_TABSIZE(value) *_nc_ptr_Tabsize(SP_PARM) = value
+#define SET_ESCDELAY(value) *_nc_ptr_Escdelay(SP_PARM) = value
+
#define ptrLines(sp) &LINES
#define ptrCols(sp) &COLS
#define SET_LINES(value) LINES = value
#define SET_COLS(value) COLS = value
#define ptrLines(sp) &LINES
#define ptrCols(sp) &COLS
#define SET_LINES(value) LINES = value
#define SET_COLS(value) COLS = value
+#define SET_TABSIZE(value) TABSIZE = value
+#define SET_ESCDELAY(value) ESCDELAY = value
+
#endif
#define TR_MUTEX(data) _tracef("%s@%d: me:%08lX COUNT:%2u/%2d/%6d/%2d/%s%9u: " #data, \
#endif
#define TR_MUTEX(data) _tracef("%s@%d: me:%08lX COUNT:%2u/%2d/%6d/%2d/%s%9u: " #data, \
chtype *real_acs_map;
int _LINES;
int _COLS;
chtype *real_acs_map;
int _LINES;
int _COLS;
+ int _TABSIZE;
+ int _ESCDELAY;
TERMINAL *_cur_term;
#ifdef TRACE
long _outchars;
TERMINAL *_cur_term;
#ifdef TRACE
long _outchars;
extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, unsigned long *, int EVENTLIST_2nd(_nc_eventlist *));
/* lib_insch.c */
extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, unsigned long *, int EVENTLIST_2nd(_nc_eventlist *));
/* lib_insch.c */
-extern NCURSES_EXPORT(int) _nc_insert_ch(WINDOW *, chtype);
+extern NCURSES_EXPORT(int) _nc_insert_ch(SCREEN *, WINDOW *, chtype);
/* lib_mvcur.c */
#define INFINITY 1000000 /* cost: too high to use */
/* lib_mvcur.c */
#define INFINITY 1000000 /* cost: too high to use */
extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
+/* lib_set_term.c */
+extern NCURSES_EXPORT(int) _nc_ripoffline(int, int(*)(WINDOW*, int));
+
/* lib_tstp.c */
#if USE_SIGWINCH
extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *);
/* lib_tstp.c */
#if USE_SIGWINCH
extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *);
#define MAX_SKEY(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC)
#define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC)
#define MAX_SKEY(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_OLD : MAX_SKEY_PC)
#define MAX_SKEY_LEN(fmt) (SLK_STDFMT(fmt)? MAX_SKEY_LEN_OLD : MAX_SKEY_LEN_PC)
-extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int));
-
/*
* Common error messages
*/
/*
* Common error messages
*/
#include <term_entry.h> /* TTY, cur_term */
#include <termcap.h> /* ospeed */
#include <term_entry.h> /* TTY, cur_term */
#include <termcap.h> /* ospeed */
-MODULE_ID("$Id: lib_cur_term.c,v 1.21 2009/04/18 21:02:22 tom Exp $")
+MODULE_ID("$Id: lib_cur_term.c,v 1.22 2009/05/30 13:55:19 tom Exp $")
#undef CUR
#define CUR termp->type.
#undef CUR
#define CUR termp->type.
if (termp != 0) {
_nc_free_termtype(&(termp->type));
FreeIfNeeded(termp->_termname);
if (termp != 0) {
_nc_free_termtype(&(termp->type));
FreeIfNeeded(termp->_termname);
+#if USE_HOME_TERMINFO
+ if (_nc_globals.home_terminfo != 0)
+ FreeAndNull(_nc_globals.home_terminfo);
+#endif
free(termp);
if (termp == cur_term)
set_curterm(0);
free(termp);
if (termp == cur_term)
set_curterm(0);
/****************************************************************************
/****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2008,2009 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 *
-MODULE_ID("$Id: lib_data.c,v 1.52 2008/08/23 22:16:15 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.53 2009/05/30 15:59:25 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
/*
* OS/2's native linker complains if we don't initialize public data when
NULL, /* real_acs_map */
0, /* LINES */
0, /* COLS */
NULL, /* real_acs_map */
0, /* LINES */
0, /* COLS */
+ 8, /* TABSIZE */
+ 1000, /* ESCDELAY */
0, /* cur_term */
#ifdef TRACE
0L, /* _outchars */
0, /* cur_term */
#ifdef TRACE
0L, /* _outchars */
#include <term.h> /* lines, columns, cur_term */
#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_setup.c,v 1.114 2009/04/18 23:52:03 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.116 2009/05/30 20:39:21 tom Exp $")
/****************************************************************************
*
/****************************************************************************
*
return cur_term ? cur_term->type.term_names : empty;
}
NCURSES_EXPORT(int *)
return cur_term ? cur_term->type.term_names : empty;
}
NCURSES_EXPORT(int *)
+_nc_ptr_Lines(SCREEN *sp)
- return ptrLines(CURRENT_SCREEN);
}
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(LINES) (void)
{
}
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(LINES) (void)
{
- return *_nc_ptr_Lines();
+ return *_nc_ptr_Lines(CURRENT_SCREEN);
+_nc_ptr_Cols(SCREEN *sp)
- return ptrCols(CURRENT_SCREEN);
}
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(COLS) (void)
{
}
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(COLS) (void)
{
- return *_nc_ptr_Cols();
+ return *_nc_ptr_Cols(CURRENT_SCREEN);
+}
+NCURSES_EXPORT(int *)
+_nc_ptr_Tabsize(SCREEN *sp)
+{
+ return ptrTabsize(sp);
}
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(TABSIZE) (void)
{
}
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(TABSIZE) (void)
{
- return SP ? SP->_TABSIZE : 8;
+ return *_nc_ptr_Tabsize(CURRENT_SCREEN);
}
#else
NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = "";
NCURSES_EXPORT_VAR(int) LINES = 0;
NCURSES_EXPORT_VAR(int) COLS = 0;
}
#else
NCURSES_EXPORT_VAR(char) ttytype[NAMESIZE] = "";
NCURSES_EXPORT_VAR(int) LINES = 0;
NCURSES_EXPORT_VAR(int) COLS = 0;
-NCURSES_EXPORT_VAR(int) TABSIZE = 0;
+NCURSES_EXPORT_VAR(int) TABSIZE = 8;
#endif
#if NCURSES_EXT_FUNCS
#endif
#if NCURSES_EXT_FUNCS
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2002-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 2002-2005,2009 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 *
-MODULE_ID("$Id: lib_ins_wch.c,v 1.8 2005/12/03 20:24:19 tom Exp $")
+MODULE_ID("$Id: lib_ins_wch.c,v 1.9 2009/05/30 14:52:42 tom Exp $")
/*
* Insert the given character, updating the current location to simplify
/*
* Insert the given character, updating the current location to simplify
n = wcslen(wstr);
code = OK;
if (n > 0) {
n = wcslen(wstr);
code = OK;
if (n > 0) {
+ SCREEN *sp = _nc_screen_of(win);
+
oy = win->_cury;
ox = win->_curx;
for (cp = wstr; *cp && ((cp - wstr) < n); cp++) {
oy = win->_cury;
ox = win->_curx;
for (cp = wstr; *cp && ((cp - wstr) < n); cp++) {
code = _nc_insert_wch(win, &tmp_cchar);
} else {
/* tabs, other ASCII stuff */
code = _nc_insert_wch(win, &tmp_cchar);
} else {
/* tabs, other ASCII stuff */
- code = _nc_insert_ch(win, (chtype) (*cp));
+ code = _nc_insert_ch(sp, win, (chtype) (*cp));
/****************************************************************************
/****************************************************************************
- * Copyright (c) 2003-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2003-2008,2009 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 *
* authorization. *
****************************************************************************/
/*
* authorization. *
****************************************************************************/
/*
- * $Id: demo_forms.c,v 1.31 2008/12/20 19:23:00 tom Exp $
+ * $Id: demo_forms.c,v 1.32 2009/05/30 16:52:42 tom Exp $
*
* Demonstrate a variety of functions from the form library.
* Thomas Dickey - 2003/4/26
*
* Demonstrate a variety of functions from the form library.
* Thomas Dickey - 2003/4/26
- for (c = 0; f[c] != 0; c++)
+ for (c = 0; f[c] != 0; c++) {
+ void *ptr = field_userptr(f[c]);
+ free(ptr);