]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.7 - patch 20091010
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 11 Oct 2009 00:32:49 +0000 (00:32 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 11 Oct 2009 00:32:49 +0000 (00:32 +0000)
+ 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

22 files changed:
NEWS
dist.mk
form/frm_driver.c
form/frm_req_name.c
menu/m_req_name.c
ncurses/base/lib_screen.c
ncurses/tinfo/lib_tputs.c
ncurses/trace/visbuf.c
ncurses/widechar/lib_unget_wch.c
progs/tabs.c
test/blue.c
test/bs.c
test/demo_termcap.c
test/dots.c
test/dots_mvcur.c
test/hashtest.c
test/inserts.c
test/railroad.c
test/savescreen.c
test/savescreen.sh
test/test_addchstr.c
test/test_addstr.c

diff --git a/NEWS b/NEWS
index f6100a5b1e4b9a45cfa8dbd532619db7d0effbb8..290024f77825f88b511249bc6fbc6d20f4ef2df1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.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
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,12 @@ 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.
 
 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).
 20091003
        + add WACS_xxx definitions to wide-character configuration for thick-
          and double-lines (discussion with Slava Zanko).
diff --git a/dist.mk b/dist.mk
index 433bb1c3fa8a5a31787cc66220df54655ffe6804..dec30479768978aaec3b73f56ffec30dc6012ac0 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.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
 # 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 = 7
 # 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)
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 8d9bd3ba6f5091ead1be0eb3aac5c0e9d2018284..4847149ea34f157a3e1cec4dd268c535b1e21df6 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
 
 #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
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
@@ -4534,7 +4534,7 @@ _nc_Widen_String(char *source, int *lengthp)
              source[passed + tries] = 0;
              reset_mbytes(state);
              status = trans_mbytes(wch, source + passed, tries, state);
              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)
                {
 
              if (status > 0)
                {
index 7ac9abe6e29927ca09cd9b662398698de184c583..99abd7e3c1d9742538775306aa99caf750c55e42 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "form.priv.h"
 
 
 #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] =
 {
 
 static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
 {
@@ -154,14 +154,14 @@ form_request_by_name(const char *str)
       strncpy(buf, str, sizeof(buf));
       while ((i < sizeof(buf)) && (buf[i] != '\0'))
        {
       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)
          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);
        }
     }
   RETURN(E_NO_MATCH);
index 6fd51b1c361e4629e779f03bc83f35e6d885fe69..cad87580207128346ed1a30d07ea9cf6229c68d0 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
 
 #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] =
 {
 
 static const char *request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1] =
 {
@@ -109,7 +109,7 @@ menu_request_by_name(const char *str)
       strncpy(buf, str, sizeof(buf));
       while ((i < sizeof(buf)) && (buf[i] != '\0'))
        {
       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++;
        }
 
          i++;
        }
 
index 176edc4e43c04d2c20a0e6c1933e048997bf964e..34af68a3e4a94fde729a53692261a27e576743b9 100644 (file)
@@ -39,7 +39,7 @@
 #define CUR SP_TERMTYPE
 #endif
 
 #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 */
 
 
 #define MAX_SIZE 0x3fff                /* 16k is big enough for a window or pad */
 
@@ -52,17 +52,19 @@ NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
     T((T_CALLED("getwin(%p)"), filep));
 
     clearerr(filep);
     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._maxy == 0
        || tmp._maxy > MAX_SIZE
        || tmp._maxx == 0
-       || tmp._maxx > MAX_SIZE)
+       || tmp._maxx > MAX_SIZE) {
        returnWin(0);
        returnWin(0);
+    }
 
     if (tmp._flags & _ISPAD) {
        nwin = NCURSES_SP_NAME(newpad) (NCURSES_SP_ARGx
 
     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,
     } else {
        nwin = NCURSES_SP_NAME(newwin) (NCURSES_SP_ARGx
                                        tmp._maxy + 1,
@@ -75,6 +77,8 @@ NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
      * made sense is probably gone.
      */
     if (nwin != 0) {
      * 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;
        nwin->_curx = tmp._curx;
        nwin->_cury = tmp._cury;
        nwin->_maxy = tmp._maxy;
@@ -106,11 +110,8 @@ NCURSES_SP_NAME(getwin) (NCURSES_SP_DCLx FILE *filep)
 
        for (n = 0; n <= nwin->_maxy; n++) {
            clearerr(filep);
 
        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);
            }
                delwin(nwin);
                returnWin(0);
            }
index b123cceef243eece1fe0aaefe3fa29bf1284f9a2..9d859527f4439c5bbf44dabc19fd8a139e38f9ce 100644 (file)
@@ -51,7 +51,7 @@
 #include <termcap.h>           /* ospeed */
 #include <tic.h>
 
 #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_VAR(char) PC = 0;              /* used by termcap library */
 NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0;        /* used by termcap library */
@@ -129,21 +129,25 @@ _nc_flush(void)
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch)
 {
 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) {
     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.
         */
        /*
         * 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 {
     } 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
 }
 
 #if NCURSES_SP_FUNCS
index 0b64ccc65a7fb47d1764dfa837d39a2eea768be3..820f84cb8fa2888bfc50d9938d3ade953ae3aa08 100644 (file)
@@ -42,7 +42,7 @@
 #include <tic.h>
 #include <ctype.h>
 
 #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
 
 
 #define NUM_VISBUFS 4
 
@@ -238,7 +238,9 @@ _nc_viswibuf(const wint_t *buf)
     static unsigned mylen;
     unsigned n;
 
     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)
     if (mylen < ++n) {
        mylen = n + 80;
        if (mybuf != 0)
@@ -246,8 +248,10 @@ _nc_viswibuf(const wint_t *buf)
        else
            mybuf = typeMalloc(wchar_t, mylen);
     }
        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] = (wchar_t) buf[n];
+    }
+    mybuf[n] = L'\0';
 
     return _nc_viswbuf2(0, mybuf);
 }
 
     return _nc_viswbuf2(0, mybuf);
 }
index 1d2cf83ef8d2fcf0cdf7a0e1d11b18003a2a0f42..d17e618ccf47fc9ad9660f1d09c83475cc8f7986 100644 (file)
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
 
 #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
 
 /*
  * Wrapper for wcrtomb() which obtains the length needed for the given
@@ -86,7 +86,7 @@ NCURSES_SP_NAME(unget_wch) (NCURSES_SP_DCLx const wchar_t wch)
            wcrtomb(string, wch, &state);
 
            for (n = (int) (length - 1); n >= 0; --n) {
            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;
                }
                    result = ERR;
                    break;
                }
index f3cc42fb7b009d9319668950ebd4ac27ac1132f5..aafaa2d8f37cf702a224a1ca8ad44e7889b7783e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 #define USE_LIBTINFO
 #include <progs.priv.h>
 
 #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;
 
 
 static void usage(void) GCC_NORETURN;
 
@@ -210,8 +210,8 @@ trimmed_tab_list(const char *source)
                ;
            } else {
                if (last == ',')
                ;
            } else {
                if (last == ',')
-                   result[k++] = last;
-               result[k++] = ch;
+                   result[k++] = (char) last;
+               result[k++] = (char) ch;
            }
            last = ch;
        }
            }
            last = ch;
        }
index 84199132bad6cdb0bc178a7ec82f678dd3349887..a798c9d50f579a99d56bf1ef5394adaa8eb409bb 100644 (file)
@@ -40,7 +40,7 @@
  * results, use the ncurses(3) library.  On non-Intel machines, SVr4 curses is
  * just as good.
  *
  * 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>
  */
 
 #include <test.priv.h>
@@ -300,7 +300,7 @@ play_game(void)
                if (selection[i] != NOCARD) {
                    move(BASEROW + (selection[i] / GRID_WIDTH) * 2 + 3,
                         (selection[i] % GRID_WIDTH) * 5);
                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';
                }
            };
            *lp = '\0';
@@ -326,7 +326,9 @@ play_game(void)
                    clrtoeol();
                    (void) addch(' ');
                } while
                    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++)
            }
 
            for (j = 0; j < 4; j++)
