From 471bc007361fd4bc8d2fae060c7d5b09828ed541 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 7 Jul 2012 23:45:45 +0000 Subject: [PATCH] ncurses 5.9 - patch 20120707 + add ncurses_mingw.h to installed headers (prompted by patch by Juergen Pfeifer). + clarify return-codes from wgetch() in response to SIGWINCH (prompted by Novell #769788). + modify resizeterm() to always push a KEY_RESIZE onto the fifo, even if screensize is unchanged. Modify _nc_update_screensize() to push a KEY_RESIZE if there was a SIGWINCH, even if it does not call resizeterm(). These changes eliminate the case where a SIGWINCH is received, but ERR returned from wgetch or wgetnstr because the screen dimensions did not change (Novell #769788). --- NEWS | 14 +++++++++++++- dist.mk | 4 ++-- include/headers | 17 +++++++++++++---- man/curs_getch.3x | 12 ++++++------ man/resizeterm.3x | 6 ++---- ncurses/base/lib_set_term.c | 5 +++-- ncurses/base/resizeterm.c | 6 ++++-- ncurses/curses.priv.h | 3 ++- ncurses/tinfo/lib_setup.c | 9 ++++++--- package/debian/changelog | 4 ++-- package/ncurses.spec | 2 +- test/demo_termcap.c | 4 ++-- test/demo_terminfo.c | 4 ++-- test/ncurses.c | 17 ++++++++++++++--- test/test_getstr.c | 15 ++++++++++++--- 15 files changed, 84 insertions(+), 38 deletions(-) diff --git a/NEWS b/NEWS index 6517f84d..3de16bec 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1923 2012/06/30 23:05:08 tom Exp $ +-- $Id: NEWS,v 1.1926 2012/07/07 19:59:58 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,18 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20120707 + + add ncurses_mingw.h to installed headers (prompted by patch by + Juergen Pfeifer). + + clarify return-codes from wgetch() in response to SIGWINCH (prompted + by Novell #769788). + + modify resizeterm() to always push a KEY_RESIZE onto the fifo, even + if screensize is unchanged. Modify _nc_update_screensize() to push a + KEY_RESIZE if there was a SIGWINCH, even if it does not call + resizeterm(). These changes eliminate the case where a SIGWINCH is + received, but ERR returned from wgetch or wgetnstr because the screen + dimensions did not change (Novell #769788). + 20120630 + add --enable-interop to sample package scripts (suggested by Juergen Pfeifer). diff --git a/dist.mk b/dist.mk index adcc76ea..2d7481e7 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.880 2012/06/30 16:22:52 tom Exp $ +# $Id: dist.mk,v 1.881 2012/07/07 16:02:13 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 NCURSES_MINOR = 9 -NCURSES_PATCH = 20120630 +NCURSES_PATCH = 20120707 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/headers b/include/headers index 6c367950..e6f31752 100644 --- a/include/headers +++ b/include/headers @@ -1,6 +1,6 @@ -# $Id: headers,v 1.10 2009/09/05 17:46:30 tom Exp $ +# $Id: headers,v 1.11 2012/07/07 19:58:24 tom Exp $ ############################################################################## -# Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. # +# Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -29,14 +29,23 @@ # # Author: Thomas E. Dickey 1996-on # -term.h curses.h unctrl.h -termcap.h ncurses_dll.h + +# Support for termcap (and tic, etc.), which can be a separate library +@ termlib +term.h +termcap.h + +# Headers used only for tic, other programs using internal interfaces @ ticlib $(srcdir)/tic.h $(srcdir)/term_entry.h $(srcdir)/nc_tparm.h +# Porting +@ port_win32con +ncurses_mingw.h + # vile:makemode diff --git a/man/curs_getch.3x b/man/curs_getch.3x index 2d5d6fda..a8b2ffea 100644 --- a/man/curs_getch.3x +++ b/man/curs_getch.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getch.3x,v 1.36 2011/01/22 19:38:51 tom Exp $ +.\" $Id: curs_getch.3x,v 1.37 2012/07/07 20:04:56 tom Exp $ .TH curs_getch 3X "" .na .hy 0 @@ -237,14 +237,14 @@ See \fBresizeterm\fR(3X) for more details about \fBKEY_RESIZE\fP, and All routines return the integer \fBERR\fR upon failure and an integer value other than \fBERR\fR (\fBOK\fR in the case of ungetch()) upon successful completion. -.RS +.RS 3 .TP 5 \fBungetch\fP -returns an error +returns ERR if there is no more room in the FIFO. -.TP 5 +.TP \fBwgetch\fP -returns an error +returns ERR if the window pointer is null, or if its timeout expires without having any data. .RE diff --git a/man/resizeterm.3x b/man/resizeterm.3x index ddb47e76..f8715d35 100644 --- a/man/resizeterm.3x +++ b/man/resizeterm.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -28,7 +28,7 @@ .\" .\" Author: Thomas E. Dickey 1996-2005 .\" -.\" $Id: resizeterm.3x,v 1.14 2010/12/04 18:38:55 tom Exp $ +.\" $Id: resizeterm.3x,v 1.15 2012/07/07 18:38:21 tom Exp $ .TH resizeterm 3X "" .SH NAME \fBis_term_resized\fR, @@ -86,8 +86,6 @@ this overrides the library's use of the window size obtained from the operating system. Thus, even if a SIGWINCH is received, no screen size change may be recorded. -In that case, no \fBKEY_RESIZE\fP is queued for the next call to \fBgetch\fP; -an \fBERR\fP will be returned instead. .SH SEE ALSO \fBcurs_variables\fR(3X), \fBwresize\fR(3X). diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c index b60242de..aef94012 100644 --- a/ncurses/base/lib_set_term.c +++ b/ncurses/base/lib_set_term.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * + * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -47,7 +47,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_set_term.c,v 1.140 2011/10/22 16:10:43 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.141 2012/07/07 20:37:40 tom Exp $") #ifdef USE_TERM_DRIVER #define MaxColors InfoOf(sp).maxcolors @@ -619,6 +619,7 @@ NCURSES_SP_NAME(_nc_setupscreen) ( #endif #if USE_SIZECHANGE sp->_resize = NCURSES_SP_NAME(resizeterm); + sp->_ungetch = safe_ungetch; #endif NewScreen(sp)->_clear = TRUE; diff --git a/ncurses/base/resizeterm.c b/ncurses/base/resizeterm.c index daa4ae54..03d52a44 100644 --- a/ncurses/base/resizeterm.c +++ b/ncurses/base/resizeterm.c @@ -45,7 +45,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: resizeterm.c,v 1.44 2011/09/03 18:29:11 tom Exp $") +MODULE_ID("$Id: resizeterm.c,v 1.45 2012/07/07 17:07:23 tom Exp $") /* * If we're trying to be reentrant, do not want any local statics. @@ -484,7 +484,6 @@ NCURSES_SP_NAME(resizeterm) (NCURSES_SP_DCLx int ToLines, int ToCols) result = NCURSES_SP_NAME(resize_term) (NCURSES_SP_ARGx ToLines, ToCols); #if USE_SIGWINCH - safe_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ clearok(CurScreen(SP_PARM), TRUE); /* screen contents are unknown */ /* ripped-off lines are a special case: if we did not lengthen @@ -514,6 +513,9 @@ NCURSES_SP_NAME(resizeterm) (NCURSES_SP_DCLx int ToLines, int ToCols) } #endif } +#if USE_SIGWINCH + safe_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ +#endif } returnCode(result); diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 5fbb7b9a..1f869a2c 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.499 2012/03/10 21:16:32 tom Exp $ + * $Id: curses.priv.h,v 1.501 2012/07/07 20:47:07 tom Exp $ * * curses.priv.h * @@ -1159,6 +1159,7 @@ struct screen { */ #if USE_SIZECHANGE int (*_resize)(NCURSES_SP_DCLx int y, int x); + int (*_ungetch)(SCREEN *, int); #endif /* diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index ab27eb1d..166b9689 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -47,7 +47,7 @@ #include #endif -MODULE_ID("$Id: lib_setup.c,v 1.143 2012/02/29 11:50:19 Werner.Fink Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.145 2012/07/07 20:35:27 tom Exp $") /**************************************************************************** * @@ -399,8 +399,11 @@ _nc_update_screensize(SCREEN *sp) */ if (sp != 0 && sp->_resize != 0) { - if ((new_lines != old_lines) || (new_cols != old_cols)) + if ((new_lines != old_lines) || (new_cols != old_cols)) { sp->_resize(NCURSES_SP_ARGx new_lines, new_cols); + } else if (sp->_sig_winch && (sp->_ungetch != 0)) { + sp->_ungetch(SP_PARM, KEY_RESIZE); /* so application can know this */ + } sp->_sig_winch = FALSE; } } @@ -666,7 +669,7 @@ TINFO_SETUP_TERM(TERMINAL ** tp, const TERMTYPE *fallback = _nc_fallback(tname); if (fallback) { - _nc_copy_termtype(&(termp->type),fallback); + _nc_copy_termtype(&(termp->type), fallback); status = TGETENT_YES; } } diff --git a/package/debian/changelog b/package/debian/changelog index 326573e2..9be8c66c 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20120630) unstable; urgency=low +ncurses6 (5.9-20120707) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Fri, 22 Jun 2012 13:52:38 -0400 + -- Thomas E. Dickey Sat, 07 Jul 2012 16:41:06 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/ncurses.spec b/package/ncurses.spec index df23a15e..df9500e5 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Release: 5.9 -Version: 20120630 +Version: 20120707 License: X11 Group: Development/Libraries Source: ncurses-%{release}-%{version}.tgz diff --git a/test/demo_termcap.c b/test/demo_termcap.c index eede682f..6f9c80a9 100644 --- a/test/demo_termcap.c +++ b/test/demo_termcap.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey * - * $Id: demo_termcap.c,v 1.21 2012/06/30 22:02:56 tom Exp $ + * $Id: demo_termcap.c,v 1.22 2012/07/07 23:37:27 tom Exp $ * * A simple demo of the termcap interface. */ @@ -89,7 +89,7 @@ static char * make_dbitem(char *p, char *q) { char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q)); - sprintf(result, "%s=%.*s", e_opt, p - q, q); + sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q); return result; } diff --git a/test/demo_terminfo.c b/test/demo_terminfo.c index fd3362c2..8b64869f 100644 --- a/test/demo_terminfo.c +++ b/test/demo_terminfo.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey * - * $Id: demo_terminfo.c,v 1.12 2012/06/30 22:03:22 tom Exp $ + * $Id: demo_terminfo.c,v 1.13 2012/07/07 23:37:13 tom Exp $ * * A simple demo of the terminfo interface. */ @@ -70,7 +70,7 @@ static char * make_dbitem(char *p, char *q) { char *result = malloc(strlen(e_opt) + 2 + (size_t) (p - q)); - sprintf(result, "%s=%.*s", e_opt, p - q, q); + sprintf(result, "%s=%.*s", e_opt, (int) (p - q), q); return result; } diff --git a/test/ncurses.c b/test/ncurses.c index 1314ef3e..e17a4649 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.371 2012/06/09 20:30:32 tom Exp $ +$Id: ncurses.c,v 1.372 2012/07/07 18:09:38 tom Exp $ ***************************************************************************/ @@ -783,6 +783,15 @@ resize_boxes(unsigned level, WINDOW *win) #define remember_boxes(level,text,frame) /* nothing */ #endif +/* + * Return-code is OK/ERR or a keyname. + */ +static const char * +ok_keyname(int code) +{ + return ((code == OK) ? "OK" : ((code == ERR) ? "ERR" : keyname(code))); +} + static void wgetch_test(unsigned level, WINDOW *win, int delay) { @@ -824,9 +833,11 @@ wgetch_test(unsigned level, WINDOW *win, int delay) } else if (c == 'g') { waddstr(win, "getstr test: "); echo(); - wgetnstr(win, buf, sizeof(buf) - 1); + c = wgetnstr(win, buf, sizeof(buf) - 1); noecho(); - wprintw(win, "I saw %d characters:\n\t`%s'.", (int) strlen(buf), buf); + wprintw(win, "I saw %d characters:\n\t`%s' (%s).", + (int) strlen(buf), buf, + ok_keyname(c)); wclrtoeol(win); wgetch_wrap(win, first_y); } else if (c == 'k') { diff --git a/test/test_getstr.c b/test/test_getstr.c index a0863937..3f64c77b 100644 --- a/test/test_getstr.c +++ b/test/test_getstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2007-2008,2009 Free Software Foundation, Inc. * + * Copyright (c) 2007-2009,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_getstr.c,v 1.9 2009/08/29 19:02:25 tom Exp $ + * $Id: test_getstr.c,v 1.10 2012/07/07 18:22:49 tom Exp $ * * Author: Thomas E Dickey * @@ -58,6 +58,15 @@ typedef enum { eMaxFlavor } Flavors; +/* + * Return-code is OK/ERR or a keyname. + */ +static const char * +ok_keyname(int code) +{ + return ((code == OK) ? "OK" : ((code == ERR) ? "ERR" : keyname(code))); +} + static bool Quit(int ch) { @@ -310,7 +319,7 @@ test_getstr(int level, char **argv, WINDOW *strwin) } noecho(); (void) wattrset(txtwin, A_NORMAL); - wprintw(strwin, "%d:%s", rc, buffer); + wprintw(strwin, "%s:%s", ok_keyname(rc), buffer); wnoutrefresh(strwin); break; default: -- 2.44.0