+ supply a null-terminator to buffer in _nc_viswibuf().
+ fix a sign-extension bug in unget_wch() (report by Mike Gran).
+ minor fixes to error-returns in default function for tputs, as well
as in lib_screen.c
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1446 2009/10/03 21:21:16 tom Exp $
+-- $Id: NEWS,v 1.1449 2009/10/10 20:41:36 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20091010
+ + supply a null-terminator to buffer in _nc_viswibuf().
+ + fix a sign-extension bug in unget_wch() (report by Mike Gran).
+ + minor fixes to error-returns in default function for tputs, as well
+ as in lib_screen.c
+
20091003
+ add WACS_xxx definitions to wide-character configuration for thick-
and double-lines (discussion with Slava Zanko).
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.724 2009/10/03 13:39:55 tom Exp $
+# $Id: dist.mk,v 1.725 2009/10/10 15:29:50 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 7
-NCURSES_PATCH = 20091003
+NCURSES_PATCH = 20091010
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
#include "form.priv.h"
-MODULE_ID("$Id: frm_driver.c,v 1.90 2009/08/29 19:02:25 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.91 2009/10/10 16:17:01 tom Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
source[passed + tries] = 0;
reset_mbytes(state);
status = trans_mbytes(wch, source + passed, tries, state);
- source[passed + tries] = save;
+ source[passed + tries] = (char)save;
if (status > 0)
{
/****************************************************************************
- * Copyright (c) 1998-2005,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 *
#include "form.priv.h"
-MODULE_ID("$Id: frm_req_name.c,v 1.16 2008/07/05 23:22:08 tom Exp $")
+MODULE_ID("$Id: frm_req_name.c,v 1.17 2009/10/10 16:17:01 tom Exp $")
static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
{
strncpy(buf, str, sizeof(buf));
while ((i < sizeof(buf)) && (buf[i] != '\0'))
{
- buf[i] = toupper(UChar(buf[i]));
+ buf[i] = (char)toupper(UChar(buf[i]));
i++;
}
for (i = 0; i < A_SIZE; i++)
{
if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
- returnCode(MIN_FORM_COMMAND + (int) i);
+ returnCode(MIN_FORM_COMMAND + (int)i);
}
}
RETURN(E_NO_MATCH);
/****************************************************************************
- * Copyright (c) 1998-2005,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 *
#include "menu.priv.h"
-MODULE_ID("$Id: m_req_name.c,v 1.20 2008/09/13 18:59:17 tom Exp $")
+MODULE_ID("$Id: m_req_name.c,v 1.21 2009/10/10 16:17:23 tom Exp $")
static const char *request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1] =
{
strncpy(buf, str, sizeof(buf));
while ((i < sizeof(buf)) && (buf[i] != '\0'))
{
- buf[i] = toupper(UChar(buf[i]));
+ buf[i] = (char)toupper(UChar(buf[i]));
i++;
}
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_screen.c,v 1.35 2009/06/06 20:26:17 tom Exp $")
+MODULE_ID("$Id: lib_screen.c,v 1.37 2009/10/10 19:37:07 tom Exp $")
#define MAX_SIZE 0x3fff /* 16k is big enough for a window or pad */
T((T_CALLED("getwin(%p)"), filep));
clearerr(filep);
- (void) fread(&tmp, sizeof(WINDOW), 1, filep);
- if (ferror(filep)
+ if (fread(&tmp, 1, sizeof(WINDOW), filep) < sizeof(WINDOW)
+ || ferror(filep)
|| tmp._maxy == 0
|| tmp._maxy > MAX_SIZE
|| tmp._maxx == 0
- || tmp._maxx > MAX_SIZE)
+ || tmp._maxx > MAX_SIZE) {
returnWin(0);
+ }
if (tmp._flags & _ISPAD) {
nwin = NCURSES_SP_NAME(newpad) (NCURSES_SP_ARGx
- tmp._maxy + 1, tmp._maxx + 1);
+ tmp._maxy + 1,
+ tmp._maxx + 1);
} else {
nwin = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx
tmp._maxy + 1,
* made sense is probably gone.
*/
if (nwin != 0) {
+ size_t linesize = sizeof(NCURSES_CH_T) * (size_t) (tmp._maxx + 1);
+
nwin->_curx = tmp._curx;
nwin->_cury = tmp._cury;
nwin->_maxy = tmp._maxy;
for (n = 0; n <= nwin->_maxy; n++) {
clearerr(filep);
- (void) fread(nwin->_line[n].text,
- sizeof(NCURSES_CH_T),
- (size_t) (nwin->_maxx + 1),
- filep);
- if (ferror(filep)) {
+ if (fread(nwin->_line[n].text, 1, linesize, filep) < linesize
+ || ferror(filep)) {
delwin(nwin);
returnWin(0);
}
#include <termcap.h> /* ospeed */
#include <tic.h>
-MODULE_ID("$Id: lib_tputs.c,v 1.77 2009/06/07 13:59:11 tom Exp $")
+MODULE_ID("$Id: lib_tputs.c,v 1.78 2009/10/10 16:01:42 tom Exp $")
NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */
NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */
NCURSES_EXPORT(int)
NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch)
{
+ int rc = OK;
+
COUNT_OUTCHARS(1);
if (HasTInfoTerminal(SP_PARM)
&& SP_PARM != 0
&& SP_PARM->_cleanup) {
- char tmp = ch;
+ char tmp = (char) ch;
/*
* POSIX says write() is safe in a signal handler, but the
* buffered I/O is not.
*/
- write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1);
+ if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1) == -1)
+ rc = ERR;
} else {
- putc(ch, NC_OUTPUT(SP_PARM));
+ if (putc(ch, NC_OUTPUT(SP_PARM)) == EOF)
+ rc = ERR;
}
- return OK;
+ return rc;
}
#if NCURSES_SP_FUNCS
#include <tic.h>
#include <ctype.h>
-MODULE_ID("$Id: visbuf.c,v 1.33 2009/07/11 14:44:20 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.34 2009/10/10 20:41:55 tom Exp $")
#define NUM_VISBUFS 4
static unsigned mylen;
unsigned n;
- for (n = 0; buf[n] != 0; ++n) ;
+ for (n = 0; buf[n] != 0; ++n) {
+ ; /* empty */
+ }
if (mylen < ++n) {
mylen = n + 80;
if (mybuf != 0)
else
mybuf = typeMalloc(wchar_t, mylen);
}
- for (n = 0; buf[n] != 0; ++n)
+ for (n = 0; buf[n] != 0; ++n) {
mybuf[n] = (wchar_t) buf[n];
+ }
+ mybuf[n] = L'\0';
return _nc_viswbuf2(0, mybuf);
}
#include <curses.priv.h>
-MODULE_ID("$Id: lib_unget_wch.c,v 1.11 2009/04/04 23:57:25 tom Exp $")
+MODULE_ID("$Id: lib_unget_wch.c,v 1.12 2009/10/10 20:01:13 tom Exp $")
/*
* Wrapper for wcrtomb() which obtains the length needed for the given
wcrtomb(string, wch, &state);
for (n = (int) (length - 1); n >= 0; --n) {
- if (NCURSES_SP_NAME(ungetch) (NCURSES_SP_ARGx string[n]) != OK) {
+ if (NCURSES_SP_NAME(ungetch) (NCURSES_SP_ARGx UChar(string[n])) != OK) {
result = ERR;
break;
}
/****************************************************************************
- * Copyright (c) 2008 Free Software Foundation, Inc. *
+ * Copyright (c) 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 *
#define USE_LIBTINFO
#include <progs.priv.h>
-MODULE_ID("$Id: tabs.c,v 1.15 2008/11/23 00:47:51 tom Exp $")
+MODULE_ID("$Id: tabs.c,v 1.16 2009/10/10 16:15:37 tom Exp $")
static void usage(void) GCC_NORETURN;
;
} else {
if (last == ',')
- result[k++] = last;
- result[k++] = ch;
+ result[k++] = (char) last;
+ result[k++] = (char) ch;
}
last = ch;
}
* results, use the ncurses(3) library. On non-Intel machines, SVr4 curses is
* just as good.
*
- * $Id: blue.c,v 1.31 2009/08/29 19:02:25 tom Exp $
+ * $Id: blue.c,v 1.32 2009/10/10 16:16:46 tom Exp $
*/
#include <test.priv.h>
if (selection[i] != NOCARD) {
move(BASEROW + (selection[i] / GRID_WIDTH) * 2 + 3,
(selection[i] % GRID_WIDTH) * 5);
- (void) printw(" %c ", *lp++ = 'a' + i);
+ (void) printw(" %c ", (char) (*lp++ = 'a' + i));
}
};
*lp = '\0';
clrtoeol();
(void) addch(' ');
} while
- (((c = getch()) < 'a' || c > 'd') && (c != 'r') && (c != 'q'));
+ (((c = (char) getch()) < 'a' || c > 'd')
+ && (c != 'r')
+ && (c != 'q'));
}
for (j = 0; j < 4; j++)
* v2.0 featuring strict ANSI/POSIX conformance, November 1993.
* v2.1 with ncurses mouse support, September 1995
*
- * $Id: bs.c,v 1.48 2009/08/29 19:02:25 tom Exp $
+ * $Id: bs.c,v 1.49 2009/10/10 16:01:41 tom Exp $
*/
#include <test.priv.h>
if ((tmpname = getlogin()) != 0) {
(void) strcpy(name, tmpname);
- name[0] = toupper(UChar(name[0]));
+ name[0] = (char) toupper(UChar(name[0]));
} else
(void) strcpy(name, dftname);
/* get a command letter */
prompt(1, "Type one of [%s] to pick a ship.", docked + 1);
do {
- c = getcoord(PLAYER);
+ c = (char) getcoord(PLAYER);
} while
(!strchr(docked, c));
}
do {
- c = getch();
+ c = (char) getch();
} while
(!(strchr("hjklrR", c) || c == FF));
break;
}
hit = IS_SHIP(board[COMPUTER][curx][cury]);
- hits[PLAYER][curx][cury] = (hit ? MARK_HIT : MARK_MISS);
+ hits[PLAYER][curx][cury] = (char) (hit ? MARK_HIT : MARK_MISS);
cgoto(cury, curx);
#ifdef A_COLOR
if (has_colors()) {
bool hit, sunk;
ship_t *ss = NULL;
- hits[COMPUTER][x][y] = (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS;
+ hits[COMPUTER][x][y] = (char) (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS;
(void) mvprintw(PROMPTLINE, 0,
"I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" :
"miss");
/*
* Author: Thomas E. Dickey
*
- * $Id: demo_termcap.c,v 1.11 2009/08/02 00:02:53 tom Exp $
+ * $Id: demo_termcap.c,v 1.12 2009/10/10 16:01:41 tom Exp $
*
* A simple demo of the termcap interface.
*/
cap[2] = 0;
for (c1 = 0; c1 < 256; ++c1) {
- cap[0] = c1;
+ cap[0] = (char) c1;
if (isCapName(c1)) {
for (c2 = 0; c2 < 256; ++c2) {
- cap[1] = c2;
+ cap[1] = (char) c2;
if (isCapName(c2)) {
dumpit(cap);
}
/****************************************************************************
- * Copyright (c) 1999-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-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 *
/*
* Author: Thomas E. Dickey <dickey@clark.net> 1999
*
- * $Id: dots.c,v 1.17 2008/02/09 18:08:50 tom Exp $
+ * $Id: dots.c,v 1.19 2009/10/10 16:22:24 tom Exp $
*
* A simple demo of the terminfo interface.
*/
static int
outc(TPUTS_ARG c)
{
+ int rc = c;
+
if (interrupted) {
- char tmp = c;
- write(STDOUT_FILENO, &tmp, 1);
+ char tmp = (char) c;
+ if (write(STDOUT_FILENO, &tmp, 1) == -1)
+ rc = EOF;
} else {
- putc(c, stdout);
+ rc = putc(c, stdout);
}
return 0;
}
/****************************************************************************
- * Copyright (c) 2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-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 *
/*
* Author: Thomas E. Dickey - 2007
*
- * $Id: dots_mvcur.c,v 1.3 2008/02/09 18:08:57 tom Exp $
+ * $Id: dots_mvcur.c,v 1.4 2009/10/10 16:14:24 tom Exp $
*
* A simple demo of the terminfo interface, and mvcur.
*/
static int
outc(TPUTS_ARG c)
{
+ int rc = c;
+
if (interrupted) {
- char tmp = c;
- write(STDOUT_FILENO, &tmp, 1);
+ char tmp = (char) c;
+ if (write(STDOUT_FILENO, &tmp, 1) == -1)
+ rc = EOF;
} else {
- putc(c, stdout);
+ if (putc(c, stdout) == EOF)
+ rc = EOF;
}
- return 0;
+ return rc;
}
static bool
/****************************************************************************
- * 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 *
*
* Generate timing statistics for vertical-motion optimization.
*
- * $Id: hashtest.c,v 1.29 2008/08/16 17:26:44 tom Exp $
+ * $Id: hashtest.c,v 1.30 2009/10/10 16:14:53 tom Exp $
*/
#include <test.priv.h>
#endif
if (reverse_loops)
- for (ch = hi; ch >= lo; ch--)
+ for (ch = (char) hi; ch >= lo; ch--)
one_cycle(ch);
else
- for (ch = lo; ch <= hi; ch++)
+ for (ch = (char) lo; ch <= hi; ch++)
one_cycle(ch);
}
* authorization. *
****************************************************************************/
/*
- * $Id: inserts.c,v 1.19 2009/09/12 22:50:03 tom Exp $
+ * $Id: inserts.c,v 1.20 2009/10/10 16:01:41 tom Exp $
*
* Demonstrate the winsstr() and winsch functions.
* Thomas Dickey - 2002/10/19
beep();
break;
}
- buffer[length++] = ch;
+ buffer[length++] = (char) ch;
buffer[length] = '\0';
/* put the string in, one character at a time */
/****************************************************************************
- * Copyright (c) 2000-2007,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2000-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 *
/*
* Author: Thomas E. Dickey - 2000
*
- * $Id: railroad.c,v 1.17 2008/12/07 02:07:41 juergen Exp $
+ * $Id: railroad.c,v 1.18 2009/10/10 16:14:42 tom Exp $
*
* A simple demo of the termcap interface.
*/
outc(TPUTS_ARG c)
{
if (interrupted) {
- char tmp = c;
+ char tmp = (char) c;
write(STDOUT_FILENO, &tmp, 1);
} else {
putc(c, stdout);
/****************************************************************************
- * Copyright (c) 2007 Free Software Foundation, Inc. *
+ * Copyright (c) 2007,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 *
* authorization. *
****************************************************************************/
/*
- * $Id: savescreen.c,v 1.10 2007/07/21 17:57:37 tom Exp $
+ * $Id: savescreen.c,v 1.11 2009/10/10 19:38:21 tom Exp $
*
* Demonstrate save/restore functions from the curses library.
* Thomas Dickey - 2007/7/14
#include <test.priv.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
static bool use_init = FALSE;
+static int
+fexists(const char *name)
+{
+ struct stat sb;
+ return (stat(name, &sb) == 0 && (sb.st_mode & S_IFMT) == S_IFREG);
+}
+
static void
setup_next(void)
{
}
}
+ files = argv + optind;
+ last = argc - optind - 1;
+
+ if (replaying) {
+ while (last >= 0 && !fexists(files[last]))
+ --last;
+ }
+
initscr();
cbreak();
noecho();
}
}
- files = argv + optind;
- last = argc - optind - 1;
if (replaying) {
/*
#!/bin/sh
##############################################################################
-# Copyright (c) 2007 Free Software Foundation, Inc. #
+# Copyright (c) 2007,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 "Software"), #
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: savescreen.sh,v 1.3 2007/07/14 21:50:26 tom Exp $
+# $Id: savescreen.sh,v 1.4 2009/10/10 17:08:45 tom Exp $
#
# Use this script to exercise "savescreen".
# It starts by generating a series of temporary-filenames, which are passed
while test -f $BEGINS
do
./savescreen -r $PARAMS
+ test $? != 0 && break
done
else
echo "No screens were saved"
* authorization. *
****************************************************************************/
/*
- * $Id: test_addchstr.c,v 1.4 2009/09/13 00:00:58 tom Exp $
+ * $Id: test_addchstr.c,v 1.5 2009/10/10 16:01:41 tom Exp $
*
* Demonstrate the waddchstr() and waddch functions.
* Thomas Dickey - 2009/9/12
beep();
break;
}
- buffer[length++] = ch;
+ buffer[length++] = (char) ch;
buffer[length] = '\0';
/* put the string in, one character at a time */
* authorization. *
****************************************************************************/
/*
- * $Id: test_addstr.c,v 1.2 2009/09/12 22:52:29 tom Exp $
+ * $Id: test_addstr.c,v 1.3 2009/10/10 16:01:41 tom Exp $
*
* Demonstrate the waddstr() and waddch functions.
* Thomas Dickey - 2009/9/12
beep();
break;
}
- buffer[length++] = ch;
+ buffer[length++] = (char) ch;
buffer[length] = '\0';
/* put the string in, one character at a time */