index fd0780bd413a4ffe618101f97e373c664bfc832a..c68d470f9a8a7b498ba7abdd81ff12ffe3b2e464 100644 (file)
--- a/test/bs.c
+++ b/test/bs.c
@@ -34,7 +34,7 @@
  * v2.0 featuring strict ANSI/POSIX conformance, November 1993.
  * v2.1 with ncurses mouse support, September 1995
  *
  * 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>
  */
 
 #include <test.priv.h>
@@ -222,7 +222,7 @@ intro(void)
 
     if ((tmpname = getlogin()) != 0) {
        (void) strcpy(name, tmpname);
 
     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);
 
     } else
        (void) strcpy(name, dftname);
 
@@ -440,7 +440,7 @@ initgame(void)
        /* get a command letter */
        prompt(1, "Type one of [%s] to pick a ship.", docked + 1);
        do {
        /* 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));
 
        } while
            (!strchr(docked, c));
 
@@ -457,7 +457,7 @@ initgame(void)
        }
 
        do {
        }
 
        do {
-           c = getch();
+           c = (char) getch();
        } while
            (!(strchr("hjklrR", c) || c == FF));
 
        } while
            (!(strchr("hjklrR", c) || c == FF));
 
@@ -829,7 +829,7 @@ plyturn(void)
            break;
     }
     hit = IS_SHIP(board[COMPUTER][curx][cury]);
            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()) {
     cgoto(cury, curx);
 #ifdef A_COLOR
     if (has_colors()) {
@@ -952,7 +952,7 @@ cpufire(int x, int y)
     bool hit, sunk;
     ship_t *ss = NULL;
 
     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");
     (void) mvprintw(PROMPTLINE, 0,
                    "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" :
                    "miss");
index b36ba96cc9872e36adebb8cf040e2884b23bf7bb..4289de0540e3cfba1a008300646cbc4bafad9992 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
 /*
  * 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.
  */
  *
  * A simple demo of the termcap interface.
  */
@@ -144,10 +144,10 @@ brute_force(const char *name)
 
        cap[2] = 0;
        for (c1 = 0; c1 < 256; ++c1) {
 
        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) {
            if (isCapName(c1)) {
                for (c2 = 0; c2 < 256; ++c2) {
-                   cap[1] = c2;
+                   cap[1] = (char) c2;
                    if (isCapName(c2)) {
                        dumpit(cap);
                    }
                    if (isCapName(c2)) {
                        dumpit(cap);
                    }
index 2d6471853e08f7daaba00b2c9dce745e76288e73..57e334134ca3f009188fadc4deb913905c61af21 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey <dickey@clark.net> 1999
  *
 /*
  * 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.
  */
  *
  * A simple demo of the terminfo interface.
  */
@@ -49,11 +49,14 @@ static time_t started;
 static int
 outc(TPUTS_ARG c)
 {
 static int
 outc(TPUTS_ARG c)
 {
+    int rc = c;
+
     if (interrupted) {
     if (interrupted) {
-       char tmp = c;
-       write(STDOUT_FILENO, &tmp, 1);
+       char tmp = (char) c;
+       if (write(STDOUT_FILENO, &tmp, 1) == -1)
+           rc = EOF;
     } else {
     } else {
-       putc(c, stdout);
+       rc = putc(c, stdout);
     }
     return 0;
 }
     }
     return 0;
 }
index 775d15c1efbf0138008c6bd57d8c9f23b047d006..611964c1eae823279eb412acefcba70218179970 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey - 2007
  *
 /*
  * 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.
  */
  *
  * A simple demo of the terminfo interface, and mvcur.
  */
@@ -49,13 +49,17 @@ static time_t started;
 static int
 outc(TPUTS_ARG c)
 {
 static int
 outc(TPUTS_ARG c)
 {
+    int rc = c;
+
     if (interrupted) {
     if (interrupted) {
-       char tmp = c;
-       write(STDOUT_FILENO, &tmp, 1);
+       char tmp = (char) c;
+       if (write(STDOUT_FILENO, &tmp, 1) == -1)
+           rc = EOF;
     } else {
     } else {
-       putc(c, stdout);
+       if (putc(c, stdout) == EOF)
+           rc = EOF;
     }
     }
-    return 0;
+    return rc;
 }
 
 static bool
 }
 
 static bool
index 6e1b00b5785b7a55627608ec396741248c21b7ff..2e56d73cad38cb46ff3bf657fe6c654b94c0e0be 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,7 +30,7 @@
  *
  * Generate timing statistics for vertical-motion optimization.
  *
  *
  * 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>
  */
 
 #include <test.priv.h>
@@ -140,10 +140,10 @@ run_test(bool optimized GCC_UNUSED)
 #endif
 
     if (reverse_loops)
 #endif
 
     if (reverse_loops)
-       for (ch = hi; ch >= lo; ch--)
+       for (ch = (char) hi; ch >= lo; ch--)
            one_cycle(ch);
     else
            one_cycle(ch);
     else
-       for (ch = lo; ch <= hi; ch++)
+       for (ch = (char) lo; ch <= hi; ch++)
            one_cycle(ch);
 }
 
            one_cycle(ch);
 }
 
index 700c27c1d9b8e267db3f9ad05b6ed1a96db29361..9c3a89ee3b617e022b1eb156567a57687516101e 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * Demonstrate the winsstr() and winsch functions.
  * Thomas Dickey - 2002/10/19
@@ -314,7 +314,7 @@ test_inserts(int level)
                beep();
                break;
            }
                beep();
                break;
            }
