aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2008-05-09 02:28:12 +0000
committerRong-En Fan <rafan@FreeBSD.org>2008-05-09 02:28:12 +0000
commitaa59d4d4c5dda7e1c6f9dc0cc6edc58992a525c7 (patch)
tree502fa0a691368fb8b60b62eef10b3f3332efe830 /contrib/ncurses/ncurses
parentd8977eaf361f5fdc1261c3f3524988f661ed926e (diff)
downloadsrc-aa59d4d4c5dda7e1c6f9dc0cc6edc58992a525c7.tar.gz
src-aa59d4d4c5dda7e1c6f9dc0cc6edc58992a525c7.zip
Import ncurses 5.6-20080503 snapshot onto the vender branchvendor/ncurses/5.6-20080503
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=178866 svn path=/vendor/ncurses/5.6-20080503/; revision=178868; tag=vendor/ncurses/5.6-20080503
Diffstat (limited to 'contrib/ncurses/ncurses')
-rw-r--r--contrib/ncurses/ncurses/base/lib_addch.c5
-rw-r--r--contrib/ncurses/ncurses/base/lib_bkgd.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_delwin.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_freeall.c8
-rw-r--r--contrib/ncurses/ncurses/base/lib_getch.c165
-rw-r--r--contrib/ncurses/ncurses/base/lib_initscr.c13
-rw-r--r--contrib/ncurses/ncurses/base/lib_newterm.c17
-rw-r--r--contrib/ncurses/ncurses/base/lib_newwin.c70
-rw-r--r--contrib/ncurses/ncurses/base/lib_overlay.c166
-rw-r--r--contrib/ncurses/ncurses/base/lib_restart.c6
-rw-r--r--contrib/ncurses/ncurses/base/lib_set_term.c162
-rw-r--r--contrib/ncurses/ncurses/base/lib_ungetch.c49
-rw-r--r--contrib/ncurses/ncurses/base/lib_window.c6
-rw-r--r--contrib/ncurses/ncurses/base/resizeterm.c16
-rw-r--r--contrib/ncurses/ncurses/base/use_window.c14
-rw-r--r--contrib/ncurses/ncurses/base/wresize.c6
-rw-r--r--contrib/ncurses/ncurses/curses.priv.h69
-rw-r--r--contrib/ncurses/ncurses/fifo_defs.h10
-rw-r--r--contrib/ncurses/ncurses/tinfo/init_keytry.c18
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_data.c52
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_napms.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_options.c20
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_setup.c37
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_ttyflags.c8
-rw-r--r--contrib/ncurses/ncurses/tinfo/use_screen.c8
-rw-r--r--contrib/ncurses/ncurses/trace/lib_trace.c16
-rw-r--r--contrib/ncurses/ncurses/tty/lib_tstp.c18
-rw-r--r--contrib/ncurses/ncurses/tty/lib_twait.c29
-rw-r--r--contrib/ncurses/ncurses/tty/tty_update.c8
29 files changed, 564 insertions, 450 deletions
diff --git a/contrib/ncurses/ncurses/base/lib_addch.c b/contrib/ncurses/ncurses/base/lib_addch.c
index 1ef6cc5803d3..17ba6e2bcd6c 100644
--- a/contrib/ncurses/ncurses/base/lib_addch.c
+++ b/contrib/ncurses/ncurses/base/lib_addch.c
@@ -36,7 +36,7 @@
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_addch.c,v 1.108 2008/02/03 18:50:27 tom Exp $")
+MODULE_ID("$Id: lib_addch.c,v 1.111 2008/03/29 18:48:02 tom Exp $")
static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
@@ -217,7 +217,9 @@ _nc_build_wch(WINDOW *win, ARG_CH_T ch)
buffer,
WINDOW_EXT(win, addch_used), &state)) > 0) {
attr_t attrs = AttrOf(CHDEREF(ch));
+ if_EXT_COLORS(int pair = GetPair(CHDEREF(ch)));
SetChar(CHDEREF(ch), result, attrs);
+ if_EXT_COLORS(SetPair(CHDEREF(ch), pair));
WINDOW_EXT(win, addch_used) = 0;
} else if (len == -1) {
/*
@@ -474,6 +476,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
while (*s) {
NCURSES_CH_T sch;
SetChar(sch, *s++, AttrOf(ch));
+ if_EXT_COLORS(SetPair(sch, GetPair(ch)));
if (waddch_literal(win, sch) == ERR)
return ERR;
}
diff --git a/contrib/ncurses/ncurses/base/lib_bkgd.c b/contrib/ncurses/ncurses/base/lib_bkgd.c
index e6a0cb000b15..c99e0c5fc3a8 100644
--- a/contrib/ncurses/ncurses/base/lib_bkgd.c
+++ b/contrib/ncurses/ncurses/base/lib_bkgd.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2008 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 *
@@ -36,7 +36,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_bkgd.c,v 1.35 2006/05/27 19:20:11 tom Exp $")
+MODULE_ID("$Id: lib_bkgd.c,v 1.36 2008/03/23 00:09:14 tom Exp $")
/*
* Set the window's background information.
@@ -70,7 +70,7 @@ wbkgrndset(WINDOW *win, const ARG_CH_T ch)
if (CharOf(CHDEREF(ch)) == L('\0')) {
SetChar(win->_nc_bkgd, BLANK_TEXT, AttrOf(CHDEREF(ch)));
- SetPair(win->_nc_bkgd, GetPair(CHDEREF(ch)));
+ if_EXT_COLORS(SetPair(win->_nc_bkgd, GetPair(CHDEREF(ch))));
} else {
win->_nc_bkgd = CHDEREF(ch);
}
diff --git a/contrib/ncurses/ncurses/base/lib_delwin.c b/contrib/ncurses/ncurses/base/lib_delwin.c
index fc68f9d68dee..ba5f180d5f3c 100644
--- a/contrib/ncurses/ncurses/base/lib_delwin.c
+++ b/contrib/ncurses/ncurses/base/lib_delwin.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2001,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -40,7 +40,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_delwin.c,v 1.15 2007/12/22 23:34:26 tom Exp $")
+MODULE_ID("$Id: lib_delwin.c,v 1.16 2008/05/03 14:13:51 tom Exp $")
static bool
cannot_delete(WINDOW *win)
@@ -48,7 +48,7 @@ cannot_delete(WINDOW *win)
WINDOWLIST *p;
bool result = TRUE;
- for (p = _nc_windows; p != 0; p = p->next) {
+ for (each_window(p)) {
if (&(p->win) == win) {
result = FALSE;
} else if ((p->win._flags & _SUBWIN) != 0
diff --git a/contrib/ncurses/ncurses/base/lib_freeall.c b/contrib/ncurses/ncurses/base/lib_freeall.c
index dbf0483f2401..4bb7ccc79995 100644
--- a/contrib/ncurses/ncurses/base/lib_freeall.c
+++ b/contrib/ncurses/ncurses/base/lib_freeall.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -40,7 +40,7 @@
extern int malloc_errfd; /* FIXME */
#endif
-MODULE_ID("$Id: lib_freeall.c,v 1.45 2007/12/22 23:29:37 tom Exp $")
+MODULE_ID("$Id: lib_freeall.c,v 1.46 2008/05/03 14:13:51 tom Exp $")
/*
* Free all ncurses data. This is used for testing only (there's no practical
@@ -67,10 +67,10 @@ _nc_freeall(void)
bool deleted = FALSE;
/* Delete only windows that're not a parent */
- for (p = _nc_windows; p != 0; p = p->next) {
+ for (each_window(p)) {
bool found = FALSE;
- for (q = _nc_windows; q != 0; q = q->next) {
+ for (each_window(q)) {
if ((p != q)
&& (q->win._flags & _SUBWIN)
&& (&(p->win) == q->win._parent)) {
diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c
index 11e8052a668c..d9f6b1795c77 100644
--- a/contrib/ncurses/ncurses/base/lib_getch.c
+++ b/contrib/ncurses/ncurses/base/lib_getch.c
@@ -41,17 +41,19 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_getch.c,v 1.82 2008/01/19 21:07:30 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.87 2008/05/03 22:42:10 tom Exp $")
#include <fifo_defs.h>
#if USE_REENTRANT
+#define GetEscdelay(sp) (sp)->_ESCDELAY
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(ESCDELAY) (void)
{
- return SP ? SP->_ESCDELAY : 1000;
+ return SP ? GetEscdelay(SP) : 1000;
}
#else
+#define GetEscdelay(sp) ESCDELAY
NCURSES_EXPORT_VAR(int)
ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */
#endif
@@ -84,20 +86,20 @@ set_escdelay(int value)
* Check for mouse activity, returning nonzero if we find any.
*/
static int
-check_mouse_activity(int delay EVENTLIST_2nd(_nc_eventlist * evl))
+check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl))
{
int rc;
#if USE_SYSMOUSE
- if ((SP->_mouse_type == M_SYSMOUSE)
- && (SP->_sysmouse_head < SP->_sysmouse_tail)) {
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)) {
return 2;
}
#endif
- rc = _nc_timed_wait(TWAIT_MASK, delay, (int *) 0 EVENTLIST_2nd(evl));
+ rc = _nc_timed_wait(sp, TWAIT_MASK, delay, (int *) 0 EVENTLIST_2nd(evl));
#if USE_SYSMOUSE
- if ((SP->_mouse_type == M_SYSMOUSE)
- && (SP->_sysmouse_head < SP->_sysmouse_tail)
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)
&& (rc == 0)
&& (errno == EINTR)) {
rc |= 2;
@@ -107,9 +109,9 @@ check_mouse_activity(int delay EVENTLIST_2nd(_nc_eventlist * evl))
}
static NCURSES_INLINE int
-fifo_peek(void)
+fifo_peek(SCREEN *sp)
{
- int ch = SP->_fifo[peek];
+ int ch = sp->_fifo[peek];
TR(TRACE_IEVENT, ("peeking at %d", peek));
p_inc();
@@ -117,10 +119,10 @@ fifo_peek(void)
}
static NCURSES_INLINE int
-fifo_pull(void)
+fifo_pull(SCREEN *sp)
{
int ch;
- ch = SP->_fifo[head];
+ ch = sp->_fifo[head];
TR(TRACE_IEVENT, ("pulling %s from %d", _tracechar(ch), head));
if (peek == head) {
@@ -131,7 +133,7 @@ fifo_pull(void)
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
- _nc_fifo_dump();
+ _nc_fifo_dump(sp);
_nc_unlock_global(tracef);
}
#endif
@@ -139,7 +141,7 @@ fifo_pull(void)
}
static NCURSES_INLINE int
-fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
+fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
{
int n;
int ch = 0;
@@ -157,47 +159,47 @@ fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
#ifdef NCURSES_WGETCH_EVENTS
if (evl
#if USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
- || (SP->_mouse_fd >= 0)
+ || (sp->_mouse_fd >= 0)
#endif
) {
- mask = check_mouse_activity(-1 EVENTLIST_2nd(evl));
+ mask = check_mouse_activity(sp, -1 EVENTLIST_2nd(evl));
} else
mask = 0;
if (mask & 4) {
T(("fifo_push: ungetch KEY_EVENT"));
- ungetch(KEY_EVENT);
+ _nc_ungetch(sp, KEY_EVENT);
return KEY_EVENT;
}
#elif USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
- if (SP->_mouse_fd >= 0) {
- mask = check_mouse_activity(-1 EVENTLIST_2nd(evl));
+ if (sp->_mouse_fd >= 0) {
+ mask = check_mouse_activity(sp, -1 EVENTLIST_2nd(evl));
}
#endif
#if USE_GPM_SUPPORT || USE_EMX_MOUSE
- if ((SP->_mouse_fd >= 0) && (mask & 2)) {
- SP->_mouse_event(SP);
+ if ((sp->_mouse_fd >= 0) && (mask & 2)) {
+ sp->_mouse_event(sp);
ch = KEY_MOUSE;
n = 1;
} else
#endif
#if USE_SYSMOUSE
- if ((SP->_mouse_type == M_SYSMOUSE)
- && (SP->_sysmouse_head < SP->_sysmouse_tail)) {
- SP->_mouse_event(SP);
+ if ((sp->_mouse_type == M_SYSMOUSE)
+ && (sp->_sysmouse_head < sp->_sysmouse_tail)) {
+ sp->_mouse_event(sp);
ch = KEY_MOUSE;
n = 1;
- } else if ((SP->_mouse_type == M_SYSMOUSE)
+ } else if ((sp->_mouse_type == M_SYSMOUSE)
&& (mask <= 0) && errno == EINTR) {
- SP->_mouse_event(SP);
+ sp->_mouse_event(sp);
ch = KEY_MOUSE;
n = 1;
} else
#endif
{ /* Can block... */
unsigned char c2 = 0;
- n = read(SP->_ifd, &c2, 1);
+ n = read(sp->_ifd, &c2, 1);
ch = c2;
}
@@ -216,20 +218,20 @@ fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
#endif
if ((n == -1) || (n == 0)) {
- TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", SP->_ifd, n, errno));
+ TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", sp->_ifd, n, errno));
ch = ERR;
}
TR(TRACE_IEVENT, ("read %d characters", n));
- SP->_fifo[tail] = ch;
- SP->_fifohold = 0;
+ sp->_fifo[tail] = ch;
+ sp->_fifohold = 0;
if (head == -1)
head = peek = tail;
t_inc();
TR(TRACE_IEVENT, ("pushed %s at %d", _tracechar(ch), tail));
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
- _nc_fifo_dump();
+ _nc_fifo_dump(sp);
_nc_unlock_global(tracef);
}
#endif
@@ -237,14 +239,14 @@ fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
}
static NCURSES_INLINE void
-fifo_clear(void)
+fifo_clear(SCREEN *sp)
{
- memset(SP->_fifo, 0, sizeof(SP->_fifo));
+ memset(sp->_fifo, 0, sizeof(sp->_fifo));
head = -1;
tail = peek = 0;
}
-static int kgetch(EVENTLIST_0th(_nc_eventlist * evl));
+static int kgetch(SCREEN *EVENTLIST_2nd(_nc_eventlist * evl));
#define wgetch_should_refresh(win) (\
(is_wintouched(win) || (win->_flags & _HASMOVED)) \
@@ -256,6 +258,7 @@ _nc_wgetch(WINDOW *win,
int use_meta
EVENTLIST_2nd(_nc_eventlist * evl))
{
+ SCREEN *sp = SP;
int ch;
#ifdef NCURSES_WGETCH_EVENTS
long event_delay = -1;
@@ -264,7 +267,7 @@ _nc_wgetch(WINDOW *win,
T((T_CALLED("_nc_wgetch(%p)"), win));
*result = 0;
- if (win == 0 || SP == 0) {
+ if (win == 0 || sp == 0) {
returnCode(ERR);
}
@@ -272,7 +275,7 @@ _nc_wgetch(WINDOW *win,
if (wgetch_should_refresh(win))
wrefresh(win);
- *result = fifo_pull();
+ *result = fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
#ifdef NCURSES_WGETCH_EVENTS
@@ -287,26 +290,26 @@ _nc_wgetch(WINDOW *win,
* the first character to return it.
*/
if (head == -1 &&
- !SP->_notty &&
- !SP->_raw &&
- !SP->_cbreak &&
- !SP->_called_wgetch) {
- char buf[MAXCOLUMNS], *sp;
+ !sp->_notty &&
+ !sp->_raw &&
+ !sp->_cbreak &&
+ !sp->_called_wgetch) {
+ char buf[MAXCOLUMNS], *bufp;
int rc;
TR(TRACE_IEVENT, ("filling queue in cooked mode"));
- SP->_called_wgetch = TRUE;
+ sp->_called_wgetch = TRUE;
rc = wgetnstr(win, buf, MAXCOLUMNS);
- SP->_called_wgetch = FALSE;
+ sp->_called_wgetch = FALSE;
/* ungetch in reverse order */
#ifdef NCURSES_WGETCH_EVENTS
if (rc != KEY_EVENT)
#endif
- ungetch('\n');
- for (sp = buf + strlen(buf); sp > buf; sp--)
- ungetch(sp[-1]);
+ _nc_ungetch(sp, '\n');
+ for (bufp = buf + strlen(buf); bufp > buf; bufp--)
+ _nc_ungetch(sp, bufp[-1]);
#ifdef NCURSES_WGETCH_EVENTS
/* Return it first */
@@ -314,24 +317,24 @@ _nc_wgetch(WINDOW *win,
*result = rc;
} else
#endif
- *result = fifo_pull();
+ *result = fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
- if (win->_use_keypad != SP->_keypad_on)
- _nc_keypad(win->_use_keypad);
+ if (win->_use_keypad != sp->_keypad_on)
+ _nc_keypad(sp, win->_use_keypad);
if (wgetch_should_refresh(win))
wrefresh(win);
- if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) {
+ if (!win->_notimeout && (win->_delay >= 0 || sp->_cbreak > 1)) {
if (head == -1) { /* fifo is empty */
int delay;
int rc;
TR(TRACE_IEVENT, ("timed delay in wgetch()"));
- if (SP->_cbreak > 1)
- delay = (SP->_cbreak - 1) * 100;
+ if (sp->_cbreak > 1)
+ delay = (sp->_cbreak - 1) * 100;
else
delay = win->_delay;
@@ -342,7 +345,7 @@ _nc_wgetch(WINDOW *win,
TR(TRACE_IEVENT, ("delay is %d milliseconds", delay));
- rc = check_mouse_activity(delay EVENTLIST_2nd(evl));
+ rc = check_mouse_activity(sp, delay EVENTLIST_2nd(evl));
#ifdef NCURSES_WGETCH_EVENTS
if (rc & 4) {
@@ -372,23 +375,23 @@ _nc_wgetch(WINDOW *win,
int rc;
do {
- ch = kgetch(EVENTLIST_1st(evl));
+ ch = kgetch(sp EVENTLIST_2nd(evl));
if (ch == KEY_MOUSE) {
++runcount;
- if (SP->_mouse_inline(SP))
+ if (sp->_mouse_inline(sp))
break;
}
- if (SP->_maxclick < 0)
+ if (sp->_maxclick < 0)
break;
} while
(ch == KEY_MOUSE
- && (((rc = check_mouse_activity(SP->_maxclick
+ && (((rc = check_mouse_activity(sp, sp->_maxclick
EVENTLIST_2nd(evl))) != 0
&& !(rc & 4))
- || !SP->_mouse_parse(runcount)));
+ || !sp->_mouse_parse(runcount)));
#ifdef NCURSES_WGETCH_EVENTS
if ((rc & 4) && !ch == KEY_EVENT) {
- ungetch(ch);
+ _nc_ungetch(sp, ch);
ch = KEY_EVENT;
}
#endif
@@ -396,28 +399,28 @@ _nc_wgetch(WINDOW *win,
#ifdef NCURSES_WGETCH_EVENTS
/* mouse event sequence ended by an event, report event */
if (ch == KEY_EVENT) {
- ungetch(KEY_MOUSE); /* FIXME This interrupts a gesture... */
+ _nc_ungetch(sp, KEY_MOUSE); /* FIXME This interrupts a gesture... */
} else
#endif
{
/* mouse event sequence ended by keystroke, store keystroke */
- ungetch(ch);
+ _nc_ungetch(sp, ch);
ch = KEY_MOUSE;
}
}
} else {
if (head == -1)
- fifo_push(EVENTLIST_1st(evl));
- ch = fifo_pull();
+ fifo_push(sp EVENTLIST_2nd(evl));
+ ch = fifo_pull(sp);
}
if (ch == ERR) {
#if USE_SIZECHANGE
- if (_nc_handle_sigwinch(FALSE)) {
- _nc_update_screensize();
+ if (_nc_handle_sigwinch(sp)) {
+ _nc_update_screensize(sp);
/* resizeterm can push KEY_RESIZE */
if (cooked_key_in_fifo()) {
- *result = fifo_pull();
+ *result = fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
}
@@ -443,7 +446,7 @@ _nc_wgetch(WINDOW *win,
* However, we provide the same visual result as Solaris, moving the
* cursor to the left.
*/
- if (SP->_echo && !(win->_flags & _ISPAD)) {
+ if (sp->_echo && !(win->_flags & _ISPAD)) {
chtype backup = (ch == KEY_BACKSPACE) ? '\b' : ch;
if (backup < KEY_MIN)
wechochar(win, backup);
@@ -452,7 +455,7 @@ _nc_wgetch(WINDOW *win,
/*
* Simulate ICRNL mode
*/
- if ((ch == '\r') && SP->_nl)
+ if ((ch == '\r') && sp->_nl)
ch = '\n';
/* Strip 8th-bit if so desired. We do this only for characters that
@@ -474,13 +477,14 @@ _nc_wgetch(WINDOW *win,
NCURSES_EXPORT(int)
wgetch_events(WINDOW *win, _nc_eventlist * evl)
{
+ SCREEN *sp = SP;
int code;
unsigned long value;
T((T_CALLED("wgetch_events(%p,%p)"), win, evl));
code = _nc_wgetch(win,
&value,
- SP->_use_meta
+ sp->_use_meta
EVENTLIST_2nd(evl));
if (code != ERR)
code = value;
@@ -491,13 +495,14 @@ wgetch_events(WINDOW *win, _nc_eventlist * evl)
NCURSES_EXPORT(int)
wgetch(WINDOW *win)
{
+ SCREEN *sp = SP;
int code;
unsigned long value;
T((T_CALLED("wgetch(%p)"), win));
code = _nc_wgetch(win,
&value,
- (SP ? SP->_use_meta : 0)
+ (sp ? sp->_use_meta : 0)
EVENTLIST_2nd((_nc_eventlist *) 0));
if (code != ERR)
code = value;
@@ -520,21 +525,21 @@ wgetch(WINDOW *win)
*/
static int
-kgetch(EVENTLIST_0th(_nc_eventlist * evl))
+kgetch(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
{
TRIES *ptr;
int ch = 0;
- int timeleft = ESCDELAY;
+ int timeleft = GetEscdelay(sp);
TR(TRACE_IEVENT, ("kgetch() called"));
- ptr = SP->_keytry;
+ ptr = sp->_keytry;
for (;;) {
- if (cooked_key_in_fifo() && SP->_fifo[head] >= KEY_MIN) {
+ if (cooked_key_in_fifo() && sp->_fifo[head] >= KEY_MIN) {
break;
} else if (!raw_key_in_fifo()) {
- ch = fifo_push(EVENTLIST_1st(evl));
+ ch = fifo_push(sp EVENTLIST_2nd(evl));
if (ch == ERR) {
peek = head; /* the keys stay uninterpreted */
return ERR;
@@ -542,12 +547,12 @@ kgetch(EVENTLIST_0th(_nc_eventlist * evl))
#ifdef NCURSES_WGETCH_EVENTS
else if (ch == KEY_EVENT) {
peek = head; /* the keys stay uninterpreted */
- return fifo_pull(); /* Remove KEY_EVENT from the queue */
+ return fifo_pull(sp); /* Remove KEY_EVENT from the queue */
}
#endif
}
- ch = fifo_peek();
+ ch = fifo_peek(sp);
if (ch >= KEY_MIN) {
/* If not first in queue, somebody put this key there on purpose in
* emergency. Consider it higher priority than the unfinished
@@ -573,7 +578,7 @@ kgetch(EVENTLIST_0th(_nc_eventlist * evl))
if (ptr->value != 0) { /* sequence terminated */
TR(TRACE_IEVENT, ("end of sequence"));
if (peek == tail)
- fifo_clear();
+ fifo_clear(sp);
else
head = peek;
return (ptr->value);
@@ -585,7 +590,7 @@ kgetch(EVENTLIST_0th(_nc_eventlist * evl))
int rc;
TR(TRACE_IEVENT, ("waiting for rest of sequence"));
- rc = check_mouse_activity(timeleft EVENTLIST_2nd(evl));
+ rc = check_mouse_activity(sp, timeleft EVENTLIST_2nd(evl));
#ifdef NCURSES_WGETCH_EVENTS
if (rc & 4) {
TR(TRACE_IEVENT, ("interrupted by a user event"));
@@ -600,7 +605,7 @@ kgetch(EVENTLIST_0th(_nc_eventlist * evl))
}
}
}
- ch = fifo_pull();
+ ch = fifo_pull(sp);
peek = head;
return ch;
}
diff --git a/contrib/ncurses/ncurses/base/lib_initscr.c b/contrib/ncurses/ncurses/base/lib_initscr.c
index 38744738cbb6..ef360c03b642 100644
--- a/contrib/ncurses/ncurses/base/lib_initscr.c
+++ b/contrib/ncurses/ncurses/base/lib_initscr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -45,15 +45,19 @@
#include <sys/termio.h> /* needed for ISC */
#endif
-MODULE_ID("$Id: lib_initscr.c,v 1.35 2007/04/21 20:43:02 tom Exp $")
+MODULE_ID("$Id: lib_initscr.c,v 1.36 2008/04/12 18:11:36 tom Exp $")
NCURSES_EXPORT(WINDOW *)
initscr(void)
{
+ WINDOW *result;
+
NCURSES_CONST char *name;
START_TRACE();
T((T_CALLED("initscr()")));
+
+ _nc_lock_global(set_SP);
/* Portable applications must not call initscr() more than once */
if (!_nc_globals.init_screen) {
_nc_globals.init_screen = TRUE;
@@ -86,5 +90,8 @@ initscr(void)
/* def_shell_mode - done in newterm/_nc_setupscreen */
def_prog_mode();
}
- returnWin(stdscr);
+ result = stdscr;
+ _nc_unlock_global(set_SP);
+
+ returnWin(result);
}
diff --git a/contrib/ncurses/ncurses/base/lib_newterm.c b/contrib/ncurses/ncurses/base/lib_newterm.c
index f52562cec106..3620a3fdbf2b 100644
--- a/contrib/ncurses/ncurses/base/lib_newterm.c
+++ b/contrib/ncurses/ncurses/base/lib_newterm.c
@@ -48,7 +48,7 @@
#include <term.h> /* clear_screen, cup & friends, cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_newterm.c,v 1.68 2008/01/12 20:24:40 tom Exp $")
+MODULE_ID("$Id: lib_newterm.c,v 1.69 2008/04/12 18:15:04 tom Exp $")
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
@@ -123,17 +123,17 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
{
int value;
int errret;
- int slk_format = _nc_globals.slk_format;
SCREEN *current;
SCREEN *result = 0;
START_TRACE();
T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp));
+ _nc_lock_global(set_SP);
/* this loads the capability entry, then sets LINES and COLS */
- if (setupterm(name, fileno(ofp), &errret) == ERR) {
- result = 0;
- } else {
+ if (setupterm(name, fileno(ofp), &errret) != ERR) {
+ int slk_format = _nc_globals.slk_format;
+
/*
* This actually allocates the screen structure, and saves the original
* terminal settings.
@@ -143,11 +143,7 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
/* allow user to set maximum escape delay from the environment */
if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
-#if USE_REENTRANT
- SP->_ESCDELAY = value;
-#else
- ESCDELAY = value;
-#endif
+ set_escdelay(value);
}
if (_nc_setupscreen(LINES,
@@ -216,5 +212,6 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
result = SP;
}
}
+ _nc_unlock_global(set_SP);
returnSP(result);
}
diff --git a/contrib/ncurses/ncurses/base/lib_newwin.c b/contrib/ncurses/ncurses/base/lib_newwin.c
index 21ba95f34ed6..7f7aa3e04f1e 100644
--- a/contrib/ncurses/ncurses/base/lib_newwin.c
+++ b/contrib/ncurses/ncurses/base/lib_newwin.c
@@ -40,42 +40,39 @@
*/
#include <curses.priv.h>
+#include <stddef.h>
-MODULE_ID("$Id: lib_newwin.c,v 1.44 2008/01/13 00:28:13 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.50 2008/05/03 16:36:39 tom Exp $")
-static WINDOW *
+#define window_is(name) ((sp)->_##name == win)
+
+#if USE_REENTRANT
+#define remove_window(name) \
+ sp->_##name = 0
+#else
+#define remove_window(name) \
+ sp->_##name = 0; \
+ if (win == name) \
+ name = 0
+#endif
+
+static void
remove_window_from_screen(WINDOW *win)
{
- SCREEN **scan = &_nc_screen_chain;
-
- while (*scan) {
- SCREEN *sp = *scan;
- if (sp->_curscr == win) {
- sp->_curscr = 0;
-#if !USE_REENTRANT
- if (win == curscr)
- curscr = 0;
-#endif
- } else if (sp->_stdscr == win) {
- sp->_stdscr = 0;
-#if !USE_REENTRANT
- if (win == stdscr)
- stdscr = 0;
-#endif
- } else if (sp->_newscr == win) {
- sp->_newscr = 0;
-#if !USE_REENTRANT
- if (win == newscr)
- newscr = 0;
-#endif
- } else {
- scan = &(*scan)->_next_screen;
- continue;
+ SCREEN *sp;
+
+ for (each_screen(sp)) {
+ if (window_is(curscr)) {
+ remove_window(curscr);
+ break;
+ } else if (window_is(stdscr)) {
+ remove_window(stdscr);
+ break;
+ } else if (window_is(newscr)) {
+ remove_window(newscr);
+ break;
}
- break;
}
-
- return 0;
}
NCURSES_EXPORT(int)
@@ -89,7 +86,8 @@ _nc_freewin(WINDOW *win)
if (win != 0) {
if (_nc_try_global(windowlist) == 0) {
- for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) {
+ q = 0;
+ for (each_window(p)) {
if (&(p->win) == win) {
remove_window_from_screen(win);
if (q == 0)
@@ -108,6 +106,7 @@ _nc_freewin(WINDOW *win)
T(("...deleted win=%p", win));
break;
}
+ q = p;
}
_nc_unlock_global(windowlist);
}
@@ -230,14 +229,7 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
if ((wp = typeCalloc(WINDOWLIST, 1)) == 0)
returnWin(0);
-#ifdef USE_PTHREADS
- {
- pthread_mutexattr_t recattr;
- memset(&recattr, 0, sizeof(recattr));
- pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_NORMAL);
- pthread_mutex_init(&(wp->mutex_use_window), &recattr);
- }
-#endif
+ _nc_mutex_init(&(wp->mutex_use_window));
win = &(wp->win);
diff --git a/contrib/ncurses/ncurses/base/lib_overlay.c b/contrib/ncurses/ncurses/base/lib_overlay.c
index 22bd2f80ba72..26314de5e5fb 100644
--- a/contrib/ncurses/ncurses/base/lib_overlay.c
+++ b/contrib/ncurses/ncurses/base/lib_overlay.c
@@ -40,46 +40,46 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_overlay.c,v 1.23 2007/04/07 17:13:52 tom Exp $")
+MODULE_ID("$Id: lib_overlay.c,v 1.25 2008/04/12 17:21:59 tom Exp $")
static int
-overlap(const WINDOW *const s, WINDOW *const d, int const flag)
+overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
{
+ int rc = ERR;
int sx1, sy1, sx2, sy2;
int dx1, dy1, dx2, dy2;
int sminrow, smincol;
int dminrow, dmincol;
int dmaxrow, dmaxcol;
- T((T_CALLED("overlap(%p,%p,%d)"), s, d, flag));
+ T((T_CALLED("overlap(%p,%p,%d)"), src, dst, flag));
+
+ if (src != 0 && dst != 0) {
+ _nc_lock_window(src);
+ _nc_lock_window(dst);
- if (s == 0 || d == 0) {
- returnCode(ERR);
- } else {
T(("src : begy %ld, begx %ld, maxy %ld, maxx %ld",
- (long) s->_begy,
- (long) s->_begx,
- (long) s->_maxy,
- (long) s->_maxx));
+ (long) src->_begy,
+ (long) src->_begx,
+ (long) src->_maxy,
+ (long) src->_maxx));
T(("dst : begy %ld, begx %ld, maxy %ld, maxx %ld",
- (long) d->_begy,
- (long) d->_begx,
- (long) d->_maxy,
- (long) d->_maxx));
-
- sx1 = s->_begx;
- sy1 = s->_begy;
- sx2 = sx1 + s->_maxx;
- sy2 = sy1 + s->_maxy;
-
- dx1 = d->_begx;
- dy1 = d->_begy;
- dx2 = dx1 + d->_maxx;
- dy2 = dy1 + d->_maxy;
-
- if (dx2 < sx1 || dx1 > sx2 || dy2 < sy1 || dy1 > sy2) {
- returnCode(ERR); /* No intersection */
- } else {
+ (long) dst->_begy,
+ (long) dst->_begx,
+ (long) dst->_maxy,
+ (long) dst->_maxx));
+
+ sx1 = src->_begx;
+ sy1 = src->_begy;
+ sx2 = sx1 + src->_maxx;
+ sy2 = sy1 + src->_maxy;
+
+ dx1 = dst->_begx;
+ dy1 = dst->_begy;
+ dx2 = dx1 + dst->_maxx;
+ dy2 = dy1 + dst->_maxy;
+
+ if (dx2 >= sx1 && dx1 <= sx2 && dy2 >= sy1 && dy1 <= sy2) {
sminrow = max(sy1, dy1) - sy1;
smincol = max(sx1, dx1) - sx1;
dminrow = max(sy1, dy1) - dy1;
@@ -87,13 +87,16 @@ overlap(const WINDOW *const s, WINDOW *const d, int const flag)
dmaxrow = min(sy2, dy2) - dy1;
dmaxcol = min(sx2, dx2) - dx1;
- returnCode(copywin(s, d,
- sminrow, smincol,
- dminrow, dmincol,
- dmaxrow, dmaxcol,
- flag));
+ rc = copywin(src, dst,
+ sminrow, smincol,
+ dminrow, dmincol,
+ dmaxrow, dmaxcol,
+ flag);
}
+ _nc_unlock_window(dst);
+ _nc_unlock_window(src);
}
+ returnCode(rc);
}
/*
@@ -137,6 +140,7 @@ copywin(const WINDOW *src, WINDOW *dst,
int dmaxrow, int dmaxcol,
int over)
{
+ int rc = ERR;
int sx, sy, dx, dy;
bool touched;
attr_t bk;
@@ -145,49 +149,63 @@ copywin(const WINDOW *src, WINDOW *dst,
T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"),
src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over));
- if (!src || !dst)
- returnCode(ERR);
-
- bk = AttrOf(dst->_nc_bkgd);
- mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
-
- /* make sure rectangle exists in source */
- if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) ||
- (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) {
- returnCode(ERR);
- }
-
- T(("rectangle exists in source"));
-
- /* make sure rectangle fits in destination */
- if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) {
- returnCode(ERR);
- }
-
- T(("rectangle fits in destination"));
-
- for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) {
- touched = FALSE;
- for (dx = dmincol, sx = smincol; dx <= dmaxcol; sx++, dx++) {
- if (over) {
- if ((CharOf(src->_line[sy].text[sx]) != L(' ')) &&
- (!CharEq(dst->_line[dy].text[dx], src->_line[sy].text[sx]))) {
- dst->_line[dy].text[dx] = src->_line[sy].text[sx];
- SetAttr(dst->_line[dy].text[dx],
- (AttrOf(src->_line[sy].text[sx]) & mask) | bk);
- touched = TRUE;
- }
- } else {
- if (!CharEq(dst->_line[dy].text[dx], src->_line[sy].text[sx])) {
- dst->_line[dy].text[dx] = src->_line[sy].text[sx];
- touched = TRUE;
+ if (src && dst) {
+
+ _nc_lock_window(src);
+ _nc_lock_window(dst);
+
+ bk = AttrOf(dst->_nc_bkgd);
+ mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
+
+ /* make sure rectangle exists in source */
+ if ((sminrow + dmaxrow - dminrow) <= (src->_maxy + 1) &&
+ (smincol + dmaxcol - dmincol) <= (src->_maxx + 1)) {
+
+ T(("rectangle exists in source"));
+
+ /* make sure rectangle fits in destination */
+ if (dmaxrow <= dst->_maxy && dmaxcol <= dst->_maxx) {
+
+ T(("rectangle fits in destination"));
+
+ for (dy = dminrow, sy = sminrow;
+ dy <= dmaxrow;
+ sy++, dy++) {
+
+ touched = FALSE;
+ for (dx = dmincol, sx = smincol;
+ dx <= dmaxcol;
+ sx++, dx++) {
+ if (over) {
+ if ((CharOf(src->_line[sy].text[sx]) != L(' ')) &&
+ (!CharEq(dst->_line[dy].text[dx],
+ src->_line[sy].text[sx]))) {
+ dst->_line[dy].text[dx] =
+ src->_line[sy].text[sx];
+ SetAttr(dst->_line[dy].text[dx],
+ ((AttrOf(src->_line[sy].text[sx]) &
+ mask) | bk));
+ touched = TRUE;
+ }
+ } else {
+ if (!CharEq(dst->_line[dy].text[dx],
+ src->_line[sy].text[sx])) {
+ dst->_line[dy].text[dx] =
+ src->_line[sy].text[sx];
+ touched = TRUE;
+ }
+ }
+ }
+ if (touched) {
+ touchline(dst, dminrow, (dmaxrow - dminrow + 1));
+ }
}
+ T(("finished copywin"));
+ rc = OK;
}
}
- if (touched) {
- touchline(dst, dminrow, (dmaxrow - dminrow + 1));
- }
+ _nc_unlock_window(dst);
+ _nc_unlock_window(src);
}
- T(("finished copywin"));
- returnCode(OK);
+ returnCode(rc);
}
diff --git a/contrib/ncurses/ncurses/base/lib_restart.c b/contrib/ncurses/ncurses/base/lib_restart.c
index 858ef65a645d..9742ff629fbd 100644
--- a/contrib/ncurses/ncurses/base/lib_restart.c
+++ b/contrib/ncurses/ncurses/base/lib_restart.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -48,7 +48,7 @@
#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_restart.c,v 1.8 2007/10/13 19:59:47 tom Exp $")
+MODULE_ID("$Id: lib_restart.c,v 1.9 2008/05/03 22:43:52 tom Exp $")
NCURSES_EXPORT(int)
restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
@@ -88,7 +88,7 @@ restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
reset_prog_mode();
#if USE_SIZECHANGE
- _nc_update_screensize();
+ _nc_update_screensize(SP);
#endif
result = OK;
diff --git a/contrib/ncurses/ncurses/base/lib_set_term.c b/contrib/ncurses/ncurses/base/lib_set_term.c
index e44850c6a15a..eee1cfc7b259 100644
--- a/contrib/ncurses/ncurses/base/lib_set_term.c
+++ b/contrib/ncurses/ncurses/base/lib_set_term.c
@@ -44,7 +44,7 @@
#include <term.h> /* cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_set_term.c,v 1.103 2008/02/03 20:31:08 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.108 2008/05/03 22:42:43 tom Exp $")
NCURSES_EXPORT(SCREEN *)
set_term(SCREEN *screenp)
@@ -58,14 +58,25 @@ set_term(SCREEN *screenp)
oldSP = SP;
_nc_set_screen(screenp);
- set_curterm(SP->_term);
+ if (SP != 0) {
+ set_curterm(SP->_term);
#if !USE_REENTRANT
- curscr = SP->_curscr;
- newscr = SP->_newscr;
- stdscr = SP->_stdscr;
- COLORS = SP->_color_count;
- COLOR_PAIRS = SP->_pair_count;
+ curscr = SP->_curscr;
+ newscr = SP->_newscr;
+ stdscr = SP->_stdscr;
+ COLORS = SP->_color_count;
+ COLOR_PAIRS = SP->_pair_count;
#endif
+ } else {
+ set_curterm(0);
+#if !USE_REENTRANT
+ curscr = 0;
+ newscr = 0;
+ stdscr = 0;
+ COLORS = 0;
+ COLOR_PAIRS = 0;
+#endif
+ }
_nc_unlock_global(set_SP);
@@ -83,90 +94,105 @@ _nc_free_keytry(TRIES * kt)
}
}
+static bool
+delink_screen(SCREEN *sp)
+{
+ SCREEN *last = 0;
+ SCREEN *temp;
+ bool result = FALSE;
+
+ for (each_screen(temp)) {
+ if (temp == sp) {
+ if (last)
+ last = sp->_next_screen;
+ else
+ _nc_screen_chain = sp->_next_screen;
+ result = TRUE;
+ break;
+ }
+ last = temp;
+ }
+ return result;
+}
+
/*
* Free the storage associated with the given SCREEN sp.
*/
NCURSES_EXPORT(void)
delscreen(SCREEN *sp)
{
- SCREEN **scan = &_nc_screen_chain;
int i;
T((T_CALLED("delscreen(%p)"), sp));
_nc_lock_global(set_SP);
- while (*scan) {
- if (*scan == sp) {
- *scan = sp->_next_screen;
- break;
- }
- scan = &(*scan)->_next_screen;
- }
-
- (void) _nc_freewin(sp->_curscr);
- (void) _nc_freewin(sp->_newscr);
- (void) _nc_freewin(sp->_stdscr);
-
- if (sp->_slk != 0) {
- if (sp->_slk->ent != 0) {
- for (i = 0; i < sp->_slk->labcnt; ++i) {
- FreeIfNeeded(sp->_slk->ent[i].ent_text);
- FreeIfNeeded(sp->_slk->ent[i].form_text);
+ if (delink_screen(sp)) {
+
+ (void) _nc_freewin(sp->_curscr);
+ (void) _nc_freewin(sp->_newscr);
+ (void) _nc_freewin(sp->_stdscr);
+
+ if (sp->_slk != 0) {
+ if (sp->_slk->ent != 0) {
+ for (i = 0; i < sp->_slk->labcnt; ++i) {
+ FreeIfNeeded(sp->_slk->ent[i].ent_text);
+ FreeIfNeeded(sp->_slk->ent[i].form_text);
+ }
+ free(sp->_slk->ent);
}
- free(sp->_slk->ent);
+ free(sp->_slk);
+ sp->_slk = 0;
}
- free(sp->_slk);
- sp->_slk = 0;
- }
- _nc_free_keytry(sp->_keytry);
- sp->_keytry = 0;
+ _nc_free_keytry(sp->_keytry);
+ sp->_keytry = 0;
- _nc_free_keytry(sp->_key_ok);
- sp->_key_ok = 0;
+ _nc_free_keytry(sp->_key_ok);
+ sp->_key_ok = 0;
- FreeIfNeeded(sp->_current_attr);
+ FreeIfNeeded(sp->_current_attr);
- FreeIfNeeded(sp->_color_table);
- FreeIfNeeded(sp->_color_pairs);
+ FreeIfNeeded(sp->_color_table);
+ FreeIfNeeded(sp->_color_pairs);
- FreeIfNeeded(sp->oldhash);
- FreeIfNeeded(sp->newhash);
- FreeIfNeeded(sp->hashtab);
+ FreeIfNeeded(sp->oldhash);
+ FreeIfNeeded(sp->newhash);
+ FreeIfNeeded(sp->hashtab);
- FreeIfNeeded(sp->_acs_map);
- FreeIfNeeded(sp->_screen_acs_map);
+ FreeIfNeeded(sp->_acs_map);
+ FreeIfNeeded(sp->_screen_acs_map);
- del_curterm(sp->_term);
+ del_curterm(sp->_term);
- /*
- * If the associated output stream has been closed, we can discard the
- * set-buffer. Limit the error check to EBADF, since fflush may fail
- * for other reasons than trying to operate upon a closed stream.
- */
- if (sp->_ofp != 0
- && sp->_setbuf != 0
- && fflush(sp->_ofp) != 0
- && errno == EBADF) {
- free(sp->_setbuf);
- }
+ /*
+ * If the associated output stream has been closed, we can discard the
+ * set-buffer. Limit the error check to EBADF, since fflush may fail
+ * for other reasons than trying to operate upon a closed stream.
+ */
+ if (sp->_ofp != 0
+ && sp->_setbuf != 0
+ && fflush(sp->_ofp) != 0
+ && errno == EBADF) {
+ free(sp->_setbuf);
+ }
- free(sp);
+ free(sp);
- /*
- * If this was the current screen, reset everything that the
- * application might try to use (except cur_term, which may have
- * multiple references in different screens).
- */
- if (sp == SP) {
+ /*
+ * If this was the current screen, reset everything that the
+ * application might try to use (except cur_term, which may have
+ * multiple references in different screens).
+ */
+ if (sp == SP) {
#if !USE_REENTRANT
- curscr = 0;
- newscr = 0;
- stdscr = 0;
- COLORS = 0;
- COLOR_PAIRS = 0;
+ curscr = 0;
+ newscr = 0;
+ stdscr = 0;
+ COLORS = 0;
+ COLOR_PAIRS = 0;
#endif
- _nc_set_screen(0);
+ _nc_set_screen(0);
+ }
}
_nc_unlock_global(set_SP);
@@ -254,7 +280,7 @@ _nc_setupscreen(int slines GCC_UNUSED,
/*
* We should always check the screensize, just in case.
*/
- _nc_get_screensize(&slines, &scolumns);
+ _nc_get_screensize(SP, &slines, &scolumns);
SET_LINES(slines);
SET_COLS(scolumns);
T((T_CREATE("screen %s %dx%d"), termname(), LINES, COLS));
@@ -512,8 +538,6 @@ _nc_setupscreen(int slines GCC_UNUSED,
_nc_idcok = TRUE;
_nc_idlok = FALSE;
- _nc_windows = 0; /* no windows yet */
-
SP->oldhash = 0;
SP->newhash = 0;
diff --git a/contrib/ncurses/ncurses/base/lib_ungetch.c b/contrib/ncurses/ncurses/base/lib_ungetch.c
index 9570a33edc5e..2eda99017bed 100644
--- a/contrib/ncurses/ncurses/base/lib_ungetch.c
+++ b/contrib/ncurses/ncurses/base/lib_ungetch.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2002,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -29,6 +29,7 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
@@ -40,42 +41,50 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_ungetch.c,v 1.9 2007/09/29 21:49:56 tom Exp $")
+MODULE_ID("$Id: lib_ungetch.c,v 1.10 2008/05/03 20:20:58 tom Exp $")
#include <fifo_defs.h>
#ifdef TRACE
NCURSES_EXPORT(void)
-_nc_fifo_dump(void)
+_nc_fifo_dump(SCREEN *sp)
{
int i;
T(("head = %d, tail = %d, peek = %d", head, tail, peek));
for (i = 0; i < 10; i++)
- T(("char %d = %s", i, _tracechar(SP->_fifo[i])));
+ T(("char %d = %s", i, _tracechar(sp->_fifo[i])));
}
#endif /* TRACE */
NCURSES_EXPORT(int)
-ungetch(int ch)
+_nc_ungetch(SCREEN *sp, int ch)
{
- T((T_CALLED("ungetch(%s)"), _tracechar(ch)));
+ int rc = ERR;
- if (tail == -1)
- returnCode(ERR);
- if (head == -1) {
- head = 0;
- t_inc()
+ if (tail != -1) {
+ if (head == -1) {
+ head = 0;
+ t_inc();
peek = tail; /* no raw keys */
- } else
- h_dec();
+ } else
+ h_dec();
- SP->_fifo[head] = ch;
- T(("ungetch %s ok", _tracechar(ch)));
+ sp->_fifo[head] = ch;
+ T(("ungetch %s ok", _tracechar(ch)));
#ifdef TRACE
- if (USE_TRACEF(TRACE_IEVENT)) {
- _nc_fifo_dump();
- _nc_unlock_global(tracef);
- }
+ if (USE_TRACEF(TRACE_IEVENT)) {
+ _nc_fifo_dump(sp);
+ _nc_unlock_global(tracef);
+ }
#endif
- returnCode(OK);
+ rc = OK;
+ }
+ return rc;
+}
+
+NCURSES_EXPORT(int)
+ungetch(int ch)
+{
+ T((T_CALLED("ungetch(%s)"), _tracechar(ch)));
+ returnCode(_nc_ungetch(SP, ch));
}
diff --git a/contrib/ncurses/ncurses/base/lib_window.c b/contrib/ncurses/ncurses/base/lib_window.c
index 530b08e5ed1f..ac61cb01da99 100644
--- a/contrib/ncurses/ncurses/base/lib_window.c
+++ b/contrib/ncurses/ncurses/base/lib_window.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -39,7 +39,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_window.c,v 1.23 2007/06/30 23:36:11 tom Exp $")
+MODULE_ID("$Id: lib_window.c,v 1.24 2008/04/12 22:40:21 tom Exp $")
NCURSES_EXPORT(void)
_nc_synchook(WINDOW *win)
@@ -186,6 +186,7 @@ dupwin(WINDOW *win)
if (win != 0) {
+ _nc_lock_window(win);
if (win->_flags & _ISPAD) {
nwin = newpad(win->_maxy + 1,
win->_maxx + 1);
@@ -243,6 +244,7 @@ dupwin(WINDOW *win)
nwin->_line[i].lastchar = win->_line[i].lastchar;
}
}
+ _nc_unlock_window(win);
}
returnWin(nwin);
}
diff --git a/contrib/ncurses/ncurses/base/resizeterm.c b/contrib/ncurses/ncurses/base/resizeterm.c
index eb2dd737f94c..cf2c998e239f 100644
--- a/contrib/ncurses/ncurses/base/resizeterm.c
+++ b/contrib/ncurses/ncurses/base/resizeterm.c
@@ -41,7 +41,7 @@
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: resizeterm.c,v 1.30 2008/01/12 22:26:56 tom Exp $")
+MODULE_ID("$Id: resizeterm.c,v 1.32 2008/05/03 14:28:55 tom Exp $")
#define stolen_lines (screen_lines - SP->_lines_avail)
@@ -69,7 +69,7 @@ show_window_sizes(const char *name)
_nc_lock_global(windowlist);
_tracef("%s resizing: %2d x %2d (%2d x %2d)", name, LINES, COLS,
screen_lines, screen_columns);
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
_tracef(" window %p is %2ld x %2ld at %2ld,%2ld",
&(wp->win),
(long) wp->win._maxy + 1,
@@ -104,7 +104,7 @@ ripped_window(WINDOW *win)
ripoff_t *rop;
if (win != 0) {
- for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
+ for (each_ripoff(rop)) {
if (rop->win == win && rop->line != 0) {
result = rop;
break;
@@ -125,7 +125,7 @@ ripped_bottom(WINDOW *win)
ripoff_t *rop;
if (win != 0) {
- for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
+ for (each_ripoff(rop)) {
if (rop->line < 0) {
result -= rop->line;
if (rop->win == win) {
@@ -148,7 +148,7 @@ child_depth(WINDOW *cmp)
if (cmp != 0) {
WINDOWLIST *wp;
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {
depth = 1 + child_depth(tst);
@@ -251,7 +251,7 @@ decrease_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
found = FALSE;
TR(TRACE_UPDATE, ("decreasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
@@ -285,7 +285,7 @@ increase_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
found = FALSE;
TR(TRACE_UPDATE, ("increasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
@@ -428,7 +428,7 @@ resizeterm(int ToLines, int ToCols)
* decide which to repaint, since without panels, ncurses does
* not know which are really on top.
*/
- for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
+ for (each_ripoff(rop)) {
if (rop->win != stdscr
&& rop->win != 0
&& rop->line < 0) {
diff --git a/contrib/ncurses/ncurses/base/use_window.c b/contrib/ncurses/ncurses/base/use_window.c
index 4c9b1375f288..4d0fdf6705be 100644
--- a/contrib/ncurses/ncurses/base/use_window.c
+++ b/contrib/ncurses/ncurses/base/use_window.c
@@ -32,31 +32,29 @@
#include <curses.priv.h>
-MODULE_ID("$Id: use_window.c,v 1.3 2008/01/13 00:36:22 tom Exp $")
+MODULE_ID("$Id: use_window.c,v 1.7 2008/05/03 14:09:38 tom Exp $")
#ifdef USE_PTHREADS
NCURSES_EXPORT(void)
-_nc_lock_window(WINDOW *win)
+_nc_lock_window(const WINDOW *win)
{
WINDOWLIST *p;
_nc_lock_global(windowlist);
- for (p = _nc_windows; p != 0; p = p->next) {
+ for (each_window(p)) {
if (&(p->win) == win) {
_nc_mutex_lock(&(p->mutex_use_window));
break;
}
}
- _nc_unlock_global(windowlist);
}
NCURSES_EXPORT(void)
-_nc_unlock_window(WINDOW *win)
+_nc_unlock_window(const WINDOW *win)
{
WINDOWLIST *p;
- _nc_lock_global(windowlist);
- for (p = _nc_windows; p != 0; p = p->next) {
+ for (each_window(p)) {
if (&(p->win) == win) {
_nc_mutex_unlock(&(p->mutex_use_window));
break;
@@ -67,7 +65,7 @@ _nc_unlock_window(WINDOW *win)
#endif
NCURSES_EXPORT(int)
-use_window(WINDOW *win, NCURSES_CALLBACK func, void *data)
+use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data)
{
int code = OK;
diff --git a/contrib/ncurses/ncurses/base/wresize.c b/contrib/ncurses/ncurses/base/wresize.c
index f756f0f237f7..ac808c4d2884 100644
--- a/contrib/ncurses/ncurses/base/wresize.c
+++ b/contrib/ncurses/ncurses/base/wresize.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -32,7 +32,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: wresize.c,v 1.27 2007/12/22 23:20:53 tom Exp $")
+MODULE_ID("$Id: wresize.c,v 1.28 2008/05/03 14:13:51 tom Exp $")
static int
cleanup_lines(struct ldat *data, int length)
@@ -56,7 +56,7 @@ repair_subwindows(WINDOW *cmp)
_nc_lock_global(windowlist);
- for (wp = _nc_windows; wp != 0; wp = wp->next) {
+ for (each_window(wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {
diff --git a/contrib/ncurses/ncurses/curses.priv.h b/contrib/ncurses/ncurses/curses.priv.h
index 1e748eeca7a6..422c74cb2a3f 100644
--- a/contrib/ncurses/ncurses/curses.priv.h
+++ b/contrib/ncurses/ncurses/curses.priv.h
@@ -34,7 +34,7 @@
/*
- * $Id: curses.priv.h,v 1.357 2008/01/13 00:33:10 tom Exp $
+ * $Id: curses.priv.h,v 1.373 2008/05/03 23:30:35 tom Exp $
*
* curses.priv.h
*
@@ -312,8 +312,10 @@ color_t;
#define TR_GLOBAL_MUTEX(name) TR_MUTEX(_nc_globals.mutex_##name)
#ifdef USE_PTHREADS
+
#if USE_REENTRANT
#include <pthread.h>
+extern NCURSES_EXPORT(void) _nc_mutex_init(pthread_mutex_t *);
extern NCURSES_EXPORT(int) _nc_mutex_lock(pthread_mutex_t *);
extern NCURSES_EXPORT(int) _nc_mutex_trylock(pthread_mutex_t *);
extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *);
@@ -321,13 +323,22 @@ extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *);
#define _nc_try_global(name) _nc_mutex_trylock(&_nc_globals.mutex_##name)
#define _nc_unlock_global(name) _nc_mutex_unlock(&_nc_globals.mutex_##name)
-extern NCURSES_EXPORT(void) _nc_lock_window(WINDOW *);
-extern NCURSES_EXPORT(void) _nc_unlock_window(WINDOW *);
+extern NCURSES_EXPORT(void) _nc_lock_window(const WINDOW *);
+extern NCURSES_EXPORT(void) _nc_unlock_window(const WINDOW *);
#else
#error POSIX threads requires --enable-reentrant option
#endif
-#else
+
+#if HAVE_NANOSLEEP
+#undef HAVE_NANOSLEEP
+#define HAVE_NANOSLEEP 0 /* nanosleep suspends all threads */
+#endif
+
+#else /* !USE_PTHREADS */
+
+#define _nc_mutex_init(obj) /* nothing */
+
#define _nc_lock_global(name) /* nothing */
#define _nc_try_global(name) 0
#define _nc_unlock_global(name) /* nothing */
@@ -335,10 +346,15 @@ extern NCURSES_EXPORT(void) _nc_unlock_window(WINDOW *);
#define _nc_lock_window(name) (void) TRUE
#define _nc_unlock_window(name) /* nothing */
-#endif
+#endif /* USE_PTHREADS */
-#define _nc_lock_screen(name) /* nothing */
-#define _nc_unlock_screen(name) /* nothing */
+#if HAVE_GETTIMEOFDAY
+# define PRECISE_GETTIME 1
+# define TimeType struct timeval
+#else
+# define PRECISE_GETTIME 0
+# define TimeType time_t
+#endif
/*
* Definitions for color pairs
@@ -552,6 +568,9 @@ typedef struct {
int tgetent_index;
long tgetent_sequence;
+ WINDOWLIST *_nc_windowlist;
+#define _nc_windows _nc_globals._nc_windowlist
+
#if USE_HOME_TERMINFO
char *home_terminfo;
#endif
@@ -583,11 +602,9 @@ typedef struct {
unsigned char *tracetry_buf;
size_t tracetry_used;
-#ifndef USE_TERMLIB
char traceatr_color_buf[2][80];
int traceatr_color_sel;
int traceatr_color_last;
-#endif /* USE_TERMLIB */
#endif /* TRACE */
@@ -607,7 +624,7 @@ extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
#define N_RIPS 5
/*
- * Global data which is swept up into a SCREEN when one is created.
+ * Global data which can be swept up into a SCREEN when one is created.
* It may be modified before the next SCREEN is created.
*/
typedef struct {
@@ -823,12 +840,6 @@ struct screen {
* per screen basis.
*/
struct panelhook _panelHook;
- /*
- * Linked-list of all windows, to support '_nc_resizeall()' and
- * '_nc_freeall()'
- */
- WINDOWLIST *_nc_sp_windows;
-#define _nc_windows SP->_nc_sp_windows
bool _sig_winch;
SCREEN *_next_screen;
@@ -852,7 +863,7 @@ struct screen {
int _LINES;
int _COLS;
#ifdef TRACE
- int _outchars;
+ long _outchars;
const char *_tputs_trace;
#endif
#endif
@@ -1154,6 +1165,13 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
#endif
/*
+ * Standardize/simplify common loops
+ */
+#define each_screen(p) p = _nc_screen_chain; p != 0; p = (p)->_next_screen
+#define each_window(p) p = _nc_windows; p != 0; p = (p)->next
+#define each_ripoff(p) p = ripoff_stack; (p - ripoff_stack) < N_RIPS; ++p
+
+/*
* Prefixes for call/return points of library function traces. We use these to
* instrument the public functions so that the traces can be easily transformed
* into regression scripts.
@@ -1221,7 +1239,7 @@ extern NCURSES_EXPORT(const char *) _nc_retrace_cptr (const char *);
extern NCURSES_EXPORT(int) _nc_retrace_int (int);
extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned);
extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *);
-extern NCURSES_EXPORT(void) _nc_fifo_dump (void);
+extern NCURSES_EXPORT(void) _nc_fifo_dump (SCREEN *);
#if USE_REENTRANT
NCURSES_WRAPPED_VAR(long, _nc_outchars);
@@ -1462,15 +1480,18 @@ extern NCURSES_EXPORT(char *) _nc_get_locale(void);
extern NCURSES_EXPORT(int) _nc_unicode_locale(void);
extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(void);
extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
-extern NCURSES_EXPORT(void) _nc_get_screensize(int *, int *);
+extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
/* lib_tstp.c */
#if USE_SIGWINCH
-extern NCURSES_EXPORT(int) _nc_handle_sigwinch(int);
+extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *);
#else
#define _nc_handle_sigwinch(a) /* nothing */
#endif
+/* lib_ungetch.c */
+extern NCURSES_EXPORT(int) _nc_ungetch (SCREEN *, int);
+
/* lib_wacs.c */
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(void) _nc_init_wacs(void);
@@ -1513,18 +1534,18 @@ extern NCURSES_EXPORT(int) _nc_access (const char *, int);
extern NCURSES_EXPORT(int) _nc_baudrate (int);
extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *);
extern NCURSES_EXPORT(int) _nc_getenv_num (const char *);
-extern NCURSES_EXPORT(int) _nc_keypad (bool);
+extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, bool);
extern NCURSES_EXPORT(int) _nc_ospeed (int);
extern NCURSES_EXPORT(int) _nc_outch (int);
extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int);
-extern NCURSES_EXPORT(int) _nc_timed_wait(int, int, int * EVENTLIST_2nd(_nc_eventlist *));
+extern NCURSES_EXPORT(int) _nc_timed_wait(SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, int (*)(int));
extern NCURSES_EXPORT(void) _nc_flush (void);
extern NCURSES_EXPORT(void) _nc_free_entry(ENTRY *, TERMTYPE *);
extern NCURSES_EXPORT(void) _nc_freeall (void);
extern NCURSES_EXPORT(void) _nc_hash_map (void);
-extern NCURSES_EXPORT(void) _nc_init_keytry (void);
+extern NCURSES_EXPORT(void) _nc_init_keytry (SCREEN *);
extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *);
extern NCURSES_EXPORT(void) _nc_make_oldhash (int i);
extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot);
@@ -1556,7 +1577,7 @@ extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *);
#endif
#if USE_SIZECHANGE
-extern NCURSES_EXPORT(void) _nc_update_screensize (void);
+extern NCURSES_EXPORT(void) _nc_update_screensize (SCREEN *);
#endif
#if HAVE_RESIZETERM
diff --git a/contrib/ncurses/ncurses/fifo_defs.h b/contrib/ncurses/ncurses/fifo_defs.h
index 67799577aead..9655b417d6e7 100644
--- a/contrib/ncurses/ncurses/fifo_defs.h
+++ b/contrib/ncurses/ncurses/fifo_defs.h
@@ -34,21 +34,21 @@
/*
* Common macros for lib_getch.c, lib_ungetch.c
*
- * $Id: fifo_defs.h,v 1.4 2002/03/16 20:47:50 tom Exp $
+ * $Id: fifo_defs.h,v 1.5 2008/05/03 20:08:16 tom Exp $
*/
#ifndef FIFO_DEFS_H
#define FIFO_DEFS_H 1
-#define head SP->_fifohead
-#define tail SP->_fifotail
+#define head sp->_fifohead
+#define tail sp->_fifotail
/* peek points to next uninterpreted character */
-#define peek SP->_fifopeek
+#define peek sp->_fifopeek
#define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;}
#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;}
#define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;}
-#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear();}
+#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear(sp);}
#define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;}
#define cooked_key_in_fifo() ((head != -1) && (peek != head))
diff --git a/contrib/ncurses/ncurses/tinfo/init_keytry.c b/contrib/ncurses/ncurses/tinfo/init_keytry.c
index d20321061554..d30d3ed16a87 100644
--- a/contrib/ncurses/ncurses/tinfo/init_keytry.c
+++ b/contrib/ncurses/ncurses/tinfo/init_keytry.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2006,2008 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 *
@@ -36,7 +36,7 @@
#include <term_entry.h>
-MODULE_ID("$Id: init_keytry.c,v 1.10 2007/04/29 22:57:50 tom Exp $")
+MODULE_ID("$Id: init_keytry.c,v 1.11 2008/05/03 23:09:15 tom Exp $")
/*
** _nc_init_keytry()
@@ -64,19 +64,19 @@ _nc_tinfo_fkeysf(void)
#endif
NCURSES_EXPORT(void)
-_nc_init_keytry(void)
+_nc_init_keytry(SCREEN *sp)
{
size_t n;
- /* The SP->_keytry value is initialized in newterm(), where the SP
+ /* The sp->_keytry value is initialized in newterm(), where the sp
* structure is created, because we can not tell where keypad() or
* mouse_activate() (which will call keyok()) are first called.
*/
- if (SP != 0) {
+ if (sp != 0) {
for (n = 0; _nc_tinfo_fkeys[n].code; n++) {
if (_nc_tinfo_fkeys[n].offset < STRCOUNT) {
- (void) _nc_add_to_try(&(SP->_keytry),
+ (void) _nc_add_to_try(&(sp->_keytry),
CUR Strings[_nc_tinfo_fkeys[n].offset],
_nc_tinfo_fkeys[n].code);
}
@@ -88,7 +88,7 @@ _nc_init_keytry(void)
* names.
*/
{
- TERMTYPE *tp = &(SP->_term->type);
+ TERMTYPE *tp = &(sp->_term->type);
for (n = STRCOUNT; n < NUM_STRINGS(tp); ++n) {
const char *name = ExtStrname(tp, n, strnames);
char *value = tp->Strings[n];
@@ -96,7 +96,7 @@ _nc_init_keytry(void)
&& *name == 'k'
&& value != 0
&& key_defined(value) == 0) {
- (void) _nc_add_to_try(&(SP->_keytry),
+ (void) _nc_add_to_try(&(sp->_keytry),
value,
n - STRCOUNT + KEY_MAX);
}
@@ -104,7 +104,7 @@ _nc_init_keytry(void)
}
#endif
#ifdef TRACE
- _nc_trace_tries(SP->_keytry);
+ _nc_trace_tries(sp->_keytry);
#endif
}
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_data.c b/contrib/ncurses/ncurses/tinfo/lib_data.c
index 21b854b92b6f..ba37e5dc8c49 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_data.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_data.c
@@ -41,7 +41,7 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_data.c,v 1.39 2008/01/13 01:21:59 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.43 2008/03/29 21:16:49 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
@@ -109,7 +109,7 @@ NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data
#define CHARS_0s { '\0' }
#define TGETENT_0 { 0L, FALSE, NULL, NULL, NULL }
-#define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 }
+#define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 }
NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* have_sigwinch */
@@ -140,6 +140,8 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* tgetent_index */
0, /* tgetent_sequence */
+ 0, /* _nc_windowlist */
+
#if USE_HOME_TERMINFO
NULL, /* home_terminfo */
#endif
@@ -171,11 +173,9 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
NULL, /* tracetry_buf */
0, /* tracetry_used */
-#ifndef USE_TERMLIB
{ CHARS_0s, CHARS_0s }, /* traceatr_color_buf */
0, /* traceatr_color_sel */
-1, /* traceatr_color_last */
-#endif /* USE_TERMLIB */
#endif /* TRACE */
#ifdef USE_PTHREADS
@@ -236,21 +236,59 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
/******************************************************************************/
#ifdef USE_PTHREADS
+static void
+init_global_mutexes(void)
+{
+ static bool initialized = FALSE;
+
+ if (!initialized) {
+ initialized = TRUE;
+ _nc_mutex_init(&_nc_globals.mutex_set_SP);
+ _nc_mutex_init(&_nc_globals.mutex_use_screen);
+ _nc_mutex_init(&_nc_globals.mutex_use_window);
+ _nc_mutex_init(&_nc_globals.mutex_windowlist);
+ _nc_mutex_init(&_nc_globals.mutex_tst_tracef);
+ _nc_mutex_init(&_nc_globals.mutex_tracef);
+ }
+}
+
+/*
+ * Use recursive mutexes if we have them - they're part of Unix98.
+ * For the cases where we do not, _nc_mutex_trylock() is used to avoid a
+ * deadlock, at the expense of memory leaks and unexpected failures that
+ * may not be handled by typical clients.
+ *
+ * FIXME - need configure check for PTHREAD_MUTEX_RECURSIVE, define it to
+ * PTHREAD_MUTEX_NORMAL if not supported.
+ */
+NCURSES_EXPORT(void)
+_nc_mutex_init(pthread_mutex_t * obj)
+{
+ pthread_mutexattr_t recattr;
+
+ memset(&recattr, 0, sizeof(recattr));
+ pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(obj, &recattr);
+}
+
NCURSES_EXPORT(int)
-_nc_mutex_lock(pthread_mutex_t *obj)
+_nc_mutex_lock(pthread_mutex_t * obj)
{
+ init_global_mutexes();
return pthread_mutex_lock(obj);
}
NCURSES_EXPORT(int)
-_nc_mutex_trylock(pthread_mutex_t *obj)
+_nc_mutex_trylock(pthread_mutex_t * obj)
{
+ init_global_mutexes();
return pthread_mutex_trylock(obj);
}
NCURSES_EXPORT(int)
-_nc_mutex_unlock(pthread_mutex_t *obj)
+_nc_mutex_unlock(pthread_mutex_t * obj)
{
+ init_global_mutexes();
return pthread_mutex_unlock(obj);
}
#endif /* USE_PTHREADS */
diff --git a/contrib/ncurses/ncurses/tinfo/lib_napms.c b/contrib/ncurses/ncurses/tinfo/lib_napms.c
index 926afa836db4..417b3b4b4dbc 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_napms.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_napms.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2008 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 *
@@ -49,7 +49,7 @@
#endif
#endif
-MODULE_ID("$Id: lib_napms.c,v 1.15 2005/04/03 13:58:14 tom Exp $")
+MODULE_ID("$Id: lib_napms.c,v 1.17 2008/05/03 21:34:13 tom Exp $")
NCURSES_EXPORT(int)
napms(int ms)
@@ -67,7 +67,7 @@ napms(int ms)
}
}
#else
- _nc_timed_wait(0, ms, (int *) 0 EVENTLIST_2nd(0));
+ _nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0));
#endif
returnCode(OK);
diff --git a/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c
index 5cdd1d468077..98aae24baacb 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_options.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_options.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2008 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 *
@@ -43,7 +43,7 @@
#include <term.h>
-MODULE_ID("$Id: lib_options.c,v 1.50 2006/12/30 16:03:27 tom Exp $")
+MODULE_ID("$Id: lib_options.c,v 1.52 2008/05/03 23:09:20 tom Exp $")
NCURSES_EXPORT(int)
idlok(WINDOW *win, bool flag)
@@ -126,7 +126,7 @@ keypad(WINDOW *win, bool flag)
if (win) {
win->_use_keypad = flag;
- returnCode(_nc_keypad(flag));
+ returnCode(_nc_keypad(SP, flag));
} else
returnCode(ERR);
}
@@ -220,7 +220,7 @@ typeahead(int fd)
#if NCURSES_EXT_FUNCS
static int
-has_key_internal(int keycode, TRIES *tp)
+has_key_internal(int keycode, TRIES * tp)
{
if (tp == 0)
return (FALSE);
@@ -247,7 +247,7 @@ has_key(int keycode)
* the terminal state _before_ switching modes.
*/
NCURSES_EXPORT(int)
-_nc_keypad(bool flag)
+_nc_keypad(SCREEN *sp, bool flag)
{
if (flag && keypad_xmit) {
TPUTS_TRACE("keypad_xmit");
@@ -259,12 +259,12 @@ _nc_keypad(bool flag)
_nc_flush();
}
- if (SP != 0) {
- if (flag && !SP->_tried) {
- _nc_init_keytry();
- SP->_tried = TRUE;
+ if (sp != 0) {
+ if (flag && !sp->_tried) {
+ _nc_init_keytry(sp);
+ sp->_tried = TRUE;
}
- SP->_keypad_on = flag;
+ sp->_keypad_on = flag;
}
return (OK);
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c
index a376fc60275b..08cb783c5942 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_setup.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c
@@ -53,7 +53,7 @@
#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_setup.c,v 1.102 2008/01/19 21:07:45 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.105 2008/05/03 22:41:42 tom Exp $")
/****************************************************************************
*
@@ -154,23 +154,19 @@ set_tabsize(int value)
* If we have a pending SIGWINCH, set the flag in each screen.
*/
NCURSES_EXPORT(int)
-_nc_handle_sigwinch(int update)
+_nc_handle_sigwinch(SCREEN *sp)
{
SCREEN *scan;
- (void) update; /* no longer used */
-
if (_nc_globals.have_sigwinch) {
_nc_globals.have_sigwinch = 0;
- scan = _nc_screen_chain;
- while (scan) {
+ for (each_screen(scan)) {
scan->_sig_winch = TRUE;
- scan = scan->_next_screen;
}
}
- return (SP ? SP->_sig_winch : 0);
+ return (sp ? sp->_sig_winch : 0);
}
#endif
@@ -184,7 +180,7 @@ use_env(bool f)
}
NCURSES_EXPORT(void)
-_nc_get_screensize(int *linep, int *colp)
+_nc_get_screensize(SCREEN *sp, int *linep, int *colp)
/* Obtain lines/columns values from the environment and/or terminfo entry */
{
int my_tabsize;
@@ -238,7 +234,7 @@ _nc_get_screensize(int *linep, int *colp)
* environment variable.
*/
if (*linep <= 0)
- *linep = (SP != 0 && SP->_filtered) ? 1 : WINSIZE_ROWS(size);
+ *linep = (sp != 0 && sp->_filtered) ? 1 : WINSIZE_ROWS(size);
if (*colp <= 0)
*colp = WINSIZE_COLS(size);
}
@@ -279,8 +275,8 @@ _nc_get_screensize(int *linep, int *colp)
my_tabsize = 8;
#if USE_REENTRANT
- if (SP != 0)
- SP->_TABSIZE = my_tabsize;
+ if (sp != 0)
+ sp->_TABSIZE = my_tabsize;
#else
TABSIZE = my_tabsize;
#endif
@@ -289,25 +285,25 @@ _nc_get_screensize(int *linep, int *colp)
#if USE_SIZECHANGE
NCURSES_EXPORT(void)
-_nc_update_screensize(void)
+_nc_update_screensize(SCREEN *sp)
{
int old_lines = lines;
int new_lines;
int old_cols = columns;
int new_cols;
- _nc_get_screensize(&new_lines, &new_cols);
+ _nc_get_screensize(sp, &new_lines, &new_cols);
/*
* See is_term_resized() and resizeterm().
* We're doing it this way because those functions belong to the upper
* ncurses library, while this resides in the lower terminfo library.
*/
- if (SP != 0
- && SP->_resize != 0) {
+ if (sp != 0
+ && sp->_resize != 0) {
if ((new_lines != old_lines) || (new_cols != old_cols))
- SP->_resize(new_lines, new_cols);
- SP->_sig_winch = FALSE;
+ sp->_resize(new_lines, new_cols);
+ sp->_sig_winch = FALSE;
}
}
#endif
@@ -590,10 +586,11 @@ _nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse)
* We should always check the screensize, just in case.
*/
#if USE_REENTRANT
- _nc_get_screensize(SP ? &(SP->_LINES) : &(_nc_prescreen._LINES),
+ _nc_get_screensize(SP,
+ SP ? &(SP->_LINES) : &(_nc_prescreen._LINES),
SP ? &(SP->_COLS) : &(_nc_prescreen._COLS));
#else
- _nc_get_screensize(&LINES, &COLS);
+ _nc_get_screensize(SP, &LINES, &COLS);
#endif
if (errret)
diff --git a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
index 4cbbf504a0c7..2cb9fd67b4dd 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -38,7 +38,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_ttyflags.c,v 1.15 2007/05/26 18:54:25 tom Exp $")
+MODULE_ID("$Id: lib_ttyflags.c,v 1.16 2008/05/03 22:39:03 tom Exp $")
NCURSES_EXPORT(int)
_nc_get_tty_mode(TTY * buf)
@@ -147,7 +147,7 @@ reset_prog_mode(void)
if (_nc_set_tty_mode(&cur_term->Nttyb) == OK) {
if (SP) {
if (SP->_keypad_on)
- _nc_keypad(TRUE);
+ _nc_keypad(SP, TRUE);
NC_BUFFERED(TRUE);
}
returnCode(OK);
@@ -163,7 +163,7 @@ reset_shell_mode(void)
if (cur_term != 0) {
if (SP) {
- _nc_keypad(FALSE);
+ _nc_keypad(SP, FALSE);
_nc_flush();
NC_BUFFERED(FALSE);
}
diff --git a/contrib/ncurses/ncurses/tinfo/use_screen.c b/contrib/ncurses/ncurses/tinfo/use_screen.c
index 27730b055c12..a4f34c0e4520 100644
--- a/contrib/ncurses/ncurses/tinfo/use_screen.c
+++ b/contrib/ncurses/ncurses/tinfo/use_screen.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2007,2008 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 *
@@ -32,10 +32,10 @@
#include <curses.priv.h>
-MODULE_ID("$Id: use_screen.c,v 1.2 2007/09/08 21:46:48 tom Exp $")
+MODULE_ID("$Id: use_screen.c,v 1.4 2008/03/29 21:19:58 tom Exp $")
NCURSES_EXPORT(int)
-use_screen(SCREEN *screen, NCURSES_CALLBACK func, void *data)
+use_screen(SCREEN *screen, NCURSES_SCREEN_CB func, void *data)
{
SCREEN *save_SP;
int code = OK;
@@ -50,7 +50,7 @@ use_screen(SCREEN *screen, NCURSES_CALLBACK func, void *data)
save_SP = SP;
set_term(screen);
- code = func(screen->_stdscr, data);
+ code = func(screen, data);
set_term(save_SP);
_nc_unlock_global(use_screen);
diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c
index d634438a97ac..03acb16cba91 100644
--- a/contrib/ncurses/ncurses/trace/lib_trace.c
+++ b/contrib/ncurses/ncurses/trace/lib_trace.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -46,7 +46,7 @@
#include <ctype.h>
-MODULE_ID("$Id: lib_trace.c,v 1.65 2007/09/29 21:47:46 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.66 2008/03/22 16:56:48 tom Exp $")
NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
@@ -167,6 +167,18 @@ _nc_va_tracef(const char *fmt, va_list ap)
if (doit != 0) {
if (TraceFP == 0)
TraceFP = stderr;
+#ifdef USE_PTHREADS
+ /*
+ * TRACE_ICALLS is "really" needed to show normal use with threaded
+ * applications, since anything can be running during a napms(),
+ * making it appear in the hierarchical trace as it other functions
+ * are being called.
+ *
+ * Rather than add the complication of a per-thread stack, just
+ * show the thread-id in each line of the trace.
+ */
+ fprintf(TraceFP, "%#lx:", (long) pthread_self());
+#endif
if (before || after) {
int n;
for (n = 1; n < TraceLevel; n++)
diff --git a/contrib/ncurses/ncurses/tty/lib_tstp.c b/contrib/ncurses/ncurses/tty/lib_tstp.c
index 2a341fa6ba29..06c8411caa4d 100644
--- a/contrib/ncurses/ncurses/tty/lib_tstp.c
+++ b/contrib/ncurses/ncurses/tty/lib_tstp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -46,7 +46,7 @@
#define _POSIX_SOURCE
#endif
-MODULE_ID("$Id: lib_tstp.c,v 1.36 2007/04/21 19:51:29 tom Exp $")
+MODULE_ID("$Id: lib_tstp.c,v 1.37 2008/05/03 16:24:56 tom Exp $")
#if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC)
#define USE_SIGTSTP 1
@@ -252,19 +252,17 @@ cleanup(int sig)
if (signal(sig, SIG_IGN) != SIG_ERR)
#endif
{
- SCREEN *scan = _nc_screen_chain;
- while (scan) {
- if (SP != 0
- && SP->_ofp != 0
- && isatty(fileno(SP->_ofp))) {
- SP->_cleanup = TRUE;
- SP->_outch = _nc_outch;
+ SCREEN *scan;
+ for (each_screen(scan)) {
+ if (scan->_ofp != 0
+ && isatty(fileno(scan->_ofp))) {
+ scan->_cleanup = TRUE;
+ scan->_outch = _nc_outch;
}
set_term(scan);
endwin();
if (SP)
SP->_endwin = FALSE; /* in case we have an atexit! */
- scan = scan->_next_screen;
}
}
}
diff --git a/contrib/ncurses/ncurses/tty/lib_twait.c b/contrib/ncurses/ncurses/tty/lib_twait.c
index 1e4546dec0c0..6d46081862fd 100644
--- a/contrib/ncurses/ncurses/tty/lib_twait.c
+++ b/contrib/ncurses/ncurses/tty/lib_twait.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -62,15 +62,7 @@
# endif
#endif
-MODULE_ID("$Id: lib_twait.c,v 1.54 2007/08/11 16:32:48 tom Exp $")
-
-#if HAVE_GETTIMEOFDAY
-# define PRECISE_GETTIME 1
-# define TimeType struct timeval
-#else
-# define PRECISE_GETTIME 0
-# define TimeType time_t
-#endif
+MODULE_ID("$Id: lib_twait.c,v 1.57 2008/05/03 21:35:57 tom Exp $")
static long
_nc_gettime(TimeType * t0, bool first)
@@ -145,7 +137,8 @@ _nc_eventlist_timeout(_nc_eventlist * evl)
* descriptors.
*/
NCURSES_EXPORT(int)
-_nc_timed_wait(int mode,
+_nc_timed_wait(SCREEN *sp,
+ int mode,
int milliseconds,
int *timeleft
EVENTLIST_2nd(_nc_eventlist * evl))
@@ -207,12 +200,12 @@ _nc_timed_wait(int mode,
#endif
if (mode & 1) {
- fds[count].fd = SP->_ifd;
+ fds[count].fd = sp->_ifd;
fds[count].events = POLLIN;
count++;
}
if ((mode & 2)
- && (fd = SP->_mouse_fd) >= 0) {
+ && (fd = sp->_mouse_fd) >= 0) {
fds[count].fd = fd;
fds[count].events = POLLIN;
count++;
@@ -315,11 +308,11 @@ _nc_timed_wait(int mode,
FD_ZERO(&set);
if (mode & 1) {
- FD_SET(SP->_ifd, &set);
- count = SP->_ifd + 1;
+ FD_SET(sp->_ifd, &set);
+ count = sp->_ifd + 1;
}
if ((mode & 2)
- && (fd = SP->_mouse_fd) >= 0) {
+ && (fd = sp->_mouse_fd) >= 0) {
FD_SET(fd, &set);
count = max(fd, count) + 1;
}
@@ -432,11 +425,11 @@ _nc_timed_wait(int mode,
result = 1; /* redundant, but simple */
#elif HAVE_SELECT
if ((mode & 2)
- && (fd = SP->_mouse_fd) >= 0
+ && (fd = sp->_mouse_fd) >= 0
&& FD_ISSET(fd, &set))
result |= 2;
if ((mode & 1)
- && FD_ISSET(SP->_ifd, &set))
+ && FD_ISSET(sp->_ifd, &set))
result |= 1;
#endif
} else
diff --git a/contrib/ncurses/ncurses/tty/tty_update.c b/contrib/ncurses/ncurses/tty/tty_update.c
index 866681369a10..16fc17d27236 100644
--- a/contrib/ncurses/ncurses/tty/tty_update.c
+++ b/contrib/ncurses/ncurses/tty/tty_update.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 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 *
@@ -74,7 +74,7 @@
#include <ctype.h>
#include <term.h>
-MODULE_ID("$Id: tty_update.c,v 1.243 2007/10/13 20:03:32 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.245 2008/05/03 22:43:04 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@@ -645,7 +645,7 @@ doupdate(void)
SP->_fifohold--;
#if USE_SIZECHANGE
- if (SP->_endwin || _nc_handle_sigwinch(FALSE)) {
+ if (SP->_endwin || _nc_handle_sigwinch(SP)) {
/*
* This is a transparent extension: XSI does not address it,
* and applications need not know that ncurses can do it.
@@ -654,7 +654,7 @@ doupdate(void)
* (this can happen in an xterm, for example), and resize the
* ncurses data structures accordingly.
*/
- _nc_update_screensize();
+ _nc_update_screensize(SP);
}
#endif