]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 6.1 - patch 20190824
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 25 Aug 2019 01:15:21 +0000 (01:15 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 25 Aug 2019 01:15:21 +0000 (01:15 +0000)
+ fix some cppcheck warnings, mostly style, in ncurses test-programs.

34 files changed:
NEWS
VERSION
dist.mk
package/debian-mingw/changelog
package/debian-mingw64/changelog
package/debian/changelog
package/mingw-ncurses.nsi
package/mingw-ncurses.spec
package/ncurses.spec
package/ncursest.spec
test/demo_menus.c
test/demo_panels.c
test/demo_termcap.c
test/demo_terminfo.c
test/dots.c
test/dots_curses.c
test/dots_mvcur.c
test/dots_termcap.c
test/dots_xcurses.c
test/echochar.c
test/extended_color.c
test/filter.c
test/foldkeys.c
test/gdc.c
test/inch_wide.c
test/inchs.c
test/insdelln.c
test/knight.c
test/list_keys.c
test/ncurses.c
test/newdemo.c
test/pair_content.c
test/picsmap.c
test/railroad.c

diff --git a/NEWS b/NEWS
index c7b0ac6cc41a010b9135d52c87db1e24e1d7ed9b..d7f57e6e4aeef2a169caae05511f07f73ca88adf 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.3364 2019/08/17 21:47:27 tom Exp $
+-- $Id: NEWS,v 1.3366 2019/08/24 23:16:29 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,9 @@ 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.
 
+20190824
+       + fix some cppcheck warnings, mostly style, in ncurses test-programs.
+
 20190817
        + amend 20181208 changes for wbkgd() and wbkgrnd(), fixing a few
          details where it still differed from SVr4.
 20190817
        + amend 20181208 changes for wbkgd() and wbkgrnd(), fixing a few
          details where it still differed from SVr4.
diff --git a/VERSION b/VERSION
index 8362207f44a49cd97a50f79ef5e699a5b2c8f34a..987fb3a63851c7f58d84654fba6ec624ec41c761 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5:0:10 6.1     20190817
+5:0:10 6.1     20190824
diff --git a/dist.mk b/dist.mk
index 6630c1be975760240a9dcf4748f42d6a7980c576..6fde30930e70952805723f40821c0472f9254c35 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.1301 2019/08/17 13:26:39 tom Exp $
+# $Id: dist.mk,v 1.1302 2019/08/24 13:12:23 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 = 6
 NCURSES_MINOR = 1
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 6
 NCURSES_MINOR = 1
-NCURSES_PATCH = 20190817
+NCURSES_PATCH = 20190824
 
 # 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 82080e2dfa80807afb84206ef95ad6d76d4d2e58..beea70efbd56ae330bf1548825efbbed38d51a4f 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20190817) unstable; urgency=low
+ncurses6 (6.1+20190824) unstable; urgency=low
 
   * latest weekly patch
 
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Aug 2019 09:26:39 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 24 Aug 2019 09:12:23 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 82080e2dfa80807afb84206ef95ad6d76d4d2e58..beea70efbd56ae330bf1548825efbbed38d51a4f 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20190817) unstable; urgency=low
+ncurses6 (6.1+20190824) unstable; urgency=low
 
   * latest weekly patch
 
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Aug 2019 09:26:39 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 24 Aug 2019 09:12:23 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 7f69ca236c65db5b09fa47750f8d85844ce4eb89..9d6c4fcc036b540a75b9f365d68f3037cc94e5f5 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.1+20190817) unstable; urgency=low
+ncurses6 (6.1+20190824) unstable; urgency=low
 
   * latest weekly patch
 
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Aug 2019 09:26:39 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 24 Aug 2019 09:12:23 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index ed12eedab356efcf9c818905fe2f452ef6c633f2..6f36fa29ffee9e568d01d7cdc8cef5ab12665103 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.347 2019/08/17 13:26:39 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.348 2019/08/24 13:12:23 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "1"\r
 !define VERSION_YYYY  "2019"\r
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "1"\r
 !define VERSION_YYYY  "2019"\r
-!define VERSION_MMDD  "0817"\r
+!define VERSION_MMDD  "0824"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index 369162c2f078597ed96d1ba16ab940c81729955c..5b60339fb63b024dcd629d5da79f03f29bbde03e 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.1
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.1
-Release: 20190817
+Release: 20190824
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index c99e6a5a1758c8f799670a655b9f7c300962afd1..91b3c1f84bcb0baf11edd778cf49210610a7298f 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.1
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.1
-Release: 20190817
+Release: 20190824
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 9caf5836de6484ec9ebf17f60cd392bee62927e5..015bc75d6f9987fd89a59db303ef7e9a2f0d1f8e 100644 (file)
@@ -1,7 +1,7 @@
 Summary: Curses library with POSIX thread support.
 Name: ncursest6
 Version: 6.1
 Summary: Curses library with POSIX thread support.
 Name: ncursest6
 Version: 6.1
-Release: 20190817
+Release: 20190824
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 6e94b44b3b1ac738803be433369765d5ee30f290..857dfd626f365afe01d13c276194a90c3bce3246 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_menus.c,v 1.68 2019/08/17 21:45:32 tom Exp $
+ * $Id: demo_menus.c,v 1.69 2019/08/24 21:41:50 tom Exp $
  *
  * Demonstrate a variety of functions from the menu library.
  * Thomas Dickey - 2005/4/9
  *
  * Demonstrate a variety of functions from the menu library.
  * Thomas Dickey - 2005/4/9