-           buffer[length++] = ch;
+           buffer[length++] = (char) ch;
            buffer[length] = '\0';
 
            /* put the string in, one character at a time */
            buffer[length] = '\0';
 
            /* put the string in, one character at a time */
index 72ff8670d07857c1a94b042a0b217d4edcb6cb7f..696ae73afbed9ea763aff03213cea03d1ba5a047 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey - 2000
  *
 /*
  * 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.
  */
  *
  * A simple demo of the termcap interface.
  */
@@ -59,7 +59,7 @@ static int
 outc(TPUTS_ARG c)
 {
     if (interrupted) {
 outc(TPUTS_ARG c)
 {
     if (interrupted) {
-       char tmp = c;
+       char tmp = (char) c;
        write(STDOUT_FILENO, &tmp, 1);
     } else {
        putc(c, stdout);
        write(STDOUT_FILENO, &tmp, 1);
     } else {
        putc(c, stdout);
index 09f328baf273d340eda9ede1e0e51fe30a8bc26b..fe8d4e32cbb3e7ef8170c3070c53e2971042defa 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * 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            *
  *                                                                          *
  * 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.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * Demonstrate save/restore functions from the curses library.
  * Thomas Dickey - 2007/7/14
@@ -34,6 +34,9 @@
 
 #include <test.priv.h>
 
 
 #include <test.priv.h>
 
+#include <sys/types.h>
+#include <sys/stat.h>
+
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>
 #if TIME_WITH_SYS_TIME
 # include <sys/time.h>
 # include <time.h>
 
 static bool use_init = FALSE;
 
 
 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)
 {
 static void
 setup_next(void)
 {
@@ -163,6 +173,14 @@ main(int argc, char *argv[])
        }
     }
 
        }
     }
 
+    files = argv + optind;
+    last = argc - optind - 1;
+
+    if (replaying) {
+       while (last >= 0 && !fexists(files[last]))
+           --last;
+    }
+
     initscr();
     cbreak();
     noecho();
     initscr();
     cbreak();
     noecho();
@@ -176,8 +194,6 @@ main(int argc, char *argv[])
        }
     }
 
        }
     }
 
