]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/ncurses.c
ncurses 6.2 - patch 20210508
[ncurses.git] / test / ncurses.c
index e3ba7b555e40a16399dd2ad07f072dadb11b2d63..966c76afa3b5ab81bd3a82fba833eee13c497513 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright 2018-2019,2020 Thomas E. Dickey                                *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
  * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -41,7 +41,7 @@ AUTHOR
    Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.522 2020/02/02 23:34:34 tom Exp $
+$Id: ncurses.c,v 1.525 2021/05/08 19:44:31 tom Exp $
 
 ***************************************************************************/
 
@@ -166,7 +166,7 @@ static RGB_DATA *all_colors;
 #endif
 
 static void main_menu(bool);
-static void failed(const char *s) GCC_NORETURN;
+static GCC_NORETURN void failed(const char *s);
 
 static void
 failed(const char *s)
@@ -490,7 +490,7 @@ ShellOut(bool message)
        addstr("Shelling out...");
     def_prog_mode();
     endwin();
-#ifdef _WIN32
+#ifdef _NC_WINDOWS
     system("cmd.exe");
 #else
     IGNORE_RC(system("sh"));
@@ -5531,7 +5531,7 @@ panner_legend(int line)
        "Number repeats.  Toggle legend:? filler:a timer:t scrollmark:s."
     };
     int n = ((int) SIZEOF(legend) - (LINES - line));
-    if (n >= 0) {
+    if (n >= 0 && n < (int) SIZEOF(legend)) {
        if (move(line, 0) != ERR) {
            if (show_panner_legend)
                printw("%s", legend[n]);
@@ -6232,7 +6232,7 @@ tracetrace(unsigned tlevel)
     }
     _nc_SPRINTF(buf, _nc_SLIMIT(need) "0x%02x = {", tlevel);
     if (tlevel == 0) {
-       _nc_STRCAT(buf, t_tbl[0].name, need);
+       _nc_STRCAT(buf, t_tbl[0].name ? t_tbl[0].name : "", need);
        _nc_STRCAT(buf, ", ", need);
     } else {
        for (n = 1; t_tbl[n].name != 0; n++)
@@ -7618,6 +7618,10 @@ settings_test(bool recur GCC_UNUSED)
 #if HAVE_COLOR_CONTENT
     show_boolean_setting("can_change_color", can_change_color());
 #endif
+    show_setting_name("LINES");
+    printw("%d\n", LINES);
+    show_setting_name("COLS");
+    printw("%d\n", COLS);
     Pause();
     erase();
     stop_curses();
@@ -7659,7 +7663,7 @@ usage(void)
 #if USE_LIBPANEL
        ,"  -s msec  specify nominal time for panel-demo (default: 1, to hold)"
 #endif
-#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_WIN32)
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_NC_WINDOWS)
        ,"  -T       call use_tioctl(TRUE) to allow SIGWINCH to override environment"
 #endif
 #ifdef TRACE
@@ -7786,7 +7790,6 @@ main_menu(bool top)
     int (*doit) (bool);
     char command;
     unsigned n;
-
     do {
        printf("This is the ncurses main menu (uppercase for wide-characters)\n");
        for (n = 0; n < SIZEOF(cmds); ++n) {
@@ -7962,7 +7965,7 @@ main(int argc, char *argv[])
            nap_msec = (int) atol(optarg);
            break;
 #endif
-#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_WIN32)
+#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20120714) && !defined(_NC_WINDOWS)
        case 'T':
            use_tioctl(TRUE);
            break;