-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1992 2012/12/09 00:24:36 tom Exp $
+-- $Id: NEWS,v 1.1998 2012/12/16 00:13:07 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.
+20121215
+ + fix several warnings from clang 3.1 --analyze, includes correcting
+ a null-pointer check in _nc_mvcur_resume.
+ + correct display of double-width characters with MinGW port (report
+ by Erwin Waterlander).
+ + replace MinGW's wcrtomb(), fixing a problem with _nc_viscbuf
+ > fixes based on Coverity report:
+ + correct coloring in test/bs.c
+ + correct check for 8-bit value in _nc_insert_ch().
+ + remove dead code in progs/tset.c, test/linedata.h
+ + add null-pointer checks in lib_tracemse.c, panel.priv.h, and some
+ test-programs.
+
20121208
+ modify test/knight.c to show the number of choices possible for
each position in automove option, e.g., to allow user to follow
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.904 2012/12/08 15:04:46 tom Exp $
+# $Id: dist.mk,v 1.905 2012/12/15 16:32:44 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 = 9
-NCURSES_PATCH = 20121208
+NCURSES_PATCH = 20121215
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_color.c,v 1.105 2012/06/09 20:34:11 tom Exp $")
+MODULE_ID("$Id: lib_color.c,v 1.106 2012/12/15 19:14:34 tom Exp $")
#ifdef USE_TERM_DRIVER
#define CanChange InfoOf(SP_PARM).canchange
1, outc);
return;
} else if (SP_PARM != 0) {
- pair_content((short) pair, &fg, &bg);
+ if (pair_content((short) pair, &fg, &bg) == ERR)
+ return;
}
}
/****************************************************************************
- * Copyright (c) 1998-2008,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 *
#include <curses.priv.h>
#include <ctype.h>
-MODULE_ID("$Id: lib_insch.c,v 1.32 2009/10/24 22:04:35 tom Exp $")
+MODULE_ID("$Id: lib_insch.c,v 1.33 2012/12/15 22:51:12 tom Exp $")
/*
* Insert the given character, updating the current location to simplify
#if USE_WIDEC_SUPPORT
WINDOW_EXT(win, addch_used) == 0 &&
#endif
- is8bits(ChCharOf(ch)) &&
+ is8bits(ch) &&
(isprint(ChCharOf(ch)) ||
(ChAttrOf(ch) & A_ALTCHARSET) ||
(sp != 0 && sp->_legacy_coding && !iscntrl(ChCharOf(ch))))) {
*temp1 = _nc_render(win, wch);
win->_curx++;
}
- } else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) {
+ } else if (is8bits(ch) && iscntrl(ChCharOf(ch))) {
s = NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx ChCharOf(ch));
while (*s != '\0') {
code = _nc_insert_ch(sp, win, ChAttrOf(ch) | UChar(*s));
****************************************************************************/
/*
- * $Id: curses.priv.h,v 1.512 2012/12/08 20:19:40 tom Exp $
+ * $Id: curses.priv.h,v 1.514 2012/12/15 20:03:45 tom Exp $
*
* curses.priv.h
*
AttrOf(dst) |= (attr_t) (ext + 1)
#define if_WIDEC(code) code
-#define Charable(ch) ((SP_PARM != 0 && SP_PARM->_legacy_coding) \
+#define Charable(ch) ((SP_PARM->_legacy_coding) \
|| (AttrOf(ch) & A_ALTCHARSET) \
|| (!isWidecExt(ch) && \
(ch).chars[1] == L'\0' && \
extern int __MINGW_NOTHROW _nc_wctomb(char *, wchar_t);
#define wctomb(s,wc) _nc_wctomb(s,wc)
+#define wcrtomb(s,wc,n) _nc_wctomb(s,wc)
extern int __MINGW_NOTHROW _nc_mbtowc(wchar_t *, const char *, size_t);
#define mbtowc(pwc,s,n) _nc_mbtowc(pwc,s,n)
#include <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.154 2012/12/08 22:01:26 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.155 2012/12/15 19:04:54 tom Exp $")
/****************************************************************************
*
* 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->_resize != 0) {
+ if (sp != 0 && sp->_resize != 0) {
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)) {
#include <ctype.h>
-MODULE_ID("$Id: make_hash.c,v 1.9 2012/11/18 01:30:03 tom Exp $")
+MODULE_ID("$Id: make_hash.c,v 1.10 2012/12/16 00:40:14 tom Exp $")
/*
* _nc_make_hash_table()
printf("static struct name_table_entry *_nc_%s_table = 0;\n\n", root_name);
} else {
- printf("static struct name_table_entry %s _nc_%s_table[] =\n",
- bigstring ? "" : "const",
+ printf("static struct name_table_entry const _nc_%s_table[] =\n",
root_name);
printf("{\n");
for (n = 0; n < CAPTABSIZE; n++) {
#include <tic.h>
-MODULE_ID("$Id: trim_sgr0.c,v 1.14 2012/02/22 22:34:31 tom Exp $")
+MODULE_ID("$Id: trim_sgr0.c,v 1.15 2012/12/15 20:57:17 tom Exp $")
#undef CUR
#define CUR tp->
static char *
set_attribute_9(TERMTYPE *tp, int flag)
{
- const char *result;
+ const char *value;
+ char *result;
- if ((result = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag)) == 0)
- result = "";
- return strdup(result);
+ value = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag);
+ if (PRESENT(value))
+ result = strdup(value);
+ else
+ result = 0;
+ return result;
}
static int
is_csi(const char *s)
{
- if (UChar(s[0]) == CSI)
- return 1;
- else if (s[0] == ESC && s[1] == L_BRACK)
- return 2;
- return 0;
+ int result = 0;
+ if (s != 0) {
+ if (UChar(s[0]) == CSI)
+ result = 1;
+ else if (s[0] == ESC && s[1] == L_BRACK)
+ result = 2;
+ }
+ return result;
}
static char *
static bool
rewrite_sgr(char *s, char *attr)
{
- if (PRESENT(s)) {
+ if (s != 0) {
if (PRESENT(attr)) {
size_t len_s = strlen(s);
size_t len_a = strlen(attr);
similar_sgr(char *a, char *b)
{
bool result = FALSE;
- int csi_a = is_csi(a);
- int csi_b = is_csi(b);
- size_t len_a;
- size_t len_b;
+ if (a != 0 && b != 0) {
+ int csi_a = is_csi(a);
+ int csi_b = is_csi(b);
+ size_t len_a;
+ size_t len_b;
- TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s",
- _nc_visbuf2(1, a),
- _nc_visbuf2(2, b)));
- if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) {
- a += csi_a;
- b += csi_b;
- if (*a != *b) {
- a = skip_zero(a);
- b = skip_zero(b);
+ TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s",
+ _nc_visbuf2(1, a),
+ _nc_visbuf2(2, b)));
+ if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) {
+ a += csi_a;
+ b += csi_b;
+ if (*a != *b) {
+ a = skip_zero(a);
+ b = skip_zero(b);
+ }
}
+ len_a = strlen(a);
+ len_b = strlen(b);
+ if (len_a && len_b) {
+ if (len_a > len_b)
+ result = (strncmp(a, b, len_b) == 0);
+ else
+ result = (strncmp(a, b, len_a) == 0);
+ }
+ TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result,
+ _nc_visbuf2(1, a),
+ _nc_visbuf2(2, b)));
}
- len_a = strlen(a);
- len_b = strlen(b);
- if (len_a && len_b) {
- if (len_a > len_b)
- result = (strncmp(a, b, len_b) == 0);
- else
- result = (strncmp(a, b, len_a) == 0);
- }
- TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result,
- _nc_visbuf2(1, a),
- _nc_visbuf2(2, b)));
return result;
}
#include <curses.priv.h>
-MODULE_ID("$Id: lib_tracemse.c,v 1.20 2012/02/22 22:40:24 tom Exp $")
+MODULE_ID("$Id: lib_tracemse.c,v 1.21 2012/12/15 23:51:19 tom Exp $")
#ifdef TRACE
NCURSES_EXPORT(char *)
_nc_tracemouse(SCREEN *sp, MEVENT const *ep)
{
- _nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer))
- TRACEMSE_FMT,
- ep->id,
- ep->x,
- ep->y,
- ep->z,
- (unsigned long) ep->bstate);
-
- (void) _trace_mmask_t(sp, ep->bstate);
- _nc_STRCAT(my_buffer, "}", sizeof(my_buffer));
- return (my_buffer);
+ char *result = 0;
+
+ if (sp != 0) {
+ _nc_SPRINTF(my_buffer, _nc_SLIMIT(sizeof(my_buffer))
+ TRACEMSE_FMT,
+ ep->id,
+ ep->x,
+ ep->y,
+ ep->z,
+ (unsigned long) ep->bstate);
+
+ (void) _trace_mmask_t(sp, ep->bstate);
+ _nc_STRCAT(my_buffer, "}", sizeof(my_buffer));
+ result = (my_buffer);
+ }
+ return result;
}
NCURSES_EXPORT(mmask_t)
_nc_retrace_mmask_t(SCREEN *sp, mmask_t code)
{
- *my_buffer = '\0';
- T((T_RETURN("{%s}"), _trace_mmask_t(sp, code)));
+ if (sp != 0) {
+ *my_buffer = '\0';
+ T((T_RETURN("{%s}"), _trace_mmask_t(sp, code)));
+ } else {
+ T((T_RETURN("{?}")));
+ }
return code;
}
/****************************************************************************
- * 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 *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mvcur.c,v 1.127 2011/10/22 16:09:52 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.128 2012/12/15 20:59:27 tom Exp $")
#define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x] /* desired state */
NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_DCL0)
/* what to do at initialization time and after each shellout */
{
- if (SP_PARM && !IsTermInfo(SP_PARM))
+ if (!SP_PARM || !IsTermInfo(SP_PARM))
return;
/* initialize screen for cursor access */
NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
/* initialize the cost structure */
{
- if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp)))
+ if (SP_PARM->_ofp && isatty(fileno(SP_PARM->_ofp))) {
SP_PARM->_char_padding = ((BAUDBYTE * 1000 * 10)
/ (BAUDRATE(SP_PARM) > 0
? BAUDRATE(SP_PARM)
: 9600));
- else
+ } else {
SP_PARM->_char_padding = 1; /* must be nonzero */
+ }
if (SP_PARM->_char_padding <= 0)
SP_PARM->_char_padding = 1; /* must be nonzero */
TR(TRACE_CHARPUT | TRACE_MOVE, ("char_padding %d msecs", SP_PARM->_char_padding));
#include <ctype.h>
-MODULE_ID("$Id: tty_update.c,v 1.271 2012/08/25 21:04:03 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.272 2012/12/15 21:00:19 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
{
int j;
- if (SP_PARM != 0) {
- if (CurScreen(SP_PARM) != 0
- && SP_PARM->_cursrow >= 0) {
- for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
- if (j >= 0) {
- NCURSES_CH_T *cp =
- &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
-
- if (!CharEq(*cp, blank)) {
- *cp = blank;
- needclear = TRUE;
- }
+ if (CurScreen(SP_PARM) != 0
+ && SP_PARM->_cursrow >= 0) {
+ for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
+ if (j >= 0) {
+ NCURSES_CH_T *cp =
+ &(CurScreen(SP_PARM)->_line[SP_PARM->_cursrow].text[j]);
+
+ if (!CharEq(*cp, blank)) {
+ *cp = blank;
+ needclear = TRUE;
}
}
}
}
- if (needclear && (SP_PARM != 0)) {
+ if (needclear) {
UpdateAttrs(SP_PARM, blank);
TPUTS_TRACE("clr_eol");
if (clr_eol && SP_PARM->_el_cost <= (screen_columns(SP_PARM) - SP_PARM->_curscol)) {
{
int row, col;
- if (0 == SP_PARM)
- return;
-
row = SP_PARM->_cursrow;
col = SP_PARM->_curscol;
NCURSES_EXPORT(void)
NCURSES_SP_NAME(_nc_screen_wrap) (NCURSES_SP_DCL0)
{
- if (SP_PARM == 0)
- return;
+ if (SP_PARM != 0) {
- UpdateAttrs(SP_PARM, normal);
+ UpdateAttrs(SP_PARM, normal);
#if NCURSES_EXT_FUNCS
- if (SP_PARM->_coloron
- && !SP_PARM->_default_color) {
- static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
- SP_PARM->_default_color = TRUE;
- NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
- -1,
- 0,
- FALSE,
- NCURSES_SP_NAME(_nc_outch));
- SP_PARM->_default_color = FALSE;
-
- TINFO_MVCUR(NCURSES_SP_ARGx
- SP_PARM->_cursrow,
- SP_PARM->_curscol,
- screen_lines(SP_PARM) - 1,
- 0);
-
- ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
- }
+ if (SP_PARM->_coloron
+ && !SP_PARM->_default_color) {
+ static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
+ SP_PARM->_default_color = TRUE;
+ NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_ARGx
+ -1,
+ 0,
+ FALSE,
+ NCURSES_SP_NAME(_nc_outch));
+ SP_PARM->_default_color = FALSE;
+
+ TINFO_MVCUR(NCURSES_SP_ARGx
+ SP_PARM->_cursrow,
+ SP_PARM->_curscol,
+ screen_lines(SP_PARM) - 1,
+ 0);
+
+ ClrToEOL(NCURSES_SP_ARGx blank, TRUE);
+ }
#endif
- if (SP_PARM->_color_defs) {
- NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
+ if (SP_PARM->_color_defs) {
+ NCURSES_SP_NAME(_nc_reset_colors) (NCURSES_SP_ARG);
+ }
}
}
/****************************************************************************
- * Copyright (c) 2001-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 2001-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 *
#include <curses.priv.h>
-MODULE_ID("$Id: lib_wunctrl.c,v 1.15 2011/05/28 22:06:26 tom Exp $")
+MODULE_ID("$Id: lib_wunctrl.c,v 1.16 2012/12/15 20:53:42 tom Exp $")
NCURSES_EXPORT(wchar_t *)
NCURSES_SP_NAME(wunctrl) (NCURSES_SP_DCLx cchar_t *wc)
if (wc == 0) {
result = 0;
- } else if (Charable(*wc)) {
+ } else if (SP_PARM != 0 && Charable(*wc)) {
const char *p =
NCURSES_SP_NAME(unctrl) (NCURSES_SP_ARGx
(unsigned) _nc_to_char((wint_t)CharOf(*wc)));
#include <curses.priv.h>
#define CUR my_term.type.
-MODULE_ID("$Id: win_driver.c,v 1.14 2012/09/22 19:15:14 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.15 2012/12/15 19:39:49 tom Exp $")
#define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
* TODO: _nc_wacs should be part of sp.
*/
static BOOL
-con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int n)
+con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
{
- CHAR_INFO ci[n];
+ int actual = 0;
+ CHAR_INFO ci[limit];
COORD loc, siz;
SMALL_RECT rec;
int i;
SetSP();
- for (i = 0; i < n; i++) {
+ for (i = actual = 0; i < limit; i++) {
ch = str[i];
- ci[i].Char.UnicodeChar = CharOf(ch);
- ci[i].Attributes = MapAttr(TCB,
- PropOf(TCB)->SBI.wAttributes,
- AttrOf(ch));
+ if (isWidecExt(ch))
+ continue;
+ ci[actual].Char.UnicodeChar = CharOf(ch);
+ ci[actual].Attributes = MapAttr(TCB,
+ PropOf(TCB)->SBI.wAttributes,
+ AttrOf(ch));
if (AttrOf(ch) & A_ALTCHARSET) {
if (_nc_wacs) {
int which = CharOf(ch);
if (which > 0
&& which < ACS_LEN
&& CharOf(_nc_wacs[which]) != 0) {
- ci[i].Char.UnicodeChar = CharOf(_nc_wacs[which]);
+ ci[actual].Char.UnicodeChar = CharOf(_nc_wacs[which]);
} else {
- ci[i].Char.UnicodeChar = ' ';
+ ci[actual].Char.UnicodeChar = ' ';
}
}
}
+ ++actual;
}
loc.X = (short) 0;
loc.Y = (short) 0;
- siz.X = (short) n;
+ siz.X = (short) actual;
siz.Y = 1;
rec.Left = (short) x;
rec.Top = (short) y;
- rec.Right = (short) (x + n - 1);
+ rec.Right = (short) (x + limit - 1);
rec.Bottom = rec.Top;
return WriteConsoleOutputW(TCB->hdl, ci, siz, loc, &rec);
-ncurses6 (5.9-20121208) unstable; urgency=low
+ncurses6 (5.9-20121215) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 08 Dec 2012 10:12:21 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 15 Dec 2012 11:32:40 -0500
ncurses6 (5.9-20120608) unstable; urgency=low
Summary: shared libraries for terminal handling
Name: ncurses6
Release: 5.9
-Version: 20121208
+Version: 20121215
License: X11
Group: Development/Libraries
Source: ncurses-%{release}-%{version}.tgz
/****************************************************************************
- * Copyright (c) 1998-2009,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 *
* authorization. *
****************************************************************************/
-/* $Id: panel.priv.h,v 1.24 2011/05/21 18:55:07 tom Exp $ */
+/* $Id: panel.priv.h,v 1.25 2012/12/15 23:57:43 tom Exp $ */
#ifndef NCURSES_PANEL_PRIV_H
#define NCURSES_PANEL_PRIV_H 1
#define GetScreenHook(sp) \
struct panelhook* ph = NCURSES_SP_NAME(_nc_panelhook)(sp)
#define GetPanelHook(pan) \
- GetScreenHook(_nc_screen_of((pan)->win))
+ GetScreenHook(pan ? _nc_screen_of((pan)->win) : 0)
#define GetWindowHook(win) \
SCREEN* sp = _nc_screen_of(win); \
GetScreenHook(sp)
#include "termsort.c" /* this C file is generated */
#include <parametrized.h> /* so is this */
-MODULE_ID("$Id: dump_entry.c,v 1.101 2012/10/27 19:45:17 tom Exp $")
+MODULE_ID("$Id: dump_entry.c,v 1.102 2012/12/15 18:25:56 tom Exp $")
#define INDENT 8
#define DISCARD(string) string = ABSENT_STRING
#define StrIndirect(j) ((sortmode == S_NOSORT) ? (j) : str_indirect[j])
#endif
+static void failed(const char *) GCC_NORETURN;
+
static void
failed(const char *s)
{
}
}
/* e.g., trimmed_sgr0 */
- if (capability != tterm->Strings[i])
+ if (capability != ABSENT_STRING &&
+ capability != CANCELLED_STRING &&
+ capability != tterm->Strings[i])
free(capability);
}
len += (int) (num_strings * 2);
#include <hashed_db.h>
#include <transform.h>
-MODULE_ID("$Id: tic.c,v 1.180 2012/12/08 22:17:22 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.182 2012/12/16 00:03:12 tom Exp $")
#define STDIN_NAME "<stdin>"
return (code);
}
-static const char *
+static char *
valid_db_path(const char *nominal)
{
struct stat sb;
show_databases(const char *outdir)
{
bool specific = (outdir != 0) || getenv("TERMINFO") != 0;
- const char *result;
+ char *result;
const char *tried = 0;
if (outdir == 0) {
}
if ((result = valid_db_path(outdir)) != 0) {
printf("%s\n", result);
+ free(result);
} else {
tried = outdir;
}
if ((outdir = _nc_home_terminfo())) {
if ((result = valid_db_path(outdir)) != 0) {
printf("%s\n", result);
+ free(result);
} else if (!specific) {
tried = outdir;
}
#include <dump_entry.h>
#include <transform.h>
-MODULE_ID("$Id: tset.c,v 1.89 2012/02/22 22:50:47 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.90 2012/12/15 23:01:17 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
mapp->speed = tbaudrate(p);
}
- if (arg == (char *) 0) /* Non-optional type. */
- goto badmopt;
-
mapp->type = arg;
/* Terminate porttype, if specified. */
* v2.0 featuring strict ANSI/POSIX conformance, November 1993.
* v2.1 with ncurses mouse support, September 1995
*
- * $Id: bs.c,v 1.56 2012/12/08 23:35:58 tom Exp $
+ * $Id: bs.c,v 1.59 2012/12/16 00:20:49 tom Exp $
*/
#include <test.priv.h>
static char destroy[] = "Destroyer";
static char ptboat[] = "PT Boat";
-static char name[40];
+static char *your_name;
static char dftname[] = "stranger";
/* direction constants */
CATCHALL(uninitgame);
- if ((tmpname = getlogin()) != 0) {
- (void) strcpy(name, tmpname);
- name[0] = (char) toupper(UChar(name[0]));
- } else
- (void) strcpy(name, dftname);
+ if ((tmpname = getlogin()) != 0 &&
+ (your_name = strdup(tmpname)) != 0) {
+ your_name[0] = (char) toupper(UChar(your_name[0]));
+ } else {
+ your_name = dftname;
+ }
(void) initscr();
keypad(stdscr, TRUE);
bool hit, sunk;
ship_t *ss = NULL;
- hit = board[PLAYER][x][y] ? MARK_HIT : MARK_MISS;
- hits[COMPUTER][x][y] = (char) hit;
+ hit = board[PLAYER][x][y];
+ hits[COMPUTER][x][y] = (hit ? MARK_HIT : MARK_MISS);
MvPrintw(PROMPTLINE, 0,
"I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" :
"miss");
++cpuwon;
else
++plywon;
- j = 18 + (int) strlen(name);
+ j = 18 + (int) strlen(your_name);
if (plywon >= 10)
++j;
if (cpuwon >= 10)
++j;
MvPrintw(1, (COLWIDTH - j) / 2,
- "%s: %d Computer: %d", name, plywon, cpuwon);
+ "%s: %d Computer: %d", your_name, plywon, cpuwon);
prompt(2, (awinna())? "Want to be humiliated again, %s [yn]? "
- : "Going to give me a chance for revenge, %s [yn]? ", name);
+ : "Going to give me a chance for revenge, %s [yn]? ", your_name);
return (sgetc("YN") == 'Y');
}
/****************************************************************************
- * Copyright (c) 2003-2006,2008 Free Software Foundation, Inc. *
+ * Copyright (c) 2003-2008,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 *
* authorization. *
****************************************************************************/
/*
- * $Id: color_set.c,v 1.6 2008/02/10 00:18:01 tom Exp $
+ * $Id: color_set.c,v 1.7 2012/12/15 22:04:14 tom Exp $
*/
#include <test.priv.h>
if (has_colors()) {
start_color();
- pair_content(0, &f, &b);
+ (void) pair_content(0, &f, &b);
printw("pair 0 contains (%d,%d)\n", f, b);
getch();
* authorization. *
****************************************************************************/
/*
- * $Id: ins_wide.c,v 1.19 2012/12/09 01:13:56 tom Exp $
+ * $Id: ins_wide.c,v 1.20 2012/12/16 00:51:02 tom Exp $
*
* Demonstrate the wins_wstr() and wins_wch functions.
* Thomas Dickey - 2002/11/23
case key_RECUR:
test_inserts(level + 1);
- touchwin(look);
+ if (look)
+ touchwin(look);
touchwin(work);
touchwin(show);
- wnoutrefresh(look);
+ if (look)
+ wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
* authorization. *
****************************************************************************/
/*
- * $Id: inserts.c,v 1.26 2012/12/09 00:51:51 tom Exp $
+ * $Id: inserts.c,v 1.27 2012/12/16 00:35:27 tom Exp $
*
* Demonstrate the winsstr() and winsch functions.
* Thomas Dickey - 2002/10/19
case key_RECUR:
test_inserts(level + 1);
- touchwin(look);
+ if (look)
+ touchwin(look);
touchwin(work);
touchwin(show);
- wnoutrefresh(look);
+ if (look)
+ wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
/****************************************************************************
- * Copyright (c) 2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 2009-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 *
beep();
continue;
}
- } else if (code != ERR) {
- result = (int) ch;
- break;
} else {
+ result = (int) ch;
break;
}
}
* authorization. *
****************************************************************************/
/*
- * $Id: movewindow.c,v 1.37 2012/10/27 19:37:56 tom Exp $
+ * $Id: movewindow.c,v 1.38 2012/12/15 18:36:40 tom Exp $
*
* Demonstrate move functions for windows and derived windows from the curses
* library.
res.x = ulj + j;
return (&res);
}
- i %= si;
- j %= sj;
+
+ if (si <= 0)
+ i = 0;
+ else
+ i %= si;
+
+ if (sj <= 0)
+ j = 0;
+ else
+ j %= sj;
/*
* If the caller can handle continuous movement, return the result.
* authorization. *
****************************************************************************/
/*
- * $Id: test_add_wchstr.c,v 1.19 2012/11/24 20:04:13 tom Exp $
+ * $Id: test_add_wchstr.c,v 1.20 2012/12/16 00:12:04 tom Exp $
*
* Demonstrate the waddwchstr() and wadd_wch functions.
* Thomas Dickey - 2009/9/12
case key_RECUR:
test_add_wchstr(level + 1);
- touchwin(look);
+ if (look)
+ touchwin(look);
touchwin(work);
touchwin(show);
- wnoutrefresh(look);
+ if (look)
+ wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
* authorization. *
****************************************************************************/
/*
- * $Id: test_addchstr.c,v 1.17 2012/12/09 00:50:39 tom Exp $
+ * $Id: test_addchstr.c,v 1.18 2012/12/16 00:36:27 tom Exp $
*
* Demonstrate the waddchstr() and waddch functions.
* Thomas Dickey - 2009/9/12
case key_RECUR:
test_adds(level + 1);
- touchwin(look);
+ if (look)
+ touchwin(look);
touchwin(work);
touchwin(show);
- wnoutrefresh(look);
+ if (look)
+ wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
* authorization. *
****************************************************************************/
/*
- * $Id: test_addstr.c,v 1.9 2012/11/24 19:49:02 tom Exp $
+ * $Id: test_addstr.c,v 1.10 2012/12/16 00:14:10 tom Exp $
*
* Demonstrate the waddstr() and waddch functions.
* Thomas Dickey - 2009/9/12
case key_RECUR:
test_adds(level + 1);
- touchwin(look);
+ if (look)
+ touchwin(look);
touchwin(work);
touchwin(show);
- wnoutrefresh(look);
+ if (look)
+ wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
* authorization. *
****************************************************************************/
/*
- * $Id: test_addwstr.c,v 1.10 2012/11/24 20:04:54 tom Exp $
+ * $Id: test_addwstr.c,v 1.11 2012/12/16 00:11:18 tom Exp $
*
* Demonstrate the waddwstr() and wadd_wch functions.
* Thomas Dickey - 2009/9/12
case key_RECUR:
test_inserts(level + 1);
- touchwin(look);
+ if (look)
+ touchwin(look);
touchwin(work);
touchwin(show);
- wnoutrefresh(look);
+ if (look)
+ wnoutrefresh(look);
wnoutrefresh(work);
wnoutrefresh(show);
traces will be dumped. The program stops and waits for one character of
input at the beginning and end of the interval.
- $Id: worm.c,v 1.61 2012/10/27 19:37:17 tom Exp $
+ $Id: worm.c,v 1.62 2012/12/15 18:32:40 tom Exp $
*/
#include <test.priv.h>
struct worm *w;
int *ip;
bool done = FALSE;
+ int max_refs;
setlocale(LC_ALL, "");
}
#endif /* A_COLOR */
- refs = typeMalloc(int *, (size_t) LINES);
- for (y = 0; y < LINES; y++) {
+ max_refs = LINES;
+ refs = typeMalloc(int *, (size_t) max_refs);
+ for (y = 0; y < max_refs; y++) {
refs[y] = typeMalloc(int, (size_t) COLS);
for (x = 0; x < COLS; x++) {
refs[y][x] = 0;
Trace(("Cleanup"));
cleanup();
#ifdef NO_LEAKS
- for (y = 0; y < LINES; y++) {
+ for (y = 0; y < max_refs; y++) {
free(refs[y]);
}
free(refs);