]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/test_get_wstr.c
ncurses 6.0 - patch 20170527
[ncurses.git] / test / test_get_wstr.c
index d1424cb1b50ad2b269f30ded5b8d04830453b877..a3037b1bf61d331136d48ef972019c9675ce0579 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2007 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2007-2011,2017 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            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: test_get_wstr.c,v 1.4 2007/07/28 19:46:34 tom Exp $
+ * $Id: test_get_wstr.c,v 1.9 2017/04/15 14:14:25 tom Exp $
  *
  * Author: Thomas E Dickey
  *
@@ -44,6 +44,9 @@
 
 #include <test.priv.h>
 
+#if HAVE_CHGAT
+/* NetBSD curses wchgat */
+
 #if USE_WIDEC_SUPPORT
 
 #define BASE_Y 6
@@ -89,7 +92,7 @@ MovePrompt(WINDOW *txtwin, int limit, int y, int x)
 }
 
 static int
-ShowFlavor(WINDOW *strwin, WINDOW *txtwin, Flavors flavor, int limit)
+ShowFlavor(WINDOW *strwin, WINDOW *txtwin, int flavor, int limit)
 {
     const char *name = "?";
     bool limited = FALSE;
@@ -131,7 +134,7 @@ ShowFlavor(WINDOW *strwin, WINDOW *txtwin, Flavors flavor, int limit)
 }
 
 static int
-test_get_wstr(int level, char **argv, WINDOW *strwin)
+recursive_test(int level, char **argv, WINDOW *strwin)
 {
     WINDOW *txtbox = 0;
     WINDOW *txtwin = 0;
@@ -222,7 +225,7 @@ test_get_wstr(int level, char **argv, WINDOW *strwin)
            break;
 
        case 'w':
-           test_get_wstr(level + 1, argv, strwin);
+           recursive_test(level + 1, argv, strwin);
            if (txtbox != 0) {
                touchwin(txtbox);
                wnoutrefresh(txtbox);
@@ -269,7 +272,7 @@ test_get_wstr(int level, char **argv, WINDOW *strwin)
            *buffer = '\0';
            rc = ERR;
            echo();
-           wattrset(txtwin, A_REVERSE);
+           (void) wattrset(txtwin, A_REVERSE);
            switch (flavor) {
            case eGetStr:
                if (txtwin != stdscr) {
@@ -307,9 +310,9 @@ test_get_wstr(int level, char **argv, WINDOW *strwin)
                break;
            }
            noecho();
-           wattrset(txtwin, A_NORMAL);
+           (void) wattrset(txtwin, A_NORMAL);
            wprintw(strwin, "%d", rc);
-           waddwstr(strwin, (wchar_t *) buffer);
+           (void) waddwstr(strwin, (wchar_t *) buffer);
            wnoutrefresh(strwin);
            break;
        default:
@@ -346,7 +349,7 @@ main(int argc, char *argv[])
 
     strwin = derwin(chrbox, 4, COLS - 2, 1, 1);
 
-    test_get_wstr(1, argv, strwin);
+    recursive_test(1, argv, strwin);
 
     endwin();
     ExitProgram(EXIT_SUCCESS);
@@ -359,3 +362,11 @@ main(void)
     ExitProgram(EXIT_FAILURE);
 }
 #endif
+#else
+int
+main(void)
+{
+    printf("This program requires the curses chgat function\n");
+    ExitProgram(EXIT_FAILURE);
+}
+#endif