aboutsummaryrefslogtreecommitdiff
path: root/test/xmas.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/xmas.c')
-rw-r--r--test/xmas.c1048
1 files changed, 530 insertions, 518 deletions
diff --git a/test/xmas.c b/test/xmas.c
index 087fcd9d81d1..78b187c20a3e 100644
--- a/test/xmas.c
+++ b/test/xmas.c
@@ -92,7 +92,7 @@
/******************************************************************************/
/*
- * $Id: xmas.c,v 1.28 2013/04/27 19:46:53 tom Exp $
+ * $Id: xmas.c,v 1.34 2019/12/14 23:25:29 tom Exp $
*/
#include <test.priv.h>
@@ -133,21 +133,6 @@ static WINDOW *w_holiday;
static WINDOW *w_del_msg;
static bool *my_pairs;
-static int boxit(void);
-static int seas(void);
-static int greet(void);
-static int fromwho(void);
-static int tree(void);
-static int balls(void);
-static int star(void);
-static int strng1(void);
-static int strng2(void);
-static int strng3(void);
-static int strng4(void);
-static int strng5(void);
-static int reindeer(void);
-static int blinkit(void);
-
static void done(int sig) GCC_NORETURN;
static void
@@ -183,24 +168,544 @@ look_out(int msecs)
}
}
+static int
+boxit(void)
+{
+ int x = 0;
+
+ while (x < 20) {
+ MvAddCh(x, 7, '|');
+ ++x;
+ }
+
+ x = 8;
+
+ while (x < 80) {
+ MvAddCh(19, x, '_');
+ ++x;
+ }
+
+ x = 0;
+
+ while (x < 80) {
+ MvAddCh(22, x, '_');
+ ++x;
+ }
+
+ return (0);
+}
+
+static int
+seas(void)
+{
+ MvAddCh(4, 1, 'S');
+ MvAddCh(6, 1, 'E');
+ MvAddCh(8, 1, 'A');
+ MvAddCh(10, 1, 'S');
+ MvAddCh(12, 1, 'O');
+ MvAddCh(14, 1, 'N');
+ MvAddCh(16, 1, '`');
+ MvAddCh(18, 1, 'S');
+
+ return (0);
+}
+
+static int
+greet(void)
+{
+ MvAddCh(3, 5, 'G');
+ MvAddCh(5, 5, 'R');
+ MvAddCh(7, 5, 'E');
+ MvAddCh(9, 5, 'E');
+ MvAddCh(11, 5, 'T');
+ MvAddCh(13, 5, 'I');
+ MvAddCh(15, 5, 'N');
+ MvAddCh(17, 5, 'G');
+ MvAddCh(19, 5, 'S');
+
+ return (0);
+}
+
+static int
+fromwho(void)
+{
+ MvAddStr(21, 13, FROMWHO);
+ return (0);
+}
+
+static int
+tree(void)
+{
+ set_color(treescrn, COLOR_GREEN);
+ MvWAddCh(treescrn, 1, 11, (chtype) '/');
+ MvWAddCh(treescrn, 2, 11, (chtype) '/');
+ MvWAddCh(treescrn, 3, 10, (chtype) '/');
+ MvWAddCh(treescrn, 4, 9, (chtype) '/');
+ MvWAddCh(treescrn, 5, 9, (chtype) '/');
+ MvWAddCh(treescrn, 6, 8, (chtype) '/');
+ MvWAddCh(treescrn, 7, 7, (chtype) '/');
+ MvWAddCh(treescrn, 8, 6, (chtype) '/');
+ MvWAddCh(treescrn, 9, 6, (chtype) '/');
+ MvWAddCh(treescrn, 10, 5, (chtype) '/');
+ MvWAddCh(treescrn, 11, 3, (chtype) '/');
+ MvWAddCh(treescrn, 12, 2, (chtype) '/');
+
+ MvWAddCh(treescrn, 1, 13, (chtype) '\\');
+ MvWAddCh(treescrn, 2, 13, (chtype) '\\');
+ MvWAddCh(treescrn, 3, 14, (chtype) '\\');
+ MvWAddCh(treescrn, 4, 15, (chtype) '\\');
+ MvWAddCh(treescrn, 5, 15, (chtype) '\\');
+ MvWAddCh(treescrn, 6, 16, (chtype) '\\');
+ MvWAddCh(treescrn, 7, 17, (chtype) '\\');
+ MvWAddCh(treescrn, 8, 18, (chtype) '\\');
+ MvWAddCh(treescrn, 9, 18, (chtype) '\\');
+ MvWAddCh(treescrn, 10, 19, (chtype) '\\');
+ MvWAddCh(treescrn, 11, 21, (chtype) '\\');
+ MvWAddCh(treescrn, 12, 22, (chtype) '\\');
+
+ MvWAddCh(treescrn, 4, 10, (chtype) '_');
+ MvWAddCh(treescrn, 4, 14, (chtype) '_');
+ MvWAddCh(treescrn, 8, 7, (chtype) '_');
+ MvWAddCh(treescrn, 8, 17, (chtype) '_');
+
+ MvWAddStr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\");
+
+ MvWAddStr(treescrn, 14, 11, "| |");
+ MvWAddStr(treescrn, 15, 11, "|_|");
+
+ unset_color(treescrn);
+ wrefresh(treescrn);
+ wrefresh(w_del_msg);
+
+ return (0);
+}
+
+static int
+balls(void)
+{
+ overlay(treescrn, treescrn2);
+
+ set_color(treescrn2, COLOR_BLUE);
+ MvWAddCh(treescrn2, 3, 9, (chtype) '@');
+ MvWAddCh(treescrn2, 3, 15, (chtype) '@');
+ MvWAddCh(treescrn2, 4, 8, (chtype) '@');
+ MvWAddCh(treescrn2, 4, 16, (chtype) '@');
+ MvWAddCh(treescrn2, 5, 7, (chtype) '@');
+ MvWAddCh(treescrn2, 5, 17, (chtype) '@');
+ MvWAddCh(treescrn2, 7, 6, (chtype) '@');
+ MvWAddCh(treescrn2, 7, 18, (chtype) '@');
+ MvWAddCh(treescrn2, 8, 5, (chtype) '@');
+ MvWAddCh(treescrn2, 8, 19, (chtype) '@');
+ MvWAddCh(treescrn2, 10, 4, (chtype) '@');
+ MvWAddCh(treescrn2, 10, 20, (chtype) '@');
+ MvWAddCh(treescrn2, 11, 2, (chtype) '@');
+ MvWAddCh(treescrn2, 11, 22, (chtype) '@');
+ MvWAddCh(treescrn2, 12, 1, (chtype) '@');
+ MvWAddCh(treescrn2, 12, 23, (chtype) '@');
+
+ unset_color(treescrn2);
+ wrefresh(treescrn2);
+ wrefresh(w_del_msg);
+ return (0);
+}
+
+static int
+star(void)
+{
+ (void) wattrset(treescrn2, A_BOLD | A_BLINK);
+ set_color(treescrn2, COLOR_YELLOW);
+
+ MvWAddCh(treescrn2, 0, 12, (chtype) '*');
+ (void) wstandend(treescrn2);
+
+ unset_color(treescrn2);
+ wrefresh(treescrn2);
+ wrefresh(w_del_msg);
+ return (0);
+}
+
+static int
+strng1(void)
+{
+ (void) wattrset(treescrn2, A_BOLD | A_BLINK);
+ set_color(treescrn2, COLOR_WHITE);
+
+ MvWAddCh(treescrn2, 3, 13, (chtype) '\'');
+ MvWAddCh(treescrn2, 3, 12, (chtype) ':');
+ MvWAddCh(treescrn2, 3, 11, (chtype) '.');
+
+ wattroff(treescrn2, A_BOLD | A_BLINK);
+ unset_color(treescrn2);
+
+ wrefresh(treescrn2);
+ wrefresh(w_del_msg);
+ return (0);
+}
+
+static int
+strng2(void)
+{
+ (void) wattrset(treescrn2, A_BOLD | A_BLINK);
+ set_color(treescrn2, COLOR_WHITE);
+
+ MvWAddCh(treescrn2, 5, 14, (chtype) '\'');
+ MvWAddCh(treescrn2, 5, 13, (chtype) ':');
+ MvWAddCh(treescrn2, 5, 12, (chtype) '.');
+ MvWAddCh(treescrn2, 5, 11, (chtype) ',');
+ MvWAddCh(treescrn2, 6, 10, (chtype) '\'');
+ MvWAddCh(treescrn2, 6, 9, (chtype) ':');
+
+ wattroff(treescrn2, A_BOLD | A_BLINK);
+ unset_color(treescrn2);
+
+ wrefresh(treescrn2);
+ wrefresh(w_del_msg);
+ return (0);
+}
+
+static int
+strng3(void)
+{
+ (void) wattrset(treescrn2, A_BOLD | A_BLINK);
+ set_color(treescrn2, COLOR_WHITE);
+
+ MvWAddCh(treescrn2, 7, 16, (chtype) '\'');
+ MvWAddCh(treescrn2, 7, 15, (chtype) ':');
+ MvWAddCh(treescrn2, 7, 14, (chtype) '.');
+ MvWAddCh(treescrn2, 7, 13, (chtype) ',');
+ MvWAddCh(treescrn2, 8, 12, (chtype) '\'');
+ MvWAddCh(treescrn2, 8, 11, (chtype) ':');
+ MvWAddCh(treescrn2, 8, 10, (chtype) '.');
+ MvWAddCh(treescrn2, 8, 9, (chtype) ',');
+
+ wattroff(treescrn2, A_BOLD | A_BLINK);
+ unset_color(treescrn2);
+
+ wrefresh(treescrn2);
+ wrefresh(w_del_msg);
+ return (0);
+}
+
+static int
+strng4(void)
+{
+ (void) wattrset(treescrn2, A_BOLD | A_BLINK);
+ set_color(treescrn2, COLOR_WHITE);
+
+ MvWAddCh(treescrn2, 9, 17, (chtype) '\'');
+ MvWAddCh(treescrn2, 9, 16, (chtype) ':');
+ MvWAddCh(treescrn2, 9, 15, (chtype) '.');
+ MvWAddCh(treescrn2, 9, 14, (chtype) ',');
+ MvWAddCh(treescrn2, 10, 13, (chtype) '\'');
+ MvWAddCh(treescrn2, 10, 12, (chtype) ':');
+ MvWAddCh(treescrn2, 10, 11, (chtype) '.');
+ MvWAddCh(treescrn2, 10, 10, (chtype) ',');
+ MvWAddCh(treescrn2, 11, 9, (chtype) '\'');
+ MvWAddCh(treescrn2, 11, 8, (chtype) ':');
+ MvWAddCh(treescrn2, 11, 7, (chtype) '.');
+ MvWAddCh(treescrn2, 11, 6, (chtype) ',');
+ MvWAddCh(treescrn2, 12, 5, (chtype) '\'');
+
+ wattroff(treescrn2, A_BOLD | A_BLINK);
+ unset_color(treescrn2);
+
+ wrefresh(treescrn2);
+ wrefresh(w_del_msg);
+ return (0);
+}
+
+static int
+strng5(void)
+{
+ (void) wattrset(treescrn2, A_BOLD | A_BLINK);
+ set_color(treescrn2, COLOR_WHITE);
+
+ MvWAddCh(treescrn2, 11, 19, (chtype) '\'');
+ MvWAddCh(treescrn2, 11, 18, (chtype) ':');
+ MvWAddCh(treescrn2, 11, 17, (chtype) '.');
+ MvWAddCh(treescrn2, 11, 16, (chtype) ',');
+ MvWAddCh(treescrn2, 12, 15, (chtype) '\'');
+ MvWAddCh(treescrn2, 12, 14, (chtype) ':');
+ MvWAddCh(treescrn2, 12, 13, (chtype) '.');
+ MvWAddCh(treescrn2, 12, 12, (chtype) ',');
+
+ wattroff(treescrn2, A_BOLD | A_BLINK);
+ unset_color(treescrn2);
+
+ /* save a fully lit tree */
+ overlay(treescrn2, treescrn);
+
+ wrefresh(treescrn2);
+ wrefresh(w_del_msg);
+ return (0);
+}
+
+static int
+blinkit(void)
+{
+ static int cycle;
+
+ if (cycle > 4) {
+ cycle = 0;
+ }
+
+ touchwin(treescrn8);
+
+ switch (cycle) {
+ case 0:
+ overlay(treescrn3, treescrn8);
+ break;
+ case 1:
+ overlay(treescrn4, treescrn8);
+ break;
+ case 2:
+ overlay(treescrn5, treescrn8);
+ break;
+ case 3:
+ overlay(treescrn6, treescrn8);
+ break;
+ case 4:
+ overlay(treescrn7, treescrn8);
+ break;
+ }
+ touchwin(treescrn8);
+ wrefresh(treescrn8);
+ wrefresh(w_del_msg);
+ look_out(50);
+
+ /*ALL ON************************************************** */
+
+ overlay(treescrn, treescrn8);
+ wrefresh(treescrn8);
+ wrefresh(w_del_msg);
+ look_out(50);
+
+ ++cycle;
+ return (0);
+}
+
+static void
+deer_step(WINDOW *win, int y, int x)
+{
+ mvwin(win, y, x);
+ wrefresh(win);
+ wrefresh(w_del_msg);
+ look_out(5);
+}
+
+static int
+reindeer(void)
+{
+ int looper;
+ y_pos = 0;
+
+ for (x_pos = 70; x_pos > 62; x_pos--) {
+ if (x_pos < 62) {
+ y_pos = 1;
+ }
+ for (looper = 0; looper < 4; looper++) {
+ MvWAddCh(dotdeer0, y_pos, x_pos, (chtype) '.');
+ wrefresh(dotdeer0);
+ wrefresh(w_del_msg);
+ werase(dotdeer0);
+ wrefresh(dotdeer0);
+ wrefresh(w_del_msg);
+ look_out(50);
+ }
+ }
+
+ y_pos = 2;
+
+ for (; x_pos > 50; x_pos--) {
+ for (looper = 0; looper < 4; looper++) {
+
+ if (x_pos < 56) {
+ y_pos = 3;
+
+ MvWAddCh(stardeer0, y_pos, x_pos, (chtype) '*');
+ wrefresh(stardeer0);
+ wrefresh(w_del_msg);
+ werase(stardeer0);
+ wrefresh(stardeer0);
+ wrefresh(w_del_msg);
+ } else {
+ MvWAddCh(dotdeer0, y_pos, x_pos, (chtype) '*');
+ wrefresh(dotdeer0);
+ wrefresh(w_del_msg);
+ werase(dotdeer0);
+ wrefresh(dotdeer0);
+ wrefresh(w_del_msg);
+ }
+ }
+ }
+
+ x_pos = 58;
+
+ for (y_pos = 2; y_pos < 5; y_pos++) {
+
+ touchwin(lildeer0);
+ wrefresh(lildeer0);
+ wrefresh(w_del_msg);
+
+ for (looper = 0; looper < 4; looper++) {
+ deer_step(lildeer3, y_pos, x_pos);
+ deer_step(lildeer2, y_pos, x_pos);
+ deer_step(lildeer1, y_pos, x_pos);
+ deer_step(lildeer2, y_pos, x_pos);
+ deer_step(lildeer3, y_pos, x_pos);
+
+ touchwin(lildeer0);
+ wrefresh(lildeer0);
+ wrefresh(w_del_msg);
+
+ x_pos -= 2;
+ }
+ }
+
+ x_pos = 35;
+
+ for (y_pos = 5; y_pos < 10; y_pos++) {
+
+ touchwin(middeer0);
+ wrefresh(middeer0);
+ wrefresh(w_del_msg);
+
+ for (looper = 0; looper < 2; looper++) {
+ deer_step(middeer3, y_pos, x_pos);
+ deer_step(middeer2, y_pos, x_pos);
+ deer_step(middeer1, y_pos, x_pos);
+ deer_step(middeer2, y_pos, x_pos);
+ deer_step(middeer3, y_pos, x_pos);
+
+ touchwin(middeer0);
+ wrefresh(middeer0);
+ wrefresh(w_del_msg);
+
+ x_pos -= 3;
+ }
+ }
+
+ look_out(300);
+
+ y_pos = 1;
+
+ for (x_pos = 8; x_pos < 16; x_pos++) {
+ deer_step(bigdeer4, y_pos, x_pos);
+ deer_step(bigdeer3, y_pos, x_pos);
+ deer_step(bigdeer2, y_pos, x_pos);
+ deer_step(bigdeer1, y_pos, x_pos);
+ deer_step(bigdeer2, y_pos, x_pos);
+ deer_step(bigdeer3, y_pos, x_pos);
+ deer_step(bigdeer4, y_pos, x_pos);
+ deer_step(bigdeer0, y_pos, x_pos);
+ }
+
+ --x_pos;
+
+ for (looper = 0; looper < 6; looper++) {
+ deer_step(lookdeer4, y_pos, x_pos);
+ deer_step(lookdeer3, y_pos, x_pos);
+ deer_step(lookdeer2, y_pos, x_pos);
+ deer_step(lookdeer1, y_pos, x_pos);
+ deer_step(lookdeer2, y_pos, x_pos);
+ deer_step(lookdeer3, y_pos, x_pos);
+ deer_step(lookdeer4, y_pos, x_pos);
+ }
+
+ deer_step(lookdeer0, y_pos, x_pos);
+
+ for (; y_pos < 10; y_pos++) {
+ for (looper = 0; looper < 2; looper++) {
+ deer_step(bigdeer4, y_pos, x_pos);
+ deer_step(bigdeer3, y_pos, x_pos);
+ deer_step(bigdeer2, y_pos, x_pos);
+ deer_step(bigdeer1, y_pos, x_pos);
+ deer_step(bigdeer2, y_pos, x_pos);
+ deer_step(bigdeer3, y_pos, x_pos);
+ deer_step(bigdeer4, y_pos, x_pos);
+ }
+ deer_step(bigdeer0, y_pos, x_pos);
+ }
+
+ --y_pos;
+
+ deer_step(lookdeer3, y_pos, x_pos);
+ return (0);
+}
+
+static void
+done(int sig GCC_UNUSED)
+{
+ move(LINES - 1, 0);
+ refresh();
+ stop_curses();
+
+#if NO_LEAKS
+ if (my_pairs != 0)
+ free(my_pairs);
+#endif
+
+ ExitProgram(EXIT_SUCCESS);
+}
+
+static void
+usage(void)
+{
+ static const char *msg[] =
+ {
+ "Usage: xmas [options]"
+ ,""
+ ,"Options:"
+#if HAVE_USE_DEFAULT_COLORS
+ ," -d invoke use_default_colors"
+#endif
+ ," -q execute once, then quit"
+ };
+ size_t n;
+
+ for (n = 0; n < SIZEOF(msg); n++)
+ fprintf(stderr, "%s\n", msg[n]);
+
+ ExitProgram(EXIT_FAILURE);
+}
+
int
-main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
+main(int argc, char *argv[])
{
+ int ch;
int loopy;
+#if HAVE_USE_DEFAULT_COLORS
+ bool opt_d = FALSE;
+#endif
+ bool opt_q = FALSE;
+
+ while ((ch = getopt(argc, argv, "dq")) != -1) {
+ switch (ch) {
+#if HAVE_USE_DEFAULT_COLORS
+ case 'd':
+ opt_d = TRUE;
+ break;
+#endif
+ case 'q':
+ opt_q = TRUE;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
setlocale(LC_ALL, "");
- initscr();
+ InitAndCatch(initscr(), done);
noecho();
nonl();
refresh();
- CATCHALL(done);
-
if (has_colors()) {
start_color();
#if HAVE_USE_DEFAULT_COLORS
- if (use_default_colors() == OK)
+ if (opt_d && (use_default_colors() == OK))
my_bg = -1;
#endif
}
@@ -244,7 +749,7 @@ main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
(w_holiday = newwin(1, 26, 3, 27)) == 0 ||
(w_del_msg = newwin(1, 19, 23, 60)) == 0) {
- endwin();
+ stop_curses();
fprintf(stderr, "Cannot create windows - screen too small\n");
ExitProgram(EXIT_FAILURE);
}
@@ -450,7 +955,7 @@ main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
/***********************************************/
cbreak();
nodelay(stdscr, TRUE);
- for (;;) {
+ do {
clear();
werase(treescrn);
touchwin(w_del_msg);
@@ -664,499 +1169,6 @@ main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
for (loopy = 0; loopy < 100; loopy++) {
blinkit();
}
-
-#ifdef NOLOOP
- done(0);
-#endif
- }
- /*NOTREACHED */
-}
-
-static int
-boxit(void)
-{
- int x = 0;
-
- while (x < 20) {
- MvAddCh(x, 7, '|');
- ++x;
- }
-
- x = 8;
-
- while (x < 80) {
- MvAddCh(19, x, '_');
- ++x;
- }
-
- x = 0;
-
- while (x < 80) {
- MvAddCh(22, x, '_');
- ++x;
- }
-
- return (0);
-}
-
-static int
-seas(void)
-{
- MvAddCh(4, 1, 'S');
- MvAddCh(6, 1, 'E');
- MvAddCh(8, 1, 'A');
- MvAddCh(10, 1, 'S');
- MvAddCh(12, 1, 'O');
- MvAddCh(14, 1, 'N');
- MvAddCh(16, 1, '`');
- MvAddCh(18, 1, 'S');
-
- return (0);
-}
-
-static int
-greet(void)
-{
- MvAddCh(3, 5, 'G');
- MvAddCh(5, 5, 'R');
- MvAddCh(7, 5, 'E');
- MvAddCh(9, 5, 'E');
- MvAddCh(11, 5, 'T');
- MvAddCh(13, 5, 'I');
- MvAddCh(15, 5, 'N');
- MvAddCh(17, 5, 'G');
- MvAddCh(19, 5, 'S');
-
- return (0);
-}
-
-static int
-fromwho(void)
-{
- MvAddStr(21, 13, FROMWHO);
- return (0);
-}
-
-static int
-tree(void)
-{
- set_color(treescrn, COLOR_GREEN);
- MvWAddCh(treescrn, 1, 11, (chtype) '/');
- MvWAddCh(treescrn, 2, 11, (chtype) '/');
- MvWAddCh(treescrn, 3, 10, (chtype) '/');
- MvWAddCh(treescrn, 4, 9, (chtype) '/');
- MvWAddCh(treescrn, 5, 9, (chtype) '/');
- MvWAddCh(treescrn, 6, 8, (chtype) '/');
- MvWAddCh(treescrn, 7, 7, (chtype) '/');
- MvWAddCh(treescrn, 8, 6, (chtype) '/');
- MvWAddCh(treescrn, 9, 6, (chtype) '/');
- MvWAddCh(treescrn, 10, 5, (chtype) '/');
- MvWAddCh(treescrn, 11, 3, (chtype) '/');
- MvWAddCh(treescrn, 12, 2, (chtype) '/');
-
- MvWAddCh(treescrn, 1, 13, (chtype) '\\');
- MvWAddCh(treescrn, 2, 13, (chtype) '\\');
- MvWAddCh(treescrn, 3, 14, (chtype) '\\');
- MvWAddCh(treescrn, 4, 15, (chtype) '\\');
- MvWAddCh(treescrn, 5, 15, (chtype) '\\');
- MvWAddCh(treescrn, 6, 16, (chtype) '\\');
- MvWAddCh(treescrn, 7, 17, (chtype) '\\');
- MvWAddCh(treescrn, 8, 18, (chtype) '\\');
- MvWAddCh(treescrn, 9, 18, (chtype) '\\');
- MvWAddCh(treescrn, 10, 19, (chtype) '\\');
- MvWAddCh(treescrn, 11, 21, (chtype) '\\');
- MvWAddCh(treescrn, 12, 22, (chtype) '\\');
-
- MvWAddCh(treescrn, 4, 10, (chtype) '_');
- MvWAddCh(treescrn, 4, 14, (chtype) '_');
- MvWAddCh(treescrn, 8, 7, (chtype) '_');
- MvWAddCh(treescrn, 8, 17, (chtype) '_');
-
- MvWAddStr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\");
-
- MvWAddStr(treescrn, 14, 11, "| |");
- MvWAddStr(treescrn, 15, 11, "|_|");
-
- unset_color(treescrn);
- wrefresh(treescrn);
- wrefresh(w_del_msg);
-
- return (0);
-}
-
-static int
-balls(void)
-{
- overlay(treescrn, treescrn2);
-
- set_color(treescrn2, COLOR_BLUE);
- MvWAddCh(treescrn2, 3, 9, (chtype) '@');
- MvWAddCh(treescrn2, 3, 15, (chtype) '@');
- MvWAddCh(treescrn2, 4, 8, (chtype) '@');
- MvWAddCh(treescrn2, 4, 16, (chtype) '@');
- MvWAddCh(treescrn2, 5, 7, (chtype) '@');
- MvWAddCh(treescrn2, 5, 17, (chtype) '@');
- MvWAddCh(treescrn2, 7, 6, (chtype) '@');
- MvWAddCh(treescrn2, 7, 18, (chtype) '@');
- MvWAddCh(treescrn2, 8, 5, (chtype) '@');
- MvWAddCh(treescrn2, 8, 19, (chtype) '@');
- MvWAddCh(treescrn2, 10, 4, (chtype) '@');
- MvWAddCh(treescrn2, 10, 20, (chtype) '@');
- MvWAddCh(treescrn2, 11, 2, (chtype) '@');
- MvWAddCh(treescrn2, 11, 22, (chtype) '@');
- MvWAddCh(treescrn2, 12, 1, (chtype) '@');
- MvWAddCh(treescrn2, 12, 23, (chtype) '@');
-
- unset_color(treescrn2);
- wrefresh(treescrn2);
- wrefresh(w_del_msg);
- return (0);
-}
-
-static int
-star(void)
-{
- (void) wattrset(treescrn2, A_BOLD | A_BLINK);
- set_color(treescrn2, COLOR_YELLOW);
-
- MvWAddCh(treescrn2, 0, 12, (chtype) '*');
- (void) wstandend(treescrn2);
-
- unset_color(treescrn2);
- wrefresh(treescrn2);
- wrefresh(w_del_msg);
- return (0);
-}
-
-static int
-strng1(void)
-{
- (void) wattrset(treescrn2, A_BOLD | A_BLINK);
- set_color(treescrn2, COLOR_WHITE);
-
- MvWAddCh(treescrn2, 3, 13, (chtype) '\'');
- MvWAddCh(treescrn2, 3, 12, (chtype) ':');
- MvWAddCh(treescrn2, 3, 11, (chtype) '.');
-
- wattroff(treescrn2, A_BOLD | A_BLINK);
- unset_color(treescrn2);
-
- wrefresh(treescrn2);
- wrefresh(w_del_msg);
- return (0);
-}
-
-static int
-strng2(void)
-{
- (void) wattrset(treescrn2, A_BOLD | A_BLINK);
- set_color(treescrn2, COLOR_WHITE);
-
- MvWAddCh(treescrn2, 5, 14, (chtype) '\'');
- MvWAddCh(treescrn2, 5, 13, (chtype) ':');
- MvWAddCh(treescrn2, 5, 12, (chtype) '.');
- MvWAddCh(treescrn2, 5, 11, (chtype) ',');
- MvWAddCh(treescrn2, 6, 10, (chtype) '\'');
- MvWAddCh(treescrn2, 6, 9, (chtype) ':');
-
- wattroff(treescrn2, A_BOLD | A_BLINK);
- unset_color(treescrn2);
-
- wrefresh(treescrn2);
- wrefresh(w_del_msg);
- return (0);
-}
-
-static int
-strng3(void)
-{
- (void) wattrset(treescrn2, A_BOLD | A_BLINK);
- set_color(treescrn2, COLOR_WHITE);
-
- MvWAddCh(treescrn2, 7, 16, (chtype) '\'');
- MvWAddCh(treescrn2, 7, 15, (chtype) ':');
- MvWAddCh(treescrn2, 7, 14, (chtype) '.');
- MvWAddCh(treescrn2, 7, 13, (chtype) ',');
- MvWAddCh(treescrn2, 8, 12, (chtype) '\'');
- MvWAddCh(treescrn2, 8, 11, (chtype) ':');
- MvWAddCh(treescrn2, 8, 10, (chtype) '.');
- MvWAddCh(treescrn2, 8, 9, (chtype) ',');
-
- wattroff(treescrn2, A_BOLD | A_BLINK);
- unset_color(treescrn2);
-
- wrefresh(treescrn2);
- wrefresh(w_del_msg);
- return (0);
-}
-
-static int
-strng4(void)
-{
- (void) wattrset(treescrn2, A_BOLD | A_BLINK);
- set_color(treescrn2, COLOR_WHITE);
-
- MvWAddCh(treescrn2, 9, 17, (chtype) '\'');
- MvWAddCh(treescrn2, 9, 16, (chtype) ':');
- MvWAddCh(treescrn2, 9, 15, (chtype) '.');
- MvWAddCh(treescrn2, 9, 14, (chtype) ',');
- MvWAddCh(treescrn2, 10, 13, (chtype) '\'');
- MvWAddCh(treescrn2, 10, 12, (chtype) ':');
- MvWAddCh(treescrn2, 10, 11, (chtype) '.');
- MvWAddCh(treescrn2, 10, 10, (chtype) ',');
- MvWAddCh(treescrn2, 11, 9, (chtype) '\'');
- MvWAddCh(treescrn2, 11, 8, (chtype) ':');
- MvWAddCh(treescrn2, 11, 7, (chtype) '.');
- MvWAddCh(treescrn2, 11, 6, (chtype) ',');
- MvWAddCh(treescrn2, 12, 5, (chtype) '\'');
-
- wattroff(treescrn2, A_BOLD | A_BLINK);
- unset_color(treescrn2);
-
- wrefresh(treescrn2);
- wrefresh(w_del_msg);
- return (0);
-}
-
-static int
-strng5(void)
-{
- (void) wattrset(treescrn2, A_BOLD | A_BLINK);
- set_color(treescrn2, COLOR_WHITE);
-
- MvWAddCh(treescrn2, 11, 19, (chtype) '\'');
- MvWAddCh(treescrn2, 11, 18, (chtype) ':');
- MvWAddCh(treescrn2, 11, 17, (chtype) '.');
- MvWAddCh(treescrn2, 11, 16, (chtype) ',');
- MvWAddCh(treescrn2, 12, 15, (chtype) '\'');
- MvWAddCh(treescrn2, 12, 14, (chtype) ':');
- MvWAddCh(treescrn2, 12, 13, (chtype) '.');
- MvWAddCh(treescrn2, 12, 12, (chtype) ',');
-
- wattroff(treescrn2, A_BOLD | A_BLINK);
- unset_color(treescrn2);
-
- /* save a fully lit tree */
- overlay(treescrn2, treescrn);
-
- wrefresh(treescrn2);
- wrefresh(w_del_msg);
- return (0);
-}
-
-static int
-blinkit(void)
-{
- static int cycle;
-
- if (cycle > 4) {
- cycle = 0;
- }
-
- touchwin(treescrn8);
-
- switch (cycle) {
- case 0:
- overlay(treescrn3, treescrn8);
- wrefresh(treescrn8);
- wrefresh(w_del_msg);
- break;
- case 1:
- overlay(treescrn4, treescrn8);
- wrefresh(treescrn8);
- wrefresh(w_del_msg);
- break;
- case 2:
- overlay(treescrn5, treescrn8);
- wrefresh(treescrn8);
- wrefresh(w_del_msg);
- break;
- case 3:
- overlay(treescrn6, treescrn8);
- wrefresh(treescrn8);
- wrefresh(w_del_msg);
- break;
- case 4:
- overlay(treescrn7, treescrn8);
- wrefresh(treescrn8);
- wrefresh(w_del_msg);
- break;
- }
- touchwin(treescrn8);
-
- /*ALL ON************************************************** */
-
- overlay(treescrn, treescrn8);
- wrefresh(treescrn8);
- wrefresh(w_del_msg);
-
- ++cycle;
- return (0);
-}
-
-static void
-deer_step(WINDOW *win, int y, int x)
-{
- mvwin(win, y, x);
- wrefresh(win);
- wrefresh(w_del_msg);
- look_out(5);
-}
-
-static int
-reindeer(void)
-{
- int looper;
- y_pos = 0;
-
- for (x_pos = 70; x_pos > 62; x_pos--) {
- if (x_pos < 62) {
- y_pos = 1;
- }
- for (looper = 0; looper < 4; looper++) {
- MvWAddCh(dotdeer0, y_pos, x_pos, (chtype) '.');
- wrefresh(dotdeer0);
- wrefresh(w_del_msg);
- werase(dotdeer0);
- wrefresh(dotdeer0);
- wrefresh(w_del_msg);
- look_out(50);
- }
- }
-
- y_pos = 2;
-
- for (; x_pos > 50; x_pos--) {
- for (looper = 0; looper < 4; looper++) {
-
- if (x_pos < 56) {
- y_pos = 3;
-
- MvWAddCh(stardeer0, y_pos, x_pos, (chtype) '*');
- wrefresh(stardeer0);
- wrefresh(w_del_msg);
- werase(stardeer0);
- wrefresh(stardeer0);
- wrefresh(w_del_msg);
- } else {
- MvWAddCh(dotdeer0, y_pos, x_pos, (chtype) '*');
- wrefresh(dotdeer0);
- wrefresh(w_del_msg);
- werase(dotdeer0);
- wrefresh(dotdeer0);
- wrefresh(w_del_msg);
- }
- }
- }
-
- x_pos = 58;
-
- for (y_pos = 2; y_pos < 5; y_pos++) {
-
- touchwin(lildeer0);
- wrefresh(lildeer0);
- wrefresh(w_del_msg);
-
- for (looper = 0; looper < 4; looper++) {
- deer_step(lildeer3, y_pos, x_pos);
- deer_step(lildeer2, y_pos, x_pos);
- deer_step(lildeer1, y_pos, x_pos);
- deer_step(lildeer2, y_pos, x_pos);
- deer_step(lildeer3, y_pos, x_pos);
-
- touchwin(lildeer0);
- wrefresh(lildeer0);
- wrefresh(w_del_msg);
-
- x_pos -= 2;
- }
- }
-
- x_pos = 35;
-
- for (y_pos = 5; y_pos < 10; y_pos++) {
-
- touchwin(middeer0);
- wrefresh(middeer0);
- wrefresh(w_del_msg);
-
- for (looper = 0; looper < 2; looper++) {
- deer_step(middeer3, y_pos, x_pos);
- deer_step(middeer2, y_pos, x_pos);
- deer_step(middeer1, y_pos, x_pos);
- deer_step(middeer2, y_pos, x_pos);
- deer_step(middeer3, y_pos, x_pos);
-
- touchwin(middeer0);
- wrefresh(middeer0);
- wrefresh(w_del_msg);
-
- x_pos -= 3;
- }
- }
-
- look_out(300);
-
- y_pos = 1;
-
- for (x_pos = 8; x_pos < 16; x_pos++) {
- deer_step(bigdeer4, y_pos, x_pos);
- deer_step(bigdeer3, y_pos, x_pos);
- deer_step(bigdeer2, y_pos, x_pos);
- deer_step(bigdeer1, y_pos, x_pos);
- deer_step(bigdeer2, y_pos, x_pos);
- deer_step(bigdeer3, y_pos, x_pos);
- deer_step(bigdeer4, y_pos, x_pos);
- deer_step(bigdeer0, y_pos, x_pos);
- }
-
- --x_pos;
-
- for (looper = 0; looper < 6; looper++) {
- deer_step(lookdeer4, y_pos, x_pos);
- deer_step(lookdeer3, y_pos, x_pos);
- deer_step(lookdeer2, y_pos, x_pos);
- deer_step(lookdeer1, y_pos, x_pos);
- deer_step(lookdeer2, y_pos, x_pos);
- deer_step(lookdeer3, y_pos, x_pos);
- deer_step(lookdeer4, y_pos, x_pos);
- }
-
- deer_step(lookdeer0, y_pos, x_pos);
-
- for (; y_pos < 10; y_pos++) {
- for (looper = 0; looper < 2; looper++) {
- deer_step(bigdeer4, y_pos, x_pos);
- deer_step(bigdeer3, y_pos, x_pos);
- deer_step(bigdeer2, y_pos, x_pos);
- deer_step(bigdeer1, y_pos, x_pos);
- deer_step(bigdeer2, y_pos, x_pos);
- deer_step(bigdeer3, y_pos, x_pos);
- deer_step(bigdeer4, y_pos, x_pos);
- }
- deer_step(bigdeer0, y_pos, x_pos);
- }
-
- --y_pos;
-
- deer_step(lookdeer3, y_pos, x_pos);
- return (0);
-}
-
-static void
-done(int sig GCC_UNUSED)
-{
- CATCHALL(done);
-
- move(LINES - 1, 0);
- refresh();
- endwin();
- curs_set(1);
-
-#if NO_LEAKS
- if (my_pairs != 0)
- free(my_pairs);
-#endif
-
- ExitProgram(EXIT_SUCCESS);
+ } while (!opt_q);
+ done(0);
}