]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/xmas.c
ncurses 5.7 - patch 20090905
[ncurses.git] / test / xmas.c
index 144ccea22aec683b21aed5a07d942bcfb621c6ba..79a56a58483265ee1f809b069261fc9581b2da95 100644 (file)
@@ -92,7 +92,7 @@
 /******************************************************************************/
 
 /*
- * $Id: xmas.c,v 1.22 2006/05/20 15:35:47 tom Exp $
+ * $Id: xmas.c,v 1.25 2009/08/29 18:47:26 tom Exp $
  */
 #include <test.priv.h>
 
@@ -156,7 +156,7 @@ set_color(WINDOW *win, chtype color)
     if (has_colors()) {
        int n = (color + 1);
        if (my_pairs == 0)
-           my_pairs = (bool *) calloc((unsigned) (COLORS + 1), sizeof(bool));
+           my_pairs = typeCalloc(bool, COLORS + 1);
        if (!my_pairs[n]) {
            init_pair(n, color, my_bg);
            my_pairs[n] = TRUE;
@@ -170,7 +170,7 @@ static void
 unset_color(WINDOW *win)
 {
     if (has_colors())
-       wattrset(win, COLOR_PAIR(0));
+       (void) wattrset(win, COLOR_PAIR(0));
 }
 
 static void
@@ -206,44 +206,48 @@ main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
     }
     curs_set(0);
 
-    treescrn = newwin(16, 27, 3, 53);
-    treescrn2 = newwin(16, 27, 3, 53);
-    treescrn3 = newwin(16, 27, 3, 53);
-    treescrn4 = newwin(16, 27, 3, 53);
-    treescrn5 = newwin(16, 27, 3, 53);
-    treescrn6 = newwin(16, 27, 3, 53);
-    treescrn7 = newwin(16, 27, 3, 53);
-    treescrn8 = newwin(16, 27, 3, 53);
-
-    dotdeer0 = newwin(3, 71, 0, 8);
-
-    stardeer0 = newwin(4, 56, 0, 8);
-
-    lildeer0 = newwin(7, 53, 0, 8);
-    lildeer1 = newwin(2, 4, 0, 0);
-    lildeer2 = newwin(2, 4, 0, 0);
-    lildeer3 = newwin(2, 4, 0, 0);
-
-    middeer0 = newwin(15, 42, 0, 8);
-    middeer1 = newwin(3, 7, 0, 0);
-    middeer2 = newwin(3, 7, 0, 0);
-    middeer3 = newwin(3, 7, 0, 0);
-
-    bigdeer0 = newwin(10, 23, 0, 0);
-    bigdeer1 = newwin(10, 23, 0, 0);
-    bigdeer2 = newwin(10, 23, 0, 0);
-    bigdeer3 = newwin(10, 23, 0, 0);
-    bigdeer4 = newwin(10, 23, 0, 0);
-
-    lookdeer0 = newwin(10, 25, 0, 0);
-    lookdeer1 = newwin(10, 25, 0, 0);
-    lookdeer2 = newwin(10, 25, 0, 0);
-    lookdeer3 = newwin(10, 25, 0, 0);
-    lookdeer4 = newwin(10, 25, 0, 0);
-
-    w_holiday = newwin(1, 26, 3, 27);
-
-    w_del_msg = newwin(1, 19, 23, 60);
+    if ((treescrn = newwin(16, 27, 3, 53)) == 0 ||
+       (treescrn2 = newwin(16, 27, 3, 53)) == 0 ||
+       (treescrn3 = newwin(16, 27, 3, 53)) == 0 ||
+       (treescrn4 = newwin(16, 27, 3, 53)) == 0 ||
+       (treescrn5 = newwin(16, 27, 3, 53)) == 0 ||
+       (treescrn6 = newwin(16, 27, 3, 53)) == 0 ||
+       (treescrn7 = newwin(16, 27, 3, 53)) == 0 ||
+       (treescrn8 = newwin(16, 27, 3, 53)) == 0 ||
+
+       (dotdeer0 = newwin(3, 71, 0, 8)) == 0 ||
+
+       (stardeer0 = newwin(4, 56, 0, 8)) == 0 ||
+
+       (lildeer0 = newwin(7, 53, 0, 8)) == 0 ||
+       (lildeer1 = newwin(2, 4, 0, 0)) == 0 ||
+       (lildeer2 = newwin(2, 4, 0, 0)) == 0 ||
+       (lildeer3 = newwin(2, 4, 0, 0)) == 0 ||
+
+       (middeer0 = newwin(15, 42, 0, 8)) == 0 ||
+       (middeer1 = newwin(3, 7, 0, 0)) == 0 ||
+       (middeer2 = newwin(3, 7, 0, 0)) == 0 ||
+       (middeer3 = newwin(3, 7, 0, 0)) == 0 ||
+
+       (bigdeer0 = newwin(10, 23, 0, 0)) == 0 ||
+       (bigdeer1 = newwin(10, 23, 0, 0)) == 0 ||
+       (bigdeer2 = newwin(10, 23, 0, 0)) == 0 ||
+       (bigdeer3 = newwin(10, 23, 0, 0)) == 0 ||
+       (bigdeer4 = newwin(10, 23, 0, 0)) == 0 ||
+
+       (lookdeer0 = newwin(10, 25, 0, 0)) == 0 ||
+       (lookdeer1 = newwin(10, 25, 0, 0)) == 0 ||
+       (lookdeer2 = newwin(10, 25, 0, 0)) == 0 ||
+       (lookdeer3 = newwin(10, 25, 0, 0)) == 0 ||
+       (lookdeer4 = newwin(10, 25, 0, 0)) == 0 ||
+
+       (w_holiday = newwin(1, 26, 3, 27)) == 0 ||
+
+       (w_del_msg = newwin(1, 19, 23, 60)) == 0) {
+       endwin();
+       fprintf(stderr, "Cannot create windows - screen too small\n");
+       ExitProgram(EXIT_FAILURE);
+    }
 
     mvwaddstr(w_del_msg, 0, 0, "Hit any key to quit");
 
@@ -529,9 +533,9 @@ main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
        mvwaddch(treescrn4, 12, 23, ' ');
 
        /*star */
-       wstandout(treescrn4);
+       (void) wstandout(treescrn4);
        mvwaddch(treescrn4, 0, 12, '*');
-       wstandend(treescrn4);
+       (void) wstandend(treescrn4);
 
        /*strng1 */
        mvwaddch(treescrn4, 3, 13, ' ');
@@ -593,9 +597,9 @@ main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
        mvwaddch(treescrn6, 11, 23, ' ');
 
        /*star */
-       wstandout(treescrn6);
+       (void) wstandout(treescrn6);
        mvwaddch(treescrn6, 0, 12, '*');
-       wstandend(treescrn6);
+       (void) wstandend(treescrn6);
 
        /*strng1 */
 
@@ -812,11 +816,11 @@ balls(void)
 static int
 star(void)
 {
-    wattrset(treescrn2, A_BOLD | A_BLINK);
+    (void) wattrset(treescrn2, A_BOLD | A_BLINK);
     set_color(treescrn2, COLOR_YELLOW);
 
     mvwaddch(treescrn2, 0, 12, (chtype) '*');
-    wstandend(treescrn2);
+    (void) wstandend(treescrn2);
 
     unset_color(treescrn2);
     wrefresh(treescrn2);
@@ -827,7 +831,7 @@ star(void)
 static int
 strng1(void)
 {
-    wattrset(treescrn2, A_BOLD | A_BLINK);
+    (void) wattrset(treescrn2, A_BOLD | A_BLINK);
     set_color(treescrn2, COLOR_WHITE);
 
     mvwaddch(treescrn2, 3, 13, (chtype) '\'');
@@ -845,7 +849,7 @@ strng1(void)
 static int
 strng2(void)
 {
-    wattrset(treescrn2, A_BOLD | A_BLINK);
+    (void) wattrset(treescrn2, A_BOLD | A_BLINK);
     set_color(treescrn2, COLOR_WHITE);
 
     mvwaddch(treescrn2, 5, 14, (chtype) '\'');
@@ -866,7 +870,7 @@ strng2(void)
 static int
 strng3(void)
 {
-    wattrset(treescrn2, A_BOLD | A_BLINK);
+    (void) wattrset(treescrn2, A_BOLD | A_BLINK);
     set_color(treescrn2, COLOR_WHITE);
 
     mvwaddch(treescrn2, 7, 16, (chtype) '\'');
@@ -889,7 +893,7 @@ strng3(void)
 static int
 strng4(void)
 {
-    wattrset(treescrn2, A_BOLD | A_BLINK);
+    (void) wattrset(treescrn2, A_BOLD | A_BLINK);
     set_color(treescrn2, COLOR_WHITE);
 
     mvwaddch(treescrn2, 9, 17, (chtype) '\'');
@@ -917,7 +921,7 @@ strng4(void)
 static int
 strng5(void)
 {
-    wattrset(treescrn2, A_BOLD | A_BLINK);
+    (void) wattrset(treescrn2, A_BOLD | A_BLINK);
     set_color(treescrn2, COLOR_WHITE);
 
     mvwaddch(treescrn2, 11, 19, (chtype) '\'');