@@ -586,13 +586,14 @@ static bool
 update_trace_menu(MENU * m)
 {
     ITEM **items;
 update_trace_menu(MENU * m)
 {
     ITEM **items;
-    ITEM *i, **p;
+    ITEM *i;
     bool changed = FALSE;
 
     items = menu_items(m);
     i = current_item(m);
     if (i == items[0]) {
        if (item_value(i)) {
     bool changed = FALSE;
 
     items = menu_items(m);
     i = current_item(m);
     if (i == items[0]) {
        if (item_value(i)) {
+           ITEM **p;
            for (p = items + 1; *p != 0; p++)
                if (item_value(*p)) {
                    set_item_value(*p, FALSE);
            for (p = items + 1; *p != 0; p++)
                if (item_value(*p)) {
                    set_item_value(*p, FALSE);
index a2509eb760f524eb25234f3a7bbee3296be32813..c47f52f242d84d6f77b731b06129801d657d7d1f 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2007-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 2007-2018,2019 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: demo_panels.c,v 1.42 2018/05/20 19:21:18 tom Exp $
+ * $Id: demo_panels.c,v 1.43 2019/08/24 23:11:01 tom Exp $
  *
  * Demonstrate a variety of functions from the panel library.
  */
  *
  * Demonstrate a variety of functions from the panel library.
  */
@@ -250,7 +250,6 @@ my_remove_panel(PANEL **pans, int which)
 static void
 my_create_panel(PANEL **pans, int which, FillPanel myFill)
 {
 static void
 my_create_panel(PANEL **pans, int which, FillPanel myFill)
 {
-    PANEL *pan = 0;
     int code;
     short pair = (short) which;
     short fg = (short) ((pair == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK);
     int code;
     short pair = (short) which;
     short fg = (short) ((pair == COLOR_BLUE) ? COLOR_WHITE : COLOR_BLACK);
@@ -281,7 +280,10 @@ my_create_panel(PANEL **pans, int which, FillPanel myFill)
        if (code > 0) {
            int tly = MIN(y0, y1);
            int tlx = MIN(x0, x1);
        if (code > 0) {
            int tly = MIN(y0, y1);
            int tlx = MIN(x0, x1);
-           pan = mkpanel(pair, ABS(y1 - y0) + 1, ABS(x1 - x0) + 1, tly, tlx);
+           PANEL *pan = mkpanel(pair,
+                                ABS(y1 - y0) + 1,
+                                ABS(x1 - x0) + 1,
+                                tly, tlx);
            /* finish */
            myFill(pan);
            pans[which] = pan;
            /* finish */
            myFill(pan);
            pans[which] = pan;
@@ -465,7 +467,7 @@ which_panel(PANEL *px[MAX_PANELS + 1], PANEL *pan)
 }
 
 static void
 }
 
 static void
-show_panels(PANEL *px[MAX_PANELS + 1])
+show_help(WINDOW *win)
 {
     static const char *help[] =
     {
 {
     static const char *help[] =
     {
@@ -481,7 +483,17 @@ show_panels(PANEL *px[MAX_PANELS + 1])
        "  s - show the panel",
        "  t - put the panel on the top of the stack"
     };
        "  s - show the panel",
        "  t - put the panel on the top of the stack"
     };
+    int j;
+
+    for (j = 0; j < (int) SIZEOF(help); ++j) {
+       if (wprintw(win, "%s\n", help[j]) == ERR)
+           break;
+    }
+}
 
 
+static void
+show_panels(PANEL *px[MAX_PANELS + 1])
+{
     struct {
        bool valid;
        bool hidden;
     struct {
        bool valid;
        bool hidden;
@@ -490,7 +502,6 @@ show_panels(PANEL *px[MAX_PANELS + 1])
     } table[MAX_PANELS + 1];
 
     WINDOW *win;
     } table[MAX_PANELS + 1];
 
     WINDOW *win;
-    PANEL *pan;
     int j;
 
     memset(table, 0, sizeof(table));
     int j;
 
     memset(table, 0, sizeof(table));
@@ -504,6 +515,8 @@ show_panels(PANEL *px[MAX_PANELS + 1])
     }
 
     if ((win = newwin(LINES - 1, COLS, 0, 0)) != 0) {
     }
 
     if ((win = newwin(LINES - 1, COLS, 0, 0)) != 0) {
+       PANEL *pan;
+
        keypad(win, TRUE);
        if ((pan = new_panel(win)) != 0) {
            werase(win);
        keypad(win, TRUE);
        if ((pan = new_panel(win)) != 0) {
            werase(win);
@@ -527,10 +540,7 @@ show_panels(PANEL *px[MAX_PANELS + 1])
                    waddch(win, '\n');
                }
            }
                    waddch(win, '\n');
                }
            }
-           for (j = 0; j < (int) SIZEOF(help); ++j) {
-               if (wprintw(win, "%s\n", help[j]) == ERR)
-                   break;
-           }
+           show_help(win);
            wgetch(win);
            del_panel(pan);
            pflush();
            wgetch(win);
            del_panel(pan);
            pflush();
@@ -626,7 +636,6 @@ get_command(PANEL *px[MAX_PANELS + 1], char *buffer, int limit)
 {
     int length = 0;
     int y0, x0;
 {
     int length = 0;
     int y0, x0;
-    int c0, ch;
     WINDOW *win;
 
     getyx(stdscr, y0, x0);
     WINDOW *win;
 
     getyx(stdscr, y0, x0);
@@ -645,9 +654,9 @@ get_command(PANEL *px[MAX_PANELS + 1], char *buffer, int limit)
        }
        (void) wgetch(win);
     } else {
        }
        (void) wgetch(win);
     } else {
-       c0 = 0;
+       int c0 = 0;
        for (;;) {
        for (;;) {
-           ch = wgetch(win);
+           int ch = wgetch(win);
            if (ch == ERR || ch == QUIT || ch == ESCAPE) {
                buffer[0] = '\0';
                break;
            if (ch == ERR || ch == QUIT || ch == ESCAPE) {
                buffer[0] = '\0';
                break;
index 00a64849b1e0090232b3cd62700966daae0d6769..666f7a2e697b495b874ca8f2d65c39d34e349710 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: demo_termcap.c,v 1.57 2019/01/21 22:50:46 tom Exp $
+ * $Id: demo_termcap.c,v 1.58 2019/08/24 21:47:19 tom Exp $
  *
  * A simple demo of the termcap interface.
  */
  *
  * A simple demo of the termcap interface.
  */
@@ -159,7 +159,8 @@ next_dbitem(void)
            db_item++;
        }
     }
            db_item++;
        }
     }
-    printf("** %s\n", result);
+    if (result != 0)
+       printf("** %s\n", result);
     return result;
 }
 
     return result;
 }
 
@@ -327,8 +328,6 @@ dump_xname(NCURSES_CONST char *cap)
 static void
 demo_termcap(NCURSES_CONST char *name)
 {
 static void
 demo_termcap(NCURSES_CONST char *name)
 {
-    unsigned n;
-    NCURSES_CONST char *cap;
     char buffer[1024];
 
     if (db_list) {
     char buffer[1024];
 
     if (db_list) {
@@ -337,6 +336,8 @@ demo_termcap(NCURSES_CONST char *name)
     if (!q_opt)
        printf("Terminal type \"%s\"\n", name);
     if (tgetent(buffer, name) >= 0) {
     if (!q_opt)
        printf("Terminal type \"%s\"\n", name);
     if (tgetent(buffer, name) >= 0) {
+       NCURSES_CONST char *cap;
+       unsigned n;
 
        if (b_opt) {
            for (n = 0;; ++n) {
 
        if (b_opt) {
            for (n = 0;; ++n) {
@@ -698,7 +699,6 @@ copy_code_list(NCURSES_CONST char *const *list)
     size_t count;
     size_t length = 1;
     char **result = 0;
     size_t count;
     size_t length = 1;
     char **result = 0;
-    char *blob = 0;
     char *unused = 0;
 
     for (pass = 0; pass < 2; ++pass) {
     char *unused = 0;
 
     for (pass = 0; pass < 2; ++pass) {
@@ -713,7 +713,7 @@ copy_code_list(NCURSES_CONST char *const *list)
            }
        }
        if (pass == 0) {
            }
        }
        if (pass == 0) {
-           blob = malloc(length);
+           char *blob = malloc(length);
            result = typeCalloc(char *, count + 1);
            unused = blob;
            if (blob == 0 || result == 0)
            result = typeCalloc(char *, count + 1);
            unused = blob;
            if (blob == 0 || result == 0)
index ab1c22c425cfeb6d4452d4ad49e42fd68447068e..6e52e990b5e8b90677a4964ab0c573ec7eb1e6ba 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2009-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2009-2017,2019 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
  *
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: demo_terminfo.c,v 1.48 2017/11/24 20:49:11 tom Exp $
+ * $Id: demo_terminfo.c,v 1.49 2019/08/24 23:11:01 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
  *
  * A simple demo of the terminfo interface.
  */
@@ -150,7 +150,8 @@ next_dbitem(void)
            db_item++;
        }
     }
            db_item++;
        }
     }
-    printf("** %s\n", result);
+    if (result != 0)
+       printf("** %s\n", result);
     return result;
 }
 
     return result;
 }
 
@@ -362,7 +363,6 @@ demo_terminfo(char *name)
     }
 #ifdef NCURSES_VERSION
     if (x_opt && (my_blob == 0)) {
     }
 #ifdef NCURSES_VERSION
     if (x_opt && (my_blob == 0)) {
-       int mod;
        if (y_opt) {
 #if NCURSES_XNAMES
            TERMTYPE *term = (TERMTYPE *) cur_term;
        if (y_opt) {
 #if NCURSES_XNAMES
            TERMTYPE *term = (TERMTYPE *) cur_term;
@@ -389,6 +389,7 @@ demo_terminfo(char *name)
                "kLFT", "kNXT", "kPRV", "kRIT", "kUP",
            };
            for (n = 0; n < SIZEOF(xterm_keys); ++n) {
                "kLFT", "kNXT", "kPRV", "kRIT", "kUP",
            };
            for (n = 0; n < SIZEOF(xterm_keys); ++n) {
+               int mod;
                for (mod = 0; mod < 8; ++mod) {
                    if (mod == 0) {
                        /* these happen to be standard - avoid duplicates */
                for (mod = 0; mod < 8; ++mod) {
                    if (mod == 0) {
                        /* these happen to be standard - avoid duplicates */
@@ -728,7 +729,6 @@ copy_code_list(NCURSES_CONST char *const *list)
     size_t count;
     size_t length = 1;
     char **result = 0;
     size_t count;
     size_t length = 1;
     char **result = 0;
-    char *blob = 0;
     char *unused = 0;
 
     for (pass = 0; pass < 2; ++pass) {
     char *unused = 0;
 
     for (pass = 0; pass < 2; ++pass) {
@@ -743,7 +743,7 @@ copy_code_list(NCURSES_CONST char *const *list)
            }
        }
        if (pass == 0) {
            }
        }
        if (pass == 0) {
-           blob = malloc(length);
+           char *blob = malloc(length);
            result = typeCalloc(char *, count + 1);
            unused = blob;
            if (blob == 0 || result == 0)
            result = typeCalloc(char *, count + 1);
            unused = blob;
            if (blob == 0 || result == 0)
index 36509ee0f887ca28d2763f1bf658319dc1ce0e97..bd3c30bb71d48358b8281a5e458d08e19eed16cf 100644 (file)
@@ -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.34 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots.c,v 1.35 2019/08/24 21:49:50 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
  *
  * A simple demo of the terminfo interface.
  */
@@ -136,7 +136,7 @@ int
 main(int argc,
      char *argv[])
 {
 main(int argc,
      char *argv[])
 {
-    int x, y, z, p;
+    int ch;
     double r;
     double c;
     int my_colors;
     double r;
     double c;
     int my_colors;
@@ -146,8 +146,8 @@ main(int argc,
     size_t need;
     char *my_env;
 
     size_t need;
     char *my_env;
 
-    while ((x = getopt(argc, argv, "T:efm:s:")) != -1) {
-       switch (x) {
+    while ((ch = getopt(argc, argv, "T:efm:s:")) != -1) {
+       switch (ch) {
        case 'T':
            need = 6 + strlen(optarg);
            my_env = malloc(need);
        case 'T':
            need = 6 + strlen(optarg);
            my_env = malloc(need);
@@ -195,13 +195,13 @@ main(int argc,
     started = time((time_t *) 0);
 
     while (!interrupted) {
     started = time((time_t *) 0);
 
     while (!interrupted) {
-       x = (int) (c * ranf()) + m_option;
-       y = (int) (r * ranf()) + m_option;
-       p = (ranf() > 0.9) ? '*' : ' ';
+       int x = (int) (c * ranf()) + m_option;
+       int y = (int) (r * ranf()) + m_option;
+       int p = (ranf() > 0.9) ? '*' : ' ';
 
        tputs(tparm3(cursor_address, y, x), 1, outc);
        if (my_colors > 0) {
 
        tputs(tparm3(cursor_address, y, x), 1, outc);
        if (my_colors > 0) {
-           z = (int) (ranf() * my_colors);
+           int z = (int) (ranf() * my_colors);
            if (ranf() > 0.01) {
                tputs(tparm2(set_a_foreground, z), 1, outc);
            } else {
            if (ranf() > 0.01) {
                tputs(tparm2(set_a_foreground, z), 1, outc);
            } else {
index 215351815e03d11d1217ba95d76b326d1e6e8afe..6c2a06e644ee080d5fe76dcc3e09f74fed9bf788 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: dots_curses.c,v 1.14 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots_curses.c,v 1.15 2019/08/24 21:50:35 tom Exp $
  *
  * A simple demo of the curses interface used for comparison with termcap.
  */
  *
  * A simple demo of the curses interface used for comparison with termcap.
  */
@@ -113,7 +113,7 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
 int
 main(int argc, char *argv[])
 {
-    int x, y, z, p;
+    int ch;
     int fg, bg;
     double r;
     double c;
     int fg, bg;
     double r;
     double c;
@@ -125,8 +125,8 @@ main(int argc, char *argv[])
     size_t need;
     char *my_env;
 
     size_t need;
     char *my_env;
 
-    while ((x = getopt(argc, argv, "T:dem:s:")) != -1) {
-       switch (x) {
+    while ((ch = getopt(argc, argv, "T:dem:s:")) != -1) {
+       switch (ch) {
        case 'T':
            need = 6 + strlen(optarg);
            my_env = malloc(need);
        case 'T':
            need = 6 + strlen(optarg);
            my_env = malloc(need);
@@ -185,13 +185,13 @@ main(int argc, char *argv[])
     fg = COLOR_WHITE;
     bg = COLOR_BLACK;
     while (!interrupted) {
     fg = COLOR_WHITE;
     bg = COLOR_BLACK;
     while (!interrupted) {
-       x = (int) (c * ranf()) + m_option;
-       y = (int) (r * ranf()) + m_option;
-       p = (ranf() > 0.9) ? '*' : ' ';
+       int x = (int) (c * ranf()) + m_option;
+       int y = (int) (r * ranf()) + m_option;
+       int p = (ranf() > 0.9) ? '*' : ' ';
 
        move(y, x);
        if (has_colors()) {
 
        move(y, x);
        if (has_colors()) {
-           z = (int) (ranf() * COLORS);
+           int z = (int) (ranf() * COLORS);
            if (ranf() > 0.01) {
                set_colors(fg = z, bg);
                attron(COLOR_PAIR(mypair(fg, bg)));
            if (ranf() > 0.01) {
                set_colors(fg = z, bg);
                attron(COLOR_PAIR(mypair(fg, bg)));
index d6df3988c945e1bf7990516e9ac9e2a288db56da..16d5ca5ecf75a44223011ef53710acd8947c103a 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey - 2007
  *
 /*
  * Author: Thomas E. Dickey - 2007
  *
- * $Id: dots_mvcur.c,v 1.20 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots_mvcur.c,v 1.21 2019/08/24 22:19:28 tom Exp $
  *
  * A simple demo of the terminfo interface, and mvcur.
  */
  *
  * A simple demo of the terminfo interface, and mvcur.
  */
@@ -138,7 +138,7 @@ main(int argc GCC_UNUSED,
      char *argv[]GCC_UNUSED)
 {
     int x0 = 1, y0 = 1;
      char *argv[]GCC_UNUSED)
 {
     int x0 = 1, y0 = 1;
-    int x, y, z, p;
+    int ch;
     double r;
     double c;
     SCREEN *sp;
     double r;
     double c;
     SCREEN *sp;
@@ -149,8 +149,8 @@ main(int argc GCC_UNUSED,
     size_t need;
     char *my_env;
 
     size_t need;
     char *my_env;
 
-    while ((x = getopt(argc, argv, "T:efm:s:")) != -1) {
-       switch (x) {
+    while ((ch = getopt(argc, argv, "T:efm:s:")) != -1) {
+       switch (ch) {
        case 'T':
            need = 6 + strlen(optarg);
            my_env = malloc(need);
        case 'T':
            need = 6 + strlen(optarg);
            my_env = malloc(need);
@@ -205,9 +205,9 @@ main(int argc GCC_UNUSED,
     started = time((time_t *) 0);
 
     while (!interrupted) {
     started = time((time_t *) 0);
 
     while (!interrupted) {
-       x = (int) (c * ranf()) + m_option;
-       y = (int) (r * ranf()) + m_option;
-       p = (ranf() > 0.9) ? '*' : ' ';
+       int x = (int) (c * ranf()) + m_option;
+       int y = (int) (r * ranf()) + m_option;
+       int p = (ranf() > 0.9) ? '*' : ' ';
 
        if (mvcur(y0, x0, y, x) != ERR) {
            x0 = x;
 
        if (mvcur(y0, x0, y, x) != ERR) {
            x0 = x;
@@ -215,7 +215,7 @@ main(int argc GCC_UNUSED,
        }
 
        if (my_colors > 0) {
        }
 
        if (my_colors > 0) {
-           z = (int) (ranf() * my_colors);
+           int z = (int) (ranf() * my_colors);
            if (ranf() > 0.01) {
                tputs(tparm2(set_a_foreground, z), 1, outc);
            } else {
            if (ranf() > 0.01) {
                tputs(tparm2(set_a_foreground, z), 1, outc);
            } else {
index b81a53d741a25a465f743b683b35b995dd7c5ce3..21b9adb24719fd5cb2895a31968da72ea421b809 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: dots_termcap.c,v 1.18 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots_termcap.c,v 1.19 2019/08/24 22:25:55 tom Exp $
  *
  * A simple demo of the termcap interface.
  */
  *
  * A simple demo of the termcap interface.
  */
@@ -201,7 +201,7 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
 int
 main(int argc, char *argv[])
 {
-    int x, y, z, p;
+    int ch;
     int num_colors;
     int num_lines;
     int num_columns;
     int num_colors;
     int num_lines;
     int num_columns;
@@ -216,8 +216,8 @@ main(int argc, char *argv[])
     size_t need;
     char *my_env;
 
     size_t need;
     char *my_env;
 
-    while ((x = getopt(argc, argv, "T:em:s:")) != -1) {
-       switch (x) {
+    while ((ch = getopt(argc, argv, "T:em:s:")) != -1) {
+       switch (ch) {
        case 'T':
            need = 6 + strlen(optarg);
            my_env = malloc(need);
        case 'T':
            need = 6 + strlen(optarg);
            my_env = malloc(need);
@@ -246,8 +246,8 @@ main(int argc, char *argv[])
 
     srand((unsigned) time(0));
 
 
     srand((unsigned) time(0));
 
-    InitAndCatch(z = tgetent(buffer, name), onsig);
-    if (z < 0) {
+    InitAndCatch(ch = tgetent(buffer, name), onsig);
+    if (ch < 0) {
        fprintf(stderr, "terminal description not found\n");
        ExitProgram(EXIT_FAILURE);
     } else {
        fprintf(stderr, "terminal description not found\n");
        ExitProgram(EXIT_FAILURE);
     } else {
@@ -278,13 +278,13 @@ main(int argc, char *argv[])
     started = time((time_t *) 0);
 
     while (!interrupted) {
     started = time((time_t *) 0);
 
     while (!interrupted) {
-       x = (int) (c * ranf()) + m_option;
-       y = (int) (r * ranf()) + m_option;
-       p = (ranf() > 0.9) ? '*' : ' ';
+       int x = (int) (c * ranf()) + m_option;
+       int y = (int) (r * ranf()) + m_option;
+       int p = (ranf() > 0.9) ? '*' : ' ';
 
        tputs(tgoto(t_cm, x, y), 1, outc);
        if (num_colors > 0) {
 
        tputs(tgoto(t_cm, x, y), 1, outc);
        if (num_colors > 0) {
-           z = (int) (ranf() * num_colors);
+           int z = (int) (ranf() * num_colors);
            if (ranf() > 0.01) {
                tputs(tgoto(t_AF, 0, z), 1, outc);
            } else {
            if (ranf() > 0.01) {
                tputs(tgoto(t_AF, 0, z), 1, outc);
            } else {
index 9e2d5b7f7259b4127eac1e9cfd8d793870d64fa8..2eb4d63ace538c9ec002056793387639a1a32ef6 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: dots_xcurses.c,v 1.17 2019/01/21 14:20:18 tom Exp $
+ * $Id: dots_xcurses.c,v 1.18 2019/08/24 22:31:43 tom Exp $
  *
  * A simple demo of the wide-curses interface used for comparison with termcap.
  */
  *
  * A simple demo of the wide-curses interface used for comparison with termcap.
  */
@@ -139,10 +139,8 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
 int
 main(int argc, char *argv[])
 {
-    int x, y, z, p;
     int fg, bg, ch;
     wchar_t wch[2];
     int fg, bg, ch;
     wchar_t wch[2];
-    int pair;
     double r;
     double c;
 #if HAVE_USE_DEFAULT_COLORS
     double r;
     double c;
 #if HAVE_USE_DEFAULT_COLORS
@@ -205,6 +203,7 @@ main(int argc, char *argv[])
        {
            for (fg = 0; fg < COLORS; fg++) {
                for (bg = 0; bg < COLORS; bg++) {
        {
            for (fg = 0; fg < COLORS; fg++) {
                for (bg = 0; bg < COLORS; bg++) {
+                   int pair;
                    if (interrupted) {
                        cleanup();
                        ExitProgram(EXIT_FAILURE);
                    if (interrupted) {
                        cleanup();
                        ExitProgram(EXIT_FAILURE);
@@ -224,16 +223,15 @@ main(int argc, char *argv[])
 
     fg = COLOR_WHITE;
     bg = COLOR_BLACK;
 
     fg = COLOR_WHITE;
     bg = COLOR_BLACK;
-    pair = 0;
     wch[1] = 0;
     while (!interrupted) {
     wch[1] = 0;
     while (!interrupted) {
-       x = (int) (c * ranf()) + m_option;
-       y = (int) (r * ranf()) + m_option;
-       p = (ranf() > 0.9) ? '*' : ' ';
+       int x = (int) (c * ranf()) + m_option;
+       int y = (int) (r * ranf()) + m_option;
+       int p = (ranf() > 0.9) ? '*' : ' ';
 
        move(y, x);
        if (has_colors()) {
 
        move(y, x);
        if (has_colors()) {
-           z = (int) (ranf() * COLORS);
+           int z = (int) (ranf() * COLORS);
            if (ranf() > 0.01) {
                set_colors(fg = z, bg);
            } else {
            if (ranf() > 0.01) {
                set_colors(fg = z, bg);
            } else {
index 19ba9acd07e34a20f710d5dd034945af506810ff..a0b7de666af544e24d7de19add9a74de92451d5e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2006-2014,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2017,2019 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: echochar.c,v 1.18 2017/10/18 23:04:52 tom Exp $
+ * $Id: echochar.c,v 1.19 2019/08/24 23:11:01 tom Exp $
  *
  * Demonstrate the echochar function (compare to dots.c).
  * Thomas Dickey - 2006/11/4
  *
  * Demonstrate the echochar function (compare to dots.c).
  * Thomas Dickey - 2006/11/4
@@ -81,7 +81,7 @@ int
 main(int argc GCC_UNUSED,
      char *argv[]GCC_UNUSED)
 {
 main(int argc GCC_UNUSED,
      char *argv[]GCC_UNUSED)
 {
-    int ch, x, y, z, p;
+    int ch;
     double r;
     double c;
     bool use_colors;
     double r;
     double c;
     bool use_colors;
@@ -121,13 +121,13 @@ main(int argc GCC_UNUSED,
     started = time((time_t *) 0);
 
     while (!interrupted) {
     started = time((time_t *) 0);
 
     while (!interrupted) {
-       x = (int) (c * ranf()) + 2;
-       y = (int) (r * ranf()) + 2;
-       p = (ranf() > 0.9) ? '*' : ' ';
+       int x = (int) (c * ranf()) + 2;
+       int y = (int) (r * ranf()) + 2;
+       int p = (ranf() > 0.9) ? '*' : ' ';
 
        move(y, x);
        if (use_colors > 0) {
 
        move(y, x);
        if (use_colors > 0) {
-           z = (int) (ranf() * COLORS);
+           int z = (int) (ranf() * COLORS);
            if (ranf() > 0.01) {
                set_color(my_pairs, z, last_bg);
                last_fg = z;
            if (ranf() > 0.01) {
                set_color(my_pairs, z, last_bg);
                last_fg = z;
index 00b48140fa39f626cc1d58ed6b2c1098e225f036..d588284de544555145658286ab5349d2d69c563d 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: extended_color.c,v 1.13 2019/01/21 14:59:34 tom Exp $
+ * $Id: extended_color.c,v 1.14 2019/08/24 23:09:18 tom Exp $
  */
 
 #include <test.priv.h>
  */
 
 #include <test.priv.h>
@@ -209,8 +209,8 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 
     printw("Drawing soft-key tabs with pair 2\n");
     slk_attrset(A_BOLD);       /* reverse-video is hard to see */
 
     printw("Drawing soft-key tabs with pair 2\n");
     slk_attrset(A_BOLD);       /* reverse-video is hard to see */
-    i = if_opt_s(extended_slk_color_sp(sp, 2),
-                extended_slk_color(2));
+    (void) if_opt_s(extended_slk_color_sp(sp, 2),
+                   extended_slk_color(2));
     for (i = 1; i <= 8; ++i) {
        char temp[80];
        _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "(SLK-%d)", i);
     for (i = 1; i <= 8; ++i) {
        char temp[80];
        _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "(SLK-%d)", i);
index e070620b27201996ab4cb77d1bd90b33c1de2091..e9c0ee99b73271490cc74318ee37a4a1ec3501bb 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2017,2019 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 1998
  *
 /*
  * Author:  Thomas E. Dickey 1998
  *
- * $Id: filter.c,v 1.32 2017/09/28 23:40:39 tom Exp $
+ * $Id: filter.c,v 1.33 2019/08/24 23:11:01 tom Exp $
  *
  * An example of the 'filter()' function in ncurses, this program prompts
  * for commands and executes them (like a command shell).  It illustrates
  *
  * An example of the 'filter()' function in ncurses, this program prompts
  * for commands and executes them (like a command shell).  It illustrates
@@ -100,7 +100,6 @@ static int
 new_command(char *buffer, int length, int underline, bool clocked, bool polled)
 {
     int code = OK;
 new_command(char *buffer, int length, int underline, bool clocked, bool polled)
 {
     int code = OK;
-    int limit;
 
     if (polled) {
        bool done = FALSE;
 
     if (polled) {
        bool done = FALSE;
@@ -113,6 +112,7 @@ new_command(char *buffer, int length, int underline, bool clocked, bool polled)
 
        timeout(20);            /* no one types 50CPS... */
        while (!done) {
 
        timeout(20);            /* no one types 50CPS... */
        while (!done) {
+           int limit;
            int ch = getch();
 
            buffer[used] = '\0';
            int ch = getch();
 
            buffer[used] = '\0';
index bcda90c203aaa167d708a71022fda13555982f16..98e72b0450a51ad8a03c4539b9a86160304f038a 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2006-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2018,2019 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, 2006
  *
 /*
  * Author: Thomas E. Dickey, 2006
  *
- * $Id: foldkeys.c,v 1.7 2018/12/29 17:53:03 tom Exp $
+ * $Id: foldkeys.c,v 1.8 2019/08/24 23:11:01 tom Exp $
  *
  * Demonstrate a method for altering key definitions at runtime.
  *
  *
  * Demonstrate a method for altering key definitions at runtime.
  *
@@ -53,10 +53,10 @@ static void
 log_last_line(WINDOW *win)
 {
     FILE *fp;
 log_last_line(WINDOW *win)
 {
     FILE *fp;
-    int y, x, n;
-    char temp[256];
 
     if ((fp = fopen(MY_LOGFILE, "a")) != 0) {
 
     if ((fp = fopen(MY_LOGFILE, "a")) != 0) {
+       char temp[256];
+       int y, x, n;
        int need = sizeof(temp) - 1;
        if (need > COLS)
            need = COLS;
        int need = sizeof(temp) - 1;
        if (need > COLS)
            need = COLS;
@@ -195,8 +195,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
     int ch;
 #if HAVE_GETTIMEOFDAY
 {
     int ch;
 #if HAVE_GETTIMEOFDAY
-    int secs, msecs;
-    struct timeval current, previous;
+    struct timeval previous;
 #endif
 
     if (newterm(0, stdout, stdin) == 0) {
 #endif
 
     if (newterm(0, stdout, stdin) == 0) {
@@ -224,6 +223,9 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
        const char *name = keyname(escaped ? (ch - MY_KEYS) : ch);
 
 #if HAVE_GETTIMEOFDAY
        const char *name = keyname(escaped ? (ch - MY_KEYS) : ch);
 
 #if HAVE_GETTIMEOFDAY
+       int secs, msecs;
+       struct timeval current;
+
        gettimeofday(&current, 0);
        secs = (int) (current.tv_sec - previous.tv_sec);
        msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000);
        gettimeofday(&current, 0);
        secs = (int) (current.tv_sec - previous.tv_sec);
        msecs = (int) ((current.tv_usec - previous.tv_usec) / 1000);
index deecdf7e49f3f1619ccf024072c696ecae5730ef..c2ef5b11522bf5c252b57e715dd91737f4a93959 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2017,2019 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            *
@@ -33,7 +33,7 @@
  * modified 10-18-89 for curses (jrl)
  * 10-18-89 added signal handling
  *
  * modified 10-18-89 for curses (jrl)
  * 10-18-89 added signal handling
  *
- * $Id: gdc.c,v 1.51 2017/09/30 18:10:05 tom Exp $
+ * $Id: gdc.c,v 1.52 2019/08/24 23:11:01 tom Exp $
  */
 
 #include <test.priv.h>
  */
 
 #include <test.priv.h>
@@ -86,7 +86,6 @@ static void
 drawbox(bool scrolling)
 {
     chtype bottom[XLENGTH + 1];
 drawbox(bool scrolling)
 {
     chtype bottom[XLENGTH + 1];
-    int n;
 
     if (hascolor)
        (void) attrset(AttrArg(COLOR_PAIR(PAIR_FRAMES), 0));
 
     if (hascolor)
        (void) attrset(AttrArg(COLOR_PAIR(PAIR_FRAMES), 0));
@@ -97,6 +96,7 @@ drawbox(bool scrolling)
 
     MvAddCh(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER);
     if ((mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH)) != ERR) {
 
     MvAddCh(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER);
     if ((mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH)) != ERR) {
+       int n;
        for (n = 0; n < XLENGTH; n++) {
            if (!scrolling)
                bottom[n] &= ~A_COLOR;
        for (n = 0; n < XLENGTH; n++) {
            if (!scrolling)
                bottom[n] &= ~A_COLOR;
@@ -251,9 +251,9 @@ main(int argc, char *argv[])
     if (optind < argc) {
        count = atoi(argv[optind++]);
        assert(count >= 0);
     if (optind < argc) {
        count = atoi(argv[optind++]);
        assert(count >= 0);
+       if (optind < argc)
+           usage();
     }
     }
-    if (optind < argc)
-       usage();
 
     InitAndCatch({
        if (redirected) {
 
     InitAndCatch({
        if (redirected) {
index 27edc8f8aa9078fca3a8513e88cd794850a80e88..6a46cd084ee48b764172f1a4a0c376d4b04d8d47 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2007-2010,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2007-2017,2019 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: inch_wide.c,v 1.9 2017/04/29 22:03:21 tom Exp $
+ * $Id: inch_wide.c,v 1.10 2019/08/24 23:11:01 tom Exp $
  */
 /*
        int in_wch(cchar_t *wcval);
  */
 /*
        int in_wch(cchar_t *wcval);
@@ -78,7 +78,6 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
     int j;
     int txt_x = 0, txt_y = 0;
     int base_y;
     int j;
     int txt_x = 0, txt_y = 0;
     int base_y;
-    int limit;
     cchar_t ch;
     cchar_t text[MAX_COLS];
 
     cchar_t ch;
     cchar_t text[MAX_COLS];
 
@@ -122,6 +121,8 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
     }
 
     while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
     }
 
     while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
+       int limit;
+
        switch (j) {
        case KEY_DOWN:
        case 'j':
        switch (j) {
        case KEY_DOWN:
        case 'j':
index 87a8e6706d5310683bb1049c6aa52ee2d6c0dfda..e9d53702f7903f7fd0c92cc346fbb3f1a4e7de8e 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2007-2012,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2007-2017,2019 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: inchs.c,v 1.16 2017/09/06 09:20:42 tom Exp $
+ * $Id: inchs.c,v 1.17 2019/08/24 23:11:01 tom Exp $
  *
  * Author: Thomas E Dickey
  */
  *
  * Author: Thomas E Dickey
  */
@@ -87,7 +87,6 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
     int ch, j;
     int txt_x = 0, txt_y = 0;
     int base_y;
     int ch, j;
     int txt_x = 0, txt_y = 0;
     int base_y;
-    int limit;
     chtype text[MAX_COLS];
 
     if (argv[level] == 0) {
     chtype text[MAX_COLS];
 
     if (argv[level] == 0) {
@@ -132,6 +131,8 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin)
     }
 
     while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
     }
 
     while (!Quit(j = mvwgetch(txtwin, txt_y, txt_x))) {
+       int limit;
+
        switch (j) {
        case KEY_DOWN:
        case 'j':
        switch (j) {
        case KEY_DOWN:
        case 'j':
index e8b98e216327ec26372876e94a13cb04de8cdcf5..95fd2bed318cf651b1405208e1d82aeaf5cb1df4 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2008-2014,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2008-2017,2019 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: insdelln.c,v 1.12 2017/09/07 08:24:24 tom Exp $
+ * $Id: insdelln.c,v 1.13 2019/08/24 23:11:01 tom Exp $
  *
  * test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln
  */
  *
  * test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln
  */
@@ -70,10 +70,10 @@ color_params(unsigned state, int *pair)
     };
     /* *INDENT-ON* */
 
     };
     /* *INDENT-ON* */
 
-    static bool first = TRUE;
     const char *result = 0;
 
     if (has_colors()) {
     const char *result = 0;
 
     if (has_colors()) {
+       static bool first = TRUE;
        if (first) {
            unsigned n;
 
        if (first) {
            unsigned n;
 
index 50cba37f8682e3f6a60d7ed2ea49f6dc18d2cdb0..dc04944acd73a593213d977d2aa995a71f2dc67c 100644 (file)
@@ -33,7 +33,7 @@
  * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995.  Mouse support
  * added September 20th 1995.
  *
  * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995.  Mouse support
  * added September 20th 1995.
  *
- * $Id: knight.c,v 1.45 2019/04/20 20:34:55 tom Exp $
+ * $Id: knight.c,v 1.46 2019/08/24 22:40:52 tom Exp $
  */
 
 #include <test.priv.h>
  */
 
 #include <test.priv.h>
@@ -328,21 +328,20 @@ mark_possibles(SQUARES squares, int y, int x, chtype mark)
 static bool
 find_next_move(SQUARES squares, HISTORY * doneData, int doneSize, int *y, int *x)
 {
 static bool
 find_next_move(SQUARES squares, HISTORY * doneData, int doneSize, int *y, int *x)
 {
-    unsigned j, k;
-    int found = -1;
-    int first = -1;
-    int next = -1;
-    int oldy, oldx;
-    int newy, newx;
     bool result = FALSE;
 
     if (doneSize > 1) {
     bool result = FALSE;
 
     if (doneSize > 1) {
-       oldy = doneData[doneSize - 1].y;
-       oldx = doneData[doneSize - 1].x;
+       unsigned j;
+       int oldy = doneData[doneSize - 1].y;
+       int oldx = doneData[doneSize - 1].x;
+       int found = -1;
+       int first = -1;
+       int next = -1;
+
        for (j = 0; j < MAX_OFFSET * 2; j++) {
        for (j = 0; j < MAX_OFFSET * 2; j++) {
-           k = j % MAX_OFFSET;
-           newy = oldy + offsets[k].y;
-           newx = oldx + offsets[k].x;
+           unsigned k = j % MAX_OFFSET;
+           int newy = oldy + offsets[k].y;
+           int newx = oldx + offsets[k].x;
            if (isUnusedYX(squares, newy, newx)) {
                if (first < 0)
                    first = (int) k;
            if (isUnusedYX(squares, newy, newx)) {
                if (first < 0)
                    first = (int) k;
@@ -502,12 +501,11 @@ recurBack(SQUARES squares, int y, int x, int total)
     int result;
 
     if (total < maxmoves) {
     int result;
 
     if (total < maxmoves) {
-       int try_x, try_y;
        unsigned k;
 
        for (k = 0; k < MAX_OFFSET; k++) {
        unsigned k;
 
        for (k = 0; k < MAX_OFFSET; k++) {
-           try_x = x + offsets[k].x;
-           try_y = y + offsets[k].y;
+           int try_x = x + offsets[k].x;
+           int try_y = y + offsets[k].y;
            if (isUnusedYX(squares, try_y, try_x)) {
                ++test_test;
                squares[try_y][try_x] = total + 1;
            if (isUnusedYX(squares, try_y, try_x)) {
                ++test_test;
                squares[try_y][try_x] = total + 1;
index 92c8ba4f012f9e232e797dd2bfdd5d5fe7a89429..506f2e845f4cb42d84bb8a1859c8497951d0d996 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2016-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 2016-2018,2019 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: list_keys.c,v 1.24 2018/05/20 18:56:56 tom Exp $
+ * $Id: list_keys.c,v 1.25 2019/08/24 23:11:01 tom Exp $
  *
  * Author: Thomas E Dickey
  *
  *
  * Author: Thomas E Dickey
  *
@@ -88,7 +88,6 @@ static int
 show_key(const char *name, bool show)
 {
     int width = 0;
 show_key(const char *name, bool show)
 {
     int width = 0;
-    char buffer[10];
     NCURSES_CONST char *value = tigetstr((NCURSES_CONST char *) name);
 
     if (show && t_opt)
     NCURSES_CONST char *value = tigetstr((NCURSES_CONST char *) name);
 
     if (show && t_opt)
@@ -96,6 +95,7 @@ show_key(const char *name, bool show)
 
     if (value != 0 && value != (char *) -1) {
        while (*value != 0) {
 
     if (value != 0 && value != (char *) -1) {
        while (*value != 0) {
+           char buffer[10];
            int ch = UChar(*value++);
            switch (ch) {
            case '\177':
            int ch = UChar(*value++);
            switch (ch) {
            case '\177':
@@ -197,8 +197,8 @@ compare_keys(const void *a, const void *b)
 static void
 draw_line(int width)
 {
 static void
 draw_line(int width)
 {
-    int j;
     if (!t_opt) {
     if (!t_opt) {
+       int j;
        for (j = 0; j < width; ++j) {
            printf("-");
        }
        for (j = 0; j < width; ++j) {
            printf("-");
        }
@@ -285,8 +285,8 @@ list_keys(TERMINAL **terms, int count)
     }
 #if NCURSES_XNAMES
     if (x_opt) {
     }
 #if NCURSES_XNAMES
     if (x_opt) {
-       TERMTYPE *term;
        for (k = 0; k < count; ++k) {
        for (k = 0; k < count; ++k) {
+           TERMTYPE *term;
            set_curterm(terms[k]);
            term = (TERMTYPE *) cur_term;
            total += (size_t) (NUM_STRINGS(term) - STRCOUNT);
            set_curterm(terms[k]);
            term = (TERMTYPE *) cur_term;
            total += (size_t) (NUM_STRINGS(term) - STRCOUNT);
@@ -305,9 +305,11 @@ list_keys(TERMINAL **terms, int count)
     }
 #if NCURSES_XNAMES
     if (x_opt) {
     }
 #if NCURSES_XNAMES
     if (x_opt) {
-       TERMTYPE *term;
        int m, n;
        int m, n;
+
        for (k = 0; k < count; ++k) {
        for (k = 0; k < count; ++k) {
+           TERMTYPE *term;
+
            set_curterm(terms[k]);
            term = (TERMTYPE *) cur_term;
            for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
            set_curterm(terms[k]);
            term = (TERMTYPE *) cur_term;
            for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) {
index ce72252a2dd558c9a6d44d5369921aad36354558..8ec2ba0eea366dd5094aba643e727a39d8d666c0 100644 (file)
@@ -40,7 +40,7 @@ AUTHOR
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.516 2019/08/10 19:38:41 tom Exp $
+$Id: ncurses.c,v 1.517 2019/08/24 23:09:03 tom Exp $
 
 ***************************************************************************/
 
 
 ***************************************************************************/
 
@@ -226,7 +226,7 @@ wGetchar(WINDOW *win)
 static void
 wGetstring(WINDOW *win, char *buffer, int limit)
 {
 static void
 wGetstring(WINDOW *win, char *buffer, int limit)
 {
-    int y0, x0, x, ch;
+    int y0, x0, x;
     bool done = FALSE;
 
     echo();
     bool done = FALSE;
 
     echo();
@@ -235,6 +235,7 @@ wGetstring(WINDOW *win, char *buffer, int limit)
 
     x = (int) strlen(buffer);
     while (!done) {
 
     x = (int) strlen(buffer);
     while (!done) {
+       int ch;
        if (x > (int) strlen(buffer))
            x = (int) strlen(buffer);
        wmove(win, y0, x0);
        if (x > (int) strlen(buffer))
            x = (int) strlen(buffer);
        wmove(win, y0, x0);
@@ -579,7 +580,6 @@ mouse_decode(MEVENT const *ep)
 static void
 show_mouse(WINDOW *win)
 {
 static void
 show_mouse(WINDOW *win)
 {
-    int y, x;
     MEVENT event;
     bool outside;
     bool show_loc;
     MEVENT event;
     bool outside;
     bool show_loc;
@@ -602,6 +602,7 @@ show_mouse(WINDOW *win)
     show_loc = wmouse_trafo(win, &event.y, &event.x, FALSE);
 
     if (show_loc) {
     show_loc = wmouse_trafo(win, &event.y, &event.x, FALSE);
 
     if (show_loc) {
+       int y, x;
        getyx(win, y, x);
        wmove(win, event.y, event.x);
        waddch(win, '*');
        getyx(win, y, x);
        wmove(win, event.y, event.x);
        waddch(win, '*');
@@ -818,7 +819,6 @@ wgetch_test(unsigned level, WINDOW *win, int delay)
 {
     char buf[BUFSIZ];
     int first_y, first_x;
 {
     char buf[BUFSIZ];
     int first_y, first_x;
-    int c;
     int incount = 0;
     GetchFlags flags;
 
     int incount = 0;
     GetchFlags flags;
 
@@ -832,6 +832,8 @@ wgetch_test(unsigned level, WINDOW *win, int delay)
     scrollok(win, TRUE);
 
     for (;;) {
     scrollok(win, TRUE);
 
     for (;;) {
+       int c;
+
        while ((c = wGetchar(win)) == ERR) {
            incount++;
            if (blocking_getch(flags, delay)) {
        while ((c = wGetchar(win)) == ERR) {
            incount++;
            if (blocking_getch(flags, delay)) {
@@ -1076,7 +1078,6 @@ wget_wch_test(unsigned level, WINDOW *win, int delay)
     wint_t c;
     int incount = 0;
     GetchFlags flags;
     wint_t c;
     int incount = 0;
     GetchFlags flags;
-    int code;
     char *temp;
 
     init_getch(win, flags, delay);
     char *temp;
 
     init_getch(win, flags, delay);
@@ -1089,6 +1090,8 @@ wget_wch_test(unsigned level, WINDOW *win, int delay)
     scrollok(win, TRUE);
 
     for (;;) {
     scrollok(win, TRUE);
 
     for (;;) {
+       int code;
+
        while ((code = wGet_wchar(win, &c)) == ERR) {
            incount++;
            if (blocking_getch(flags, delay)) {
        while ((code = wGet_wchar(win, &c)) == ERR) {
            incount++;
            if (blocking_getch(flags, delay)) {
@@ -1385,9 +1388,10 @@ adjust_attr_string(int adjust)
 {
     char save = attr_test_string[0];
     int first = ((int) UChar(save)) + adjust;
 {
     char save = attr_test_string[0];
     int first = ((int) UChar(save)) + adjust;
-    int j, k;
 
     if (first >= ATTRSTRING_1ST) {
 
     if (first >= ATTRSTRING_1ST) {
+       int j, k;
+
        for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
            if (k > ATTRSTRING_END)
                break;
        for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
            if (k > ATTRSTRING_END)
                break;
@@ -1451,10 +1455,9 @@ show_attr(WINDOW *win, int row, int skip, bool arrow, chtype attr, const char *n
     werase(win);
     if (attr & A_ALTCHARSET) {
        const char *s;
     werase(win);
     if (attr & A_ALTCHARSET) {
        const char *s;
-       chtype ch;
 
        for (s = attr_test_string; *s != '\0'; ++s) {
 
        for (s = attr_test_string; *s != '\0'; ++s) {
-           ch = UChar(*s);
+           chtype ch = UChar(*s);
            (void) waddch(win, ch | attr);
        }
     } else {
            (void) waddch(win, ch | attr);
        }
     } else {
@@ -1662,12 +1665,13 @@ attr_test(bool recur GCC_UNUSED)
     NCURSES_COLOR_T bg = COLOR_BLACK;
     NCURSES_COLOR_T tx = -1;
     int ac = 0;
     NCURSES_COLOR_T bg = COLOR_BLACK;
     NCURSES_COLOR_T tx = -1;
     int ac = 0;
-    unsigned j, k;
     WINDOW *my_wins[SIZEOF(attrs_to_test)];
     ATTR_TBL my_list[SIZEOF(attrs_to_test)];
     unsigned my_size = init_attr_list(my_list, termattrs());
 
     if (my_size > 1) {
     WINDOW *my_wins[SIZEOF(attrs_to_test)];
     ATTR_TBL my_list[SIZEOF(attrs_to_test)];
     unsigned my_size = init_attr_list(my_list, termattrs());
 
     if (my_size > 1) {
+       unsigned j, k;
+
        for (j = 0; j < my_size; ++j) {
            my_wins[j] = subwin(stdscr,
                                1, LEN_ATTRSTRING,
        for (j = 0; j < my_size; ++j) {
            my_wins[j] = subwin(stdscr,
                                1, LEN_ATTRSTRING,
@@ -1791,9 +1795,10 @@ wide_adjust_attr_string(int adjust)
 {
     wchar_t save = wide_attr_test_string[0];
     int first = ((int) normal_wchar(save)) + adjust;
 {
     wchar_t save = wide_attr_test_string[0];
     int first = ((int) normal_wchar(save)) + adjust;
-    int j, k;
 
     if (first >= ATTRSTRING_1ST) {
 
     if (first >= ATTRSTRING_1ST) {
+       int j, k;
+
        for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
            if (k > ATTRSTRING_END)
                break;
        for (j = 0, k = first; j < MAX_ATTRSTRING; ++j, ++k) {
            if (k > ATTRSTRING_END)
                break;
@@ -1843,10 +1848,11 @@ get_wide_background(void)
     attr_t attr;
     cchar_t ch;
     NCURSES_PAIRS_T pair;
     attr_t attr;
     cchar_t ch;
     NCURSES_PAIRS_T pair;
-    wchar_t wch[CCHARW_MAX];
 
     memset(&ch, 0, sizeof(ch));
     if (getbkgrnd(&ch) != ERR) {
 
     memset(&ch, 0, sizeof(ch));
     if (getbkgrnd(&ch) != ERR) {
+       wchar_t wch[CCHARW_MAX];
+
        if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) {
            result = attr;
        }
        if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) {
            result = attr;
        }
@@ -2022,12 +2028,13 @@ x_attr_test(bool recur GCC_UNUSED)
     NCURSES_COLOR_T bg = COLOR_BLACK;
     NCURSES_COLOR_T tx = -1;
     int ac = 0;
     NCURSES_COLOR_T bg = COLOR_BLACK;
     NCURSES_COLOR_T tx = -1;
     int ac = 0;
-    unsigned j, k;
     W_ATTR_TBL my_list[SIZEOF(w_attrs_to_test)];
     WINDOW *my_wins[SIZEOF(w_attrs_to_test)];
     unsigned my_size = init_w_attr_list(my_list, term_attrs());
 
     if (my_size > 1) {
     W_ATTR_TBL my_list[SIZEOF(w_attrs_to_test)];
     WINDOW *my_wins[SIZEOF(w_attrs_to_test)];
     unsigned my_size = init_w_attr_list(my_list, term_attrs());
 
     if (my_size > 1) {
+       unsigned j, k;
+
        for (j = 0; j < my_size; ++j) {
            my_wins[j] = subwin(stdscr,
                                1, LEN_ATTRSTRING,
        for (j = 0; j < my_size; ++j) {
            my_wins[j] = subwin(stdscr,
                                1, LEN_ATTRSTRING,
@@ -2133,13 +2140,11 @@ show_color_name(int y, int x, int color, bool wide, int zoom)
        int width = 8;
 
        if (wide || zoom) {
        int width = 8;
 
        if (wide || zoom) {
-           int have;
-
            _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
                        "%02d", color);
            if (wide)
                width = 4;
            _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
                        "%02d", color);
            if (wide)
                width = 4;
-           if ((have = (int) strlen(temp)) >= width) {
+           if ((int) strlen(temp) >= width) {
                int pwr2 = 0;
                while ((1 << pwr2) < color)
                    ++pwr2;
                int pwr2 = 0;
                while ((1 << pwr2) < color)
                    ++pwr2;
@@ -2516,7 +2521,7 @@ x_color_test(bool recur GCC_UNUSED)
     int base_row = 0;
     int grid_top = top + 3;
     int page_size = (LINES - grid_top);
     int base_row = 0;
     int grid_top = top + 3;
     int page_size = (LINES - grid_top);
-    int pairs_max = (unsigned short) (-1);
+    int pairs_max;
     int colors_max = COLORS;
     int col_limit;
     int row_limit;
     int colors_max = COLORS;
     int col_limit;
     int row_limit;
@@ -2839,14 +2844,16 @@ init_all_colors(bool xterm_colors, char *palette_file)
      */
     if (xterm_colors) {
        int n;
      */
     if (xterm_colors) {
        int n;
-       int got;
        char result[BUFSIZ];
        int check_n;
        unsigned check_r, check_g, check_b;
 
        raw();
        noecho();
        char result[BUFSIZ];
        int check_n;
        unsigned check_r, check_g, check_b;
 
        raw();
        noecho();
+
        for (n = 0; n < MaxColors; ++n) {
        for (n = 0; n < MaxColors; ++n) {
+           int got;
+
            fprintf(stderr, "\033]4;%d;?\007", n);
            got = (int) read(0, result, sizeof(result) - 1);
            if (got < 0)
            fprintf(stderr, "\033]4;%d;?\007", n);
            got = (int) read(0, result, sizeof(result) - 1);
            if (got < 0)
@@ -3500,14 +3507,15 @@ x_slk_test(bool recur GCC_UNUSED)
                char *temp = strdup(s);
                size_t used = strlen(temp);
                size_t want = SLKLEN;
                char *temp = strdup(s);
                size_t used = strlen(temp);
                size_t want = SLKLEN;
-               size_t test;
 #ifndef state_unused
                mbstate_t state;
 #endif
 
                buf[0] = L'\0';
                while (want > 0 && used != 0) {
 #ifndef state_unused
                mbstate_t state;
 #endif
 
                buf[0] = L'\0';
                while (want > 0 && used != 0) {
+                   size_t test;
                    const char *base = s;
                    const char *base = s;
+
                    reset_mbytes(state);
                    test = count_mbytes(base, 0, &state);
                    if (test == (size_t) -1) {
                    reset_mbytes(state);
                    test = count_mbytes(base, 0, &state);
                    if (test == (size_t) -1) {
@@ -3923,15 +3931,14 @@ acs_test(bool recur GCC_UNUSED)
 static cchar_t *
 merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair)
 {
 static cchar_t *
 merge_wide_attr(cchar_t *dst, const cchar_t *src, attr_t attr, NCURSES_PAIRS_T pair)
 {
-    int count;
 
     *dst = *src;
     do {
 
     *dst = *src;
     do {
+       int count;
        TEST_CCHAR(src, count, {
            attr |= (test_attrs & A_ALTCHARSET);
            setcchar(dst, test_wch, attr, pair, NULL);
        TEST_CCHAR(src, count, {
            attr |= (test_attrs & A_ALTCHARSET);
            setcchar(dst, test_wch, attr, pair, NULL);
-       }
-       , {
+       }, {
            ;
        });
     } while (0);
            ;
        });
     } while (0);
@@ -4003,7 +4010,6 @@ show_upper_widechars(unsigned first, int repeat, int space, attr_t attr, NCURSES
        wchar_t codes[10];
        char tmp[80];
        int count = repeat;
        wchar_t codes[10];
        char tmp[80];
        int count = repeat;
-       int y, x;
 
        _nc_SPRINTF(tmp, _nc_SLIMIT(sizeof(tmp))
                    "%3ld (0x%lx)", (long) code, (long) code);
 
        _nc_SPRINTF(tmp, _nc_SLIMIT(sizeof(tmp))
                    "%3ld (0x%lx)", (long) code, (long) code);
@@ -4014,6 +4020,8 @@ show_upper_widechars(unsigned first, int repeat, int space, attr_t attr, NCURSES
        setcchar(&temp, codes, attr, pair, 0);
 
        do {
        setcchar(&temp, codes, attr, pair, 0);
 
        do {
+           int y, x;
+
            /*
             * Give non-spacing characters something to combine with.  If we
             * don't, they'll bunch up in a heap on the space after the ":".
            /*
             * Give non-spacing characters something to combine with.  If we
             * don't, they'll bunch up in a heap on the space after the ":".
@@ -4653,13 +4661,15 @@ newwin_legend(FRAME * curp)
     };
 #undef DATA
     size_t n;
     };
 #undef DATA
     size_t n;
-    int x;
     bool do_keypad = HaveKeypad(curp);
     bool do_scroll = HaveScroll(curp);
     char buf[BUFSIZ];
 
     move(LINES - 4, 0);
     bool do_keypad = HaveKeypad(curp);
     bool do_scroll = HaveScroll(curp);
     char buf[BUFSIZ];
 
     move(LINES - 4, 0);
+
     for (n = 0; n < SIZEOF(legend); n++) {
     for (n = 0; n < SIZEOF(legend); n++) {
+       int x;
+
        switch (legend[n].code) {
        default:
            _nc_STRCPY(buf, legend[n].msg, sizeof(buf));
        switch (legend[n].code) {
        default:
            _nc_STRCPY(buf, legend[n].msg, sizeof(buf));
@@ -5003,7 +5013,7 @@ scroll_test(bool recur GCC_UNUSED)
        case CTRL('X'): /* resize window */
            if (current) {
                pair *tmp, ul, lr;
        case CTRL('X'): /* resize window */
            if (current) {
                pair *tmp, ul, lr;
-               int i, mx, my;
+               int mx, my;
 
                move(0, 0);
                clrtoeol();
 
                move(0, 0);
                clrtoeol();
@@ -5032,11 +5042,13 @@ scroll_test(bool recur GCC_UNUSED)
                    wclrtobot(current->wind);
                    wmove(current->wind, lr.y, lr.x);
                }
                    wclrtobot(current->wind);
                    wmove(current->wind, lr.y, lr.x);
                }
-               if (mx > tmp->x - ul.x)
+               if (mx > tmp->x - ul.x) {
+                   int i;
                    for (i = 0; i < my; i++) {
                        wmove(current->wind, i, tmp->x - ul.x + 1);
                        wclrtoeol(current->wind);
                    }
                    for (i = 0; i < my; i++) {
                        wmove(current->wind, i, tmp->x - ul.x + 1);
                        wclrtoeol(current->wind);
                    }
+               }
                wnoutrefresh(current->wind);
 
                memcpy(&lr, tmp, sizeof(pair));
                wnoutrefresh(current->wind);
 
                memcpy(&lr, tmp, sizeof(pair));
@@ -5850,13 +5862,13 @@ padgetch(WINDOW *win)
 {
     static int count;
     static int last;
 {
     static int count;
     static int last;
-    int c;
 
     if ((pending_pan = (count > 0)) != FALSE) {
        count--;
        pending_pan = (count != 0);
     } else {
        for (;;) {
 
     if ((pending_pan = (count > 0)) != FALSE) {
        count--;
        pending_pan = (count != 0);
     } else {
        for (;;) {
+           int c;
            switch (c = wGetchar(win)) {
            case '!':
                ShellOut(FALSE);
            switch (c = wGetchar(win)) {
            case '!':
                ShellOut(FALSE);
@@ -6210,10 +6222,10 @@ static char *
 tracetrace(unsigned tlevel)
 {
     static char *buf;
 tracetrace(unsigned tlevel)
 {
     static char *buf;
-    static size_t need = 12;
     int n;
 
     if (buf == 0) {
     int n;
 
     if (buf == 0) {
+       static size_t need = 12;
        for (n = 0; t_tbl[n].name != 0; n++)
            need += strlen(t_tbl[n].name) + 2;
        buf = typeMalloc(char, need);
        for (n = 0; t_tbl[n].name != 0; n++)
            need += strlen(t_tbl[n].name) + 2;
        buf = typeMalloc(char, need);
@@ -6425,9 +6437,9 @@ edit_secure(FIELD *me, int c)
        size_t have = (source ? strlen(source) : 0) + 1;
        size_t need = 80 + have;
        char *temp = malloc(need);
        size_t have = (source ? strlen(source) : 0) + 1;
        size_t need = 80 + have;
        char *temp = malloc(need);
-       size_t len;
 
        if (temp != 0) {
 
        if (temp != 0) {
+           size_t len;
            _nc_STRNCPY(temp, source ? source : "", have + 1);
            len = (size_t) (char *) field_userptr(me);
            if (c <= KEY_MAX) {
            _nc_STRNCPY(temp, source ? source : "", have + 1);
            len = (size_t) (char *) field_userptr(me);
            if (c <= KEY_MAX) {
@@ -6530,7 +6542,6 @@ form_virtualize(FORM *f, WINDOW *w)
 
     static int mode = REQ_INS_MODE;
     int c = wGetchar(w);
 
     static int mode = REQ_INS_MODE;
     int c = wGetchar(w);
-    unsigned n;
     FIELD *me = current_field(f);
     bool current = TRUE;
 
     FIELD *me = current_field(f);
     bool current = TRUE;
 
@@ -6542,6 +6553,7 @@ form_virtualize(FORM *f, WINDOW *w)
        }
        c = mode;
     } else {
        }
        c = mode;
     } else {
+       unsigned n;
        for (n = 0; n < SIZEOF(lookup); n++) {
            if (lookup[n].code == c) {
                c = lookup[n].result;
        for (n = 0; n < SIZEOF(lookup); n++) {
            if (lookup[n].code == c) {
                c = lookup[n].result;
@@ -6676,12 +6688,11 @@ CHAR_CHECK_CB(pw_char_check)
 static int
 form_test(bool recur GCC_UNUSED)
 {
 static int
 form_test(bool recur GCC_UNUSED)
 {
-    WINDOW *w;
     FORM *form;
     FIELD *f[12], *secure;
     FIELDTYPE *fty_middle = new_fieldtype(mi_field_check, mi_char_check);
     FIELDTYPE *fty_passwd = new_fieldtype(pw_field_check, pw_char_check);
     FORM *form;
     FIELD *f[12], *secure;
     FIELDTYPE *fty_middle = new_fieldtype(mi_field_check, mi_char_check);
     FIELDTYPE *fty_passwd = new_fieldtype(pw_field_check, pw_char_check);
-    int finished = 0, c;
+    int c;
     unsigned n = 0;
 
 #ifdef NCURSES_MOUSE_VERSION
     unsigned n = 0;
 
 #ifdef NCURSES_MOUSE_VERSION
@@ -6731,6 +6742,8 @@ form_test(bool recur GCC_UNUSED)
     f[n] = (FIELD *) 0;
 
     if ((form = new_form(f)) != 0) {
     f[n] = (FIELD *) 0;
 
     if ((form = new_form(f)) != 0) {
+       WINDOW *w;
+       int finished = 0;
 
        display_form(form);
 
 
        display_form(form);
 
@@ -7024,11 +7037,8 @@ overlap_test_2_attr(WINDOW *win, int flavor, int col)
 static int
 overlap_help(int state, int flavors[OVERLAP_FLAVORS])
 {
 static int
 overlap_help(int state, int flavors[OVERLAP_FLAVORS])
 {
-    int row;
-    int col;
     int item;
     int limit[OVERLAP_FLAVORS];
     int item;
     int limit[OVERLAP_FLAVORS];
-    const char *ths, *tht;
     char msg[80];
 
     if (state < 0)
     char msg[80];
 
     if (state < 0)
@@ -7037,10 +7047,10 @@ overlap_help(int state, int flavors[OVERLAP_FLAVORS])
     assert(state >= 0 && state < OVERLAP_FLAVORS);
 
     for (item = 0; item < (2 * OVERLAP_FLAVORS); ++item) {
     assert(state >= 0 && state < OVERLAP_FLAVORS);
 
     for (item = 0; item < (2 * OVERLAP_FLAVORS); ++item) {
-       row = item / 2;
-       col = item % 2;
-       ths = col ? "B" : "A";
-       tht = col ? "A" : "B";
+       int row = item / 2;
+       int col = item % 2;
+       const char *ths = col ? "B" : "A";
+       const char *tht = col ? "A" : "B";
 
        switch ((otBASE) row) {
        case otBASE_refresh:
 
        switch ((otBASE) row) {
        case otBASE_refresh:
index 20b26d024e4ae32e38de030572ce86c4fda6cf78..04c52751c570814d90b4f96e635e66022c9e971c 100644 (file)
@@ -2,7 +2,7 @@
  *  newdemo.c  -       A demo program using PDCurses. The program illustrate
  *                     the use of colours for text output.
  *
  *  newdemo.c  -       A demo program using PDCurses. The program illustrate
  *                     the use of colours for text output.
  *
- * $Id: newdemo.c,v 1.45 2017/09/30 15:43:08 tom Exp $
+ * $Id: newdemo.c,v 1.46 2019/08/24 23:02:49 tom Exp $
  */
 
 #include <test.priv.h>
  */
 
 #include <test.priv.h>
@@ -61,11 +61,12 @@ static int
 WaitForUser(WINDOW *win)
 {
     time_t t;
 WaitForUser(WINDOW *win)
 {
     time_t t;
-    chtype key;
 
     nodelay(win, TRUE);
     t = time((time_t *) 0);
 
     nodelay(win, TRUE);
     t = time((time_t *) 0);
+
     while (1) {
     while (1) {
+       chtype key;
        if ((int) (key = (chtype) wgetch(win)) != ERR) {
            if (key == 'q' || key == 'Q')
                return 1;
        if ((int) (key = (chtype) wgetch(win)) != ERR) {
            if (key == 'q' || key == 'Q')
                return 1;
@@ -221,12 +222,10 @@ int
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
     WINDOW *win;
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
     WINDOW *win;
-    int w, x, y, i, j, k;
+    int x, y, i, k;
     char buffer[SIZEOF(messages) * 80];
     char buffer[SIZEOF(messages) * 80];
-    const char *message;
     int width, height;
     chtype save[80];
     int width, height;
     chtype save[80];
-    chtype c;
 
     setlocale(LC_ALL, "");
 
 
     setlocale(LC_ALL, "");
 
@@ -244,6 +243,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
     }
 
     while (1) {
     }
 
     while (1) {
+       int w;
+       int j;
+       chtype c;
+       const char *message;
+
        set_colors(win, 1, COLOR_WHITE, COLOR_BLUE);
        werase(win);
 
        set_colors(win, 1, COLOR_WHITE, COLOR_BLUE);
        werase(win);
 
index 1c9e2ab91ebfe750b981abcd808a78e88d0e9dca..2b39a7bc0ef190c11148ef81a197c47eb1d55c79 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: pair_content.c,v 1.12 2019/01/21 01:05:22 tom Exp $
+ * $Id: pair_content.c,v 1.13 2019/08/24 23:02:49 tom Exp $
  */
 
 #define NEED_TIME_H
  */
 
 #define NEED_TIME_H
@@ -237,7 +237,6 @@ int
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
     int i;
 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 {
     int i;
-    int repeat;
 
     while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) {
        switch (i) {
 
     while ((i = getopt(argc, argv, "f:il:npr:sx")) != -1) {
        switch (i) {
@@ -291,6 +290,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
            }
        }
     } else {
            }
        }
     } else {
+       int repeat;
 
        for (repeat = 0; repeat < r_opt; ++repeat) {
            run_test();
 
        for (repeat = 0; repeat < r_opt; ++repeat) {
            run_test();
index dd33d78c0ceac67d2377f91ea1cc3aa3c322c75f..baa5de8465f04cab54befa838eabe4568ca303aa 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: picsmap.c,v 1.129 2019/04/20 20:33:51 tom Exp $
+ * $Id: picsmap.c,v 1.130 2019/08/24 23:07:34 tom Exp $
  *
  * Author: Thomas E. Dickey
  *
  *
  * Author: Thomas E. Dickey
  *
@@ -430,9 +430,7 @@ read_file(const char *filename)
     if (is_file(filename, &sb)) {
        size_t size = (size_t) sb.st_size;
        char *blob = typeCalloc(char, size + 1);
     if (is_file(filename, &sb)) {
        size_t size = (size_t) sb.st_size;
        char *blob = typeCalloc(char, size + 1);
-       bool had_line = TRUE;
        bool binary = FALSE;
        bool binary = FALSE;
-       unsigned j;
        unsigned k = 0;
 
        result = typeCalloc(char *, size + 1);
        unsigned k = 0;
 
        result = typeCalloc(char *, size + 1);
@@ -442,7 +440,11 @@ read_file(const char *filename)
            FILE *fp = fopen(filename, "r");
            if (fp != 0) {
                logmsg("opened %s", filename);
            FILE *fp = fopen(filename, "r");
            if (fp != 0) {
                logmsg("opened %s", filename);
+
                if (fread(blob, sizeof(char), size, fp) == size) {
                if (fread(blob, sizeof(char), size, fp) == size) {
+                   bool had_line = TRUE;
+                   unsigned j;
+
                    for (j = 0; (size_t) j < size; ++j) {
                        if (blob[j] == '\0' ||
                            (UChar(blob[j]) < 32 &&
                    for (j = 0; (size_t) j < size; ++j) {
                        if (blob[j] == '\0' ||
                            (UChar(blob[j]) < 32 &&
@@ -683,9 +685,9 @@ init_palette(const char *palette_file)
        if ((power2 != COLORS) || ((shift % 3) != 0)) {
            if (all_colors == 0) {
                init_palette(getenv("TERM"));
        if ((power2 != COLORS) || ((shift % 3) != 0)) {
            if (all_colors == 0) {
                init_palette(getenv("TERM"));
-           }
-           if (all_colors == 0) {
-               giveup("With %d colors, you need a palette-file", COLORS);
+               if (all_colors == 0) {
+                   giveup("With %d colors, you need a palette-file", COLORS);
+               }
            }
        }
     }
            }
        }
     }
@@ -876,7 +878,6 @@ match_colors(const char *source, int cpp, char *arg1, char *arg2, char *arg3)
        arg1[cpp] = '\0';
        result = 1;
     } else {
        arg1[cpp] = '\0';
        result = 1;
     } else {
-       char *t;
        const char *s = skip_cs(source);
        size_t have = strlen(source);
 
        const char *s = skip_cs(source);
        size_t have = strlen(source);
 
@@ -884,6 +885,7 @@ match_colors(const char *source, int cpp, char *arg1, char *arg2, char *arg3)
            memcpy(arg1, s, (size_t) cpp);
            s += cpp;
            while (*s++ == '\t') {
            memcpy(arg1, s, (size_t) cpp);
            s += cpp;
            while (*s++ == '\t') {
+               char *t;
                for (t = arg2; (*s != '\0') && strchr("\t\"", *s) == 0;) {
                    if (*s == ' ') {
                        s = skip_cs(s);
                for (t = arg2; (*s != '\0') && strchr("\t\"", *s) == 0;) {
                    if (*s == ' ') {
                        s = skip_cs(s);
@@ -1333,9 +1335,9 @@ parse_img(const char *filename)
                /* subsequent lines begin "col,row: (r,g,b,a) #RGB" */
                int r, g, b, nocolor;
                unsigned check;
                /* subsequent lines begin "col,row: (r,g,b,a) #RGB" */
                int r, g, b, nocolor;
                unsigned check;
-               int which, c;
                char *t;
                char *s = t = strchr(buffer, '#');
                char *t;
                char *s = t = strchr(buffer, '#');
+
                if (s != 0) {
                    /* after the "#RGB", there are differences - just ignore */
                    while (*s != '\0' && !isspace(UChar(*s)))
                if (s != 0) {
                    /* after the "#RGB", there are differences - just ignore */
                    while (*s != '\0' && !isspace(UChar(*s)))
@@ -1347,6 +1349,8 @@ parse_img(const char *filename)
                            &col, &row,
                            &r, &g, &b, &nocolor,
                            &check)) {
                            &col, &row,
                            &r, &g, &b, &nocolor,
                            &check)) {
+                   int which, c;
+
                    if ((s - t) > 8)    /* 6 hex digits vs 8 */
                        check /= 256;
                    if (r > MaxRGB ||
                    if ((s - t) > 8)    /* 6 hex digits vs 8 */
                        check /= 256;
                    if (r > MaxRGB ||
@@ -1474,7 +1478,6 @@ show_picture(PICS_HEAD * pics)
 {
     int y, x;
     int n;
 {
     int y, x;
     int n;
-    int my_pair, my_color;
 
     debugmsg("called show_picture");
     logmsg("...using %dx%d screen", LINES, COLS);
 
     debugmsg("called show_picture");
     logmsg("...using %dx%d screen", LINES, COLS);
@@ -1487,8 +1490,8 @@ show_picture(PICS_HEAD * pics)
     if (has_colors()) {
        logmsg("...using %d colors", pics->colors);
        for (n = 0; n < pics->colors; ++n) {
     if (has_colors()) {
        logmsg("...using %d colors", pics->colors);
        for (n = 0; n < pics->colors; ++n) {
-           my_pair = (n + 1);
-           my_color = map_color(fg_color(pics, n));
+           int my_pair = (n + 1);
+           int my_color = map_color(fg_color(pics, n));
 #if USE_EXTENDED_COLORS
            if (use_extended_pairs) {
                init_extended_pair(my_pair, my_color, my_color);
 #if USE_EXTENDED_COLORS
            if (use_extended_pairs) {
                init_extended_pair(my_pair, my_color, my_color);
@@ -1507,7 +1510,10 @@ show_picture(PICS_HEAD * pics)
        if (y >= LINES)
            break;
        move(y, 0);
        if (y >= LINES)
            break;
        move(y, 0);
+
        for (x = 0; x < pics->wide; ++x) {
        for (x = 0; x < pics->wide; ++x) {
+           int my_pair;
+
            if (x >= COLS)
                break;
            n = (y * pics->wide + x);
            if (x >= COLS)
                break;
            n = (y * pics->wide + x);
@@ -1557,11 +1563,9 @@ compare_fg_counts(const void *a, const void *b)
 static void
 report_colors(PICS_HEAD * pics)
 {
 static void
 report_colors(PICS_HEAD * pics)
 {
-    int j, k;
-    int high;
-    int wide = 4;
     int accum;
     double level;
     int accum;
     double level;
+    int j;
     int shift;
     int total;
     char buffer[256];
     int shift;
     int total;
     char buffer[256];
@@ -1575,6 +1579,8 @@ report_colors(PICS_HEAD * pics)
      */
     if (debugging && (pics->colors < 1000)) {
        int digits = 0;
      */
     if (debugging && (pics->colors < 1000)) {
        int digits = 0;
+       int high;
+       int wide = 4;
        for (j = pics->colors; j != 0; j /= 10) {
            ++digits;
            if (j < 10)
        for (j = pics->colors; j != 0; j /= 10) {
            ++digits;
            if (j < 10)
@@ -1585,6 +1591,7 @@ report_colors(PICS_HEAD * pics)
        logmsg("These colors were used:");
        high = (pics->colors + wide - 1) / wide;
        for (j = 0; j < high && j < pics->colors; ++j) {
        logmsg("These colors were used:");
        high = (pics->colors + wide - 1) / wide;
        for (j = 0; j < high && j < pics->colors; ++j) {
+           int k;
            char *s = buffer;
            *s = '\0';
            for (k = 0; k < wide; ++k) {
            char *s = buffer;
            *s = '\0';
            for (k = 0; k < wide; ++k) {
index 12844cbdd7041009e528fc61884d5f77b80df51a..246dc0d4afa9480bb895a6a9c5973fc3934c31fe 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2000-2013,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 2000-2017,2019 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.22 2017/09/30 17:55:22 tom Exp $
+ * $Id: railroad.c,v 1.23 2019/08/24 23:11:01 tom Exp $
  *
  * A simple demo of the termcap interface.
  */
  *
  * A simple demo of the termcap interface.
  */
@@ -113,7 +113,7 @@ static void
 ShowSign(char *string)
 {
     char *base = string;
 ShowSign(char *string)
 {
     char *base = string;
-    int ch, first, last;
+    int first, last;
 
     if (moveit != 0) {
        tputs(tgoto(moveit, 0, height - 1), 1, outc);
 
     if (moveit != 0) {
        tputs(tgoto(moveit, 0, height - 1), 1, outc);
@@ -121,7 +121,7 @@ ShowSign(char *string)
     }
 
     while (*string != 0) {
     }
 
     while (*string != 0) {
-       ch = *string;
+       int ch = *string;
        if (ch != ' ') {
            if (moveit != 0) {
                for (first = length - 2; first >= (string - base); first--) {
        if (ch != ' ') {
            if (moveit != 0) {
                for (first = length - 2; first >= (string - base); first--) {