-    files = argv + optind;
-    last = argc - optind - 1;
     if (replaying) {
 
        /*
     if (replaying) {
 
        /*
index 481d3ff18e6dfaec68d0bbe5c6e2cadd81ed17c6..e49aa1735061091f562c47ec65a32b895cdeb664 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 ##############################################################################
 #!/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"), #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #
@@ -26,7 +26,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
 # 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
 #
 # Use this script to exercise "savescreen".
 # It starts by generating a series of temporary-filenames, which are passed
@@ -49,6 +49,7 @@ then
        while test -f $BEGINS
        do
                ./savescreen -r $PARAMS
        while test -f $BEGINS
        do
                ./savescreen -r $PARAMS
+               test $? != 0 && break
        done
 else
        echo "No screens were saved"
        done
 else
        echo "No screens were saved"
index 9f8a34910fc0c32cedd12dde3d66cb9514651200..247a75604c903fa1c806cf5acf0e843b95afb1bc 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * Demonstrate the waddchstr() and waddch functions.
  * Thomas Dickey - 2009/9/12
@@ -346,7 +346,7 @@ test_adds(int level)
                beep();
                break;
            }
                beep();
                break;
            }
-           buffer[length++] = ch;
+           buffer[length++] = (char) ch;
            buffer[length] = '\0';
 
            /* put the string in, one character at a time */
            buffer[length] = '\0';
 
            /* put the string in, one character at a time */
index a0029706d66c2672ec470eb5654603f5a8f74ab2..d4c0425ec66a9d1f405afee1a3add01761d4dfc5 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * 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
  *
  * Demonstrate the waddstr() and waddch functions.
  * Thomas Dickey - 2009/9/12
@@ -312,7 +312,7 @@ test_adds(int level)
                beep();
                break;
            }
                beep();
                break;
            }
-           buffer[length++] = ch;
+           buffer[length++] = (char) ch;
            buffer[length] = '\0';
 
            /* put the string in, one character at a time */
            buffer[length] = '\0';
 
            /* put the string in, one character at a time */