1/******************************************************************************/
2/* asciixmas                                                                  */
3/* December 1989             Larry Bartz           Indianapolis, IN           */
4/*                                                                            */
5/*                                                                            */
6/* I'm dreaming of an ascii character-based monochrome Christmas,             */
7/* Just like the one's I used to know!                                        */
8/* Via a full duplex communications channel,                                  */
9/* At 9600 bits per second,                                                   */
10/* Even though it's kinda slow.                                               */
11/*                                                                            */
12/* I'm dreaming of an ascii character-based monochrome Christmas,             */
13/* With ev'ry C program I write!                                              */
14/* May your screen be merry and bright!                                       */
15/* And may all your Christmases be amber or green,                            */
16/* (for reduced eyestrain and improved visibility)!                           */
17/*                                                                            */
18/*                                                                            */
19/*                                                                            */
20/*                                                                            */
21/*                                                                            */
22/* IMPLEMENTATION                                                             */
23/*                                                                            */
24/* Feel free to modify the defined string FROMWHO to reflect you, your        */
25/* organization, your site, whatever.                                         */
26/*                                                                            */
27/* This really looks a lot better if you can turn off your cursor before      */
28/* execution. I wanted to do that here but very few termcap entries or        */
29/* terminfo definitions have the appropriate string defined. If you know      */
30/* the string(s) for the terminal(s) you use or which your site supports,     */
31/* you could call asciixmas from within a shell in which you issue the        */
32/* string to the terminal. The cursor is distracting but it doesn't really    */
33/* ruin the show.                                                             */
34/*                                                                            */
35/* At our site, we invoke this for our users just after login and the         */
36/* determination of terminal type.                                            */
37/*                                                                            */
38/*                                                                            */
39/* PORTABILITY                                                                */
40/*                                                                            */
41/* I wrote this using only the very simplest curses functions so that it      */
42/* might be the most portable. I was personally able to test on five          */
43/* different cpu/UNIX combinations.                                           */
44/*                                                                            */
45/*                                                                            */
46/* COMPILE                                                                    */
47/*                                                                            */
48/* usually this:                                                              */
49/*                                                                            */
50/* cc -O asciixmas.c -lcurses -o asciixmas -s                                 */
51/*                                                                            */
52/*                                                                            */
53/* Zilog S8000 models 11, 21, 31, etc with ZEUS variant of SYSTEM III         */
54/* maybe other SYSTEM III also:                                               */
55/*                                                                            */
56/* cc asciixmas.c -lcurses -ltermlib -o asciixmas -s                          */
57/*                                                                            */
58/* as above with optional "peephole optimizer" installed:                     */
59/*                                                                            */
60/* cc -O asciixmas.c -lcurses -ltermlib -o asciixmas -s                       */
61/*                                                                            */
62/*                                                                            */
63/* Zilog S8000 models 32, 130 with WE32100 chip and SYS V, REL2               */
64/* maybe 3B2 also?                                                            */
65/*                                                                            */
66/* cc -f -O -K sd asciixmas.c -lcurses -o asciixmas -s                        */
67/*                                                                            */
68/*                                                                            */
69/* Pyramid, Sequent, any other "dual universe" types compile and execute      */
70/* under either universe. The compile line for the ucb universe (as you       */
71/* might expect) is the same as for SYS III UNIX:                             */
72/*                                                                            */
73/* cc -O asciixmas.c -lcurses -ltermlib -o asciixmas -s                       */
74/*                                                                            */
75/* The above compile will also hold true for other BSD systems. (I hope)      */
76/*                                                                            */
77/*                                                                            */
78/*                                                                            */
79/*                                                                            */
80/* For the Scrooges out there among you who don't want this thing to loop     */
81/* forever (or until the user hits a key), insert this into your compile      */
82/* line just after "cc" :                                                     */
83/*                                                                            */
84/* -DNOLOOP                                                                   */
85/*                                                                            */
86/* like so:                                                                   */
87/*                                                                            */
88/* cc -DNOLOOP -O asciixmas.c -lcurses -o asciixmas -s                        */
89/*                                                                            */
90/*                                                                            */
91/*                                                                            */
92/******************************************************************************/
93
94/*
95 * $Id: xmas.c,v 1.24 2008/08/03 11:08:59 tom Exp $
96 */
97#include <test.priv.h>
98
99#define FROMWHO "Mark Hessling - (M.Hessling@gu.edu.au)"
100
101static int my_bg = COLOR_BLACK;
102static int y_pos, x_pos;
103
104static WINDOW *treescrn;
105static WINDOW *treescrn2;
106static WINDOW *treescrn3;
107static WINDOW *treescrn4;
108static WINDOW *treescrn5;
109static WINDOW *treescrn6;
110static WINDOW *treescrn7;
111static WINDOW *treescrn8;
112static WINDOW *dotdeer0;
113static WINDOW *stardeer0;
114static WINDOW *lildeer0;
115static WINDOW *lildeer1;
116static WINDOW *lildeer2;
117static WINDOW *lildeer3;
118static WINDOW *middeer0;
119static WINDOW *middeer1;
120static WINDOW *middeer2;
121static WINDOW *middeer3;
122static WINDOW *bigdeer0;
123static WINDOW *bigdeer1;
124static WINDOW *bigdeer2;
125static WINDOW *bigdeer3;
126static WINDOW *bigdeer4;
127static WINDOW *lookdeer0;
128static WINDOW *lookdeer1;
129static WINDOW *lookdeer2;
130static WINDOW *lookdeer3;
131static WINDOW *lookdeer4;
132static WINDOW *w_holiday;
133static WINDOW *w_del_msg;
134static bool *my_pairs;
135
136static int boxit(void);
137static int seas(void);
138static int greet(void);
139static int fromwho(void);
140static int tree(void);
141static int balls(void);
142static int star(void);
143static int strng1(void);
144static int strng2(void);
145static int strng3(void);
146static int strng4(void);
147static int strng5(void);
148static int reindeer(void);
149static int blinkit(void);
150
151static RETSIGTYPE done(int sig) GCC_NORETURN;
152
153static void
154set_color(WINDOW *win, chtype color)
155{
156    if (has_colors()) {
157	int n = (color + 1);
158	if (my_pairs == 0)
159	    my_pairs = typeCalloc(bool, COLORS + 1);
160	if (!my_pairs[n]) {
161	    init_pair(n, color, my_bg);
162	    my_pairs[n] = TRUE;
163	}
164	wattroff(win, A_COLOR);
165	wattron(win, COLOR_PAIR(n));
166    }
167}
168
169static void
170unset_color(WINDOW *win)
171{
172    if (has_colors())
173	wattrset(win, COLOR_PAIR(0));
174}
175
176static void
177look_out(int msecs)
178{
179    napms(msecs);
180    if (getch() != ERR) {
181	beep();
182	done(0);
183    }
184}
185
186int
187main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
188{
189    int loopy;
190
191    setlocale(LC_ALL, "");
192
193    initscr();
194    noecho();
195    nonl();
196    refresh();
197
198    CATCHALL(done);
199
200    if (has_colors()) {
201	start_color();
202#if HAVE_USE_DEFAULT_COLORS
203	if (use_default_colors() == OK)
204	    my_bg = -1;
205#endif
206    }
207    curs_set(0);
208
209    if ((treescrn = newwin(16, 27, 3, 53)) == 0 ||
210	(treescrn2 = newwin(16, 27, 3, 53)) == 0 ||
211	(treescrn3 = newwin(16, 27, 3, 53)) == 0 ||
212	(treescrn4 = newwin(16, 27, 3, 53)) == 0 ||
213	(treescrn5 = newwin(16, 27, 3, 53)) == 0 ||
214	(treescrn6 = newwin(16, 27, 3, 53)) == 0 ||
215	(treescrn7 = newwin(16, 27, 3, 53)) == 0 ||
216	(treescrn8 = newwin(16, 27, 3, 53)) == 0 ||
217
218	(dotdeer0 = newwin(3, 71, 0, 8)) == 0 ||
219
220	(stardeer0 = newwin(4, 56, 0, 8)) == 0 ||
221
222	(lildeer0 = newwin(7, 53, 0, 8)) == 0 ||
223	(lildeer1 = newwin(2, 4, 0, 0)) == 0 ||
224	(lildeer2 = newwin(2, 4, 0, 0)) == 0 ||
225	(lildeer3 = newwin(2, 4, 0, 0)) == 0 ||
226
227	(middeer0 = newwin(15, 42, 0, 8)) == 0 ||
228	(middeer1 = newwin(3, 7, 0, 0)) == 0 ||
229	(middeer2 = newwin(3, 7, 0, 0)) == 0 ||
230	(middeer3 = newwin(3, 7, 0, 0)) == 0 ||
231
232	(bigdeer0 = newwin(10, 23, 0, 0)) == 0 ||
233	(bigdeer1 = newwin(10, 23, 0, 0)) == 0 ||
234	(bigdeer2 = newwin(10, 23, 0, 0)) == 0 ||
235	(bigdeer3 = newwin(10, 23, 0, 0)) == 0 ||
236	(bigdeer4 = newwin(10, 23, 0, 0)) == 0 ||
237
238	(lookdeer0 = newwin(10, 25, 0, 0)) == 0 ||
239	(lookdeer1 = newwin(10, 25, 0, 0)) == 0 ||
240	(lookdeer2 = newwin(10, 25, 0, 0)) == 0 ||
241	(lookdeer3 = newwin(10, 25, 0, 0)) == 0 ||
242	(lookdeer4 = newwin(10, 25, 0, 0)) == 0 ||
243
244	(w_holiday = newwin(1, 26, 3, 27)) == 0 ||
245
246	(w_del_msg = newwin(1, 19, 23, 60)) == 0) {
247	endwin();
248	fprintf(stderr, "Cannot create windows - screen too small\n");
249	ExitProgram(EXIT_FAILURE);
250    }
251
252    mvwaddstr(w_del_msg, 0, 0, "Hit any key to quit");
253
254    mvwaddstr(w_holiday, 0, 0, "H A P P Y  H O L I D A Y S");
255
256    /* set up the windows for our various reindeer */
257
258    /* lildeer1 */
259    mvwaddch(lildeer1, 0, 0, (chtype) 'V');
260    mvwaddch(lildeer1, 1, 0, (chtype) '@');
261    mvwaddch(lildeer1, 1, 1, (chtype) '<');
262    mvwaddch(lildeer1, 1, 2, (chtype) '>');
263    mvwaddch(lildeer1, 1, 3, (chtype) '~');
264
265    /* lildeer2 */
266    mvwaddch(lildeer2, 0, 0, (chtype) 'V');
267    mvwaddch(lildeer2, 1, 0, (chtype) '@');
268    mvwaddch(lildeer2, 1, 1, (chtype) '|');
269    mvwaddch(lildeer2, 1, 2, (chtype) '|');
270    mvwaddch(lildeer2, 1, 3, (chtype) '~');
271
272    /* lildeer3 */
273    mvwaddch(lildeer3, 0, 0, (chtype) 'V');
274    mvwaddch(lildeer3, 1, 0, (chtype) '@');
275    mvwaddch(lildeer3, 1, 1, (chtype) '>');
276    mvwaddch(lildeer3, 1, 2, (chtype) '<');
277    mvwaddch(lildeer2, 1, 3, (chtype) '~');
278
279    /* middeer1 */
280    mvwaddch(middeer1, 0, 2, (chtype) 'y');
281    mvwaddch(middeer1, 0, 3, (chtype) 'y');
282    mvwaddch(middeer1, 1, 2, (chtype) '0');
283    mvwaddch(middeer1, 1, 3, (chtype) '(');
284    mvwaddch(middeer1, 1, 4, (chtype) '=');
285    mvwaddch(middeer1, 1, 5, (chtype) ')');
286    mvwaddch(middeer1, 1, 6, (chtype) '~');
287    mvwaddch(middeer1, 2, 3, (chtype) '\\');
288    mvwaddch(middeer1, 2, 4, (chtype) '/');
289
290    /* middeer2 */
291    mvwaddch(middeer2, 0, 2, (chtype) 'y');
292    mvwaddch(middeer2, 0, 3, (chtype) 'y');
293    mvwaddch(middeer2, 1, 2, (chtype) '0');
294    mvwaddch(middeer2, 1, 3, (chtype) '(');
295    mvwaddch(middeer2, 1, 4, (chtype) '=');
296    mvwaddch(middeer2, 1, 5, (chtype) ')');
297    mvwaddch(middeer2, 1, 6, (chtype) '~');
298    mvwaddch(middeer2, 2, 3, (chtype) '|');
299    mvwaddch(middeer2, 2, 5, (chtype) '|');
300
301    /* middeer3 */
302    mvwaddch(middeer3, 0, 2, (chtype) 'y');
303    mvwaddch(middeer3, 0, 3, (chtype) 'y');
304    mvwaddch(middeer3, 1, 2, (chtype) '0');
305    mvwaddch(middeer3, 1, 3, (chtype) '(');
306    mvwaddch(middeer3, 1, 4, (chtype) '=');
307    mvwaddch(middeer3, 1, 5, (chtype) ')');
308    mvwaddch(middeer3, 1, 6, (chtype) '~');
309    mvwaddch(middeer3, 2, 2, (chtype) '/');
310    mvwaddch(middeer3, 2, 6, (chtype) '\\');
311
312    /* bigdeer1 */
313    mvwaddch(bigdeer1, 0, 17, (chtype) '\\');
314    mvwaddch(bigdeer1, 0, 18, (chtype) '/');
315    mvwaddch(bigdeer1, 0, 20, (chtype) '\\');
316    mvwaddch(bigdeer1, 0, 21, (chtype) '/');
317    mvwaddch(bigdeer1, 1, 18, (chtype) '\\');
318    mvwaddch(bigdeer1, 1, 20, (chtype) '/');
319    mvwaddch(bigdeer1, 2, 19, (chtype) '|');
320    mvwaddch(bigdeer1, 2, 20, (chtype) '_');
321    mvwaddch(bigdeer1, 3, 18, (chtype) '/');
322    mvwaddch(bigdeer1, 3, 19, (chtype) '^');
323    mvwaddch(bigdeer1, 3, 20, (chtype) '0');
324    mvwaddch(bigdeer1, 3, 21, (chtype) '\\');
325    mvwaddch(bigdeer1, 4, 17, (chtype) '/');
326    mvwaddch(bigdeer1, 4, 18, (chtype) '/');
327    mvwaddch(bigdeer1, 4, 19, (chtype) '\\');
328    mvwaddch(bigdeer1, 4, 22, (chtype) '\\');
329    mvwaddstr(bigdeer1, 5, 7, "^~~~~~~~~//  ~~U");
330    mvwaddstr(bigdeer1, 6, 7, "( \\_____( /");
331    mvwaddstr(bigdeer1, 7, 8, "( )    /");
332    mvwaddstr(bigdeer1, 8, 9, "\\\\   /");
333    mvwaddstr(bigdeer1, 9, 11, "\\>/>");
334
335    /* bigdeer2 */
336    mvwaddch(bigdeer2, 0, 17, (chtype) '\\');
337    mvwaddch(bigdeer2, 0, 18, (chtype) '/');
338    mvwaddch(bigdeer2, 0, 20, (chtype) '\\');
339    mvwaddch(bigdeer2, 0, 21, (chtype) '/');
340    mvwaddch(bigdeer2, 1, 18, (chtype) '\\');
341    mvwaddch(bigdeer2, 1, 20, (chtype) '/');
342    mvwaddch(bigdeer2, 2, 19, (chtype) '|');
343    mvwaddch(bigdeer2, 2, 20, (chtype) '_');
344    mvwaddch(bigdeer2, 3, 18, (chtype) '/');
345    mvwaddch(bigdeer2, 3, 19, (chtype) '^');
346    mvwaddch(bigdeer2, 3, 20, (chtype) '0');
347    mvwaddch(bigdeer2, 3, 21, (chtype) '\\');
348    mvwaddch(bigdeer2, 4, 17, (chtype) '/');
349    mvwaddch(bigdeer2, 4, 18, (chtype) '/');
350    mvwaddch(bigdeer2, 4, 19, (chtype) '\\');
351    mvwaddch(bigdeer2, 4, 22, (chtype) '\\');
352    mvwaddstr(bigdeer2, 5, 7, "^~~~~~~~~//  ~~U");
353    mvwaddstr(bigdeer2, 6, 7, "(( )____( /");
354    mvwaddstr(bigdeer2, 7, 7, "( /      |");
355    mvwaddstr(bigdeer2, 8, 8, "\\/      |");
356    mvwaddstr(bigdeer2, 9, 9, "|>     |>");
357
358    /* bigdeer3 */
359    mvwaddch(bigdeer3, 0, 17, (chtype) '\\');
360    mvwaddch(bigdeer3, 0, 18, (chtype) '/');
361    mvwaddch(bigdeer3, 0, 20, (chtype) '\\');
362    mvwaddch(bigdeer3, 0, 21, (chtype) '/');
363    mvwaddch(bigdeer3, 1, 18, (chtype) '\\');
364    mvwaddch(bigdeer3, 1, 20, (chtype) '/');
365    mvwaddch(bigdeer3, 2, 19, (chtype) '|');
366    mvwaddch(bigdeer3, 2, 20, (chtype) '_');
367    mvwaddch(bigdeer3, 3, 18, (chtype) '/');
368    mvwaddch(bigdeer3, 3, 19, (chtype) '^');
369    mvwaddch(bigdeer3, 3, 20, (chtype) '0');
370    mvwaddch(bigdeer3, 3, 21, (chtype) '\\');
371    mvwaddch(bigdeer3, 4, 17, (chtype) '/');
372    mvwaddch(bigdeer3, 4, 18, (chtype) '/');
373    mvwaddch(bigdeer3, 4, 19, (chtype) '\\');
374    mvwaddch(bigdeer3, 4, 22, (chtype) '\\');
375    mvwaddstr(bigdeer3, 5, 7, "^~~~~~~~~//  ~~U");
376    mvwaddstr(bigdeer3, 6, 6, "( ()_____( /");
377    mvwaddstr(bigdeer3, 7, 6, "/ /       /");
378    mvwaddstr(bigdeer3, 8, 5, "|/          \\");
379    mvwaddstr(bigdeer3, 9, 5, "/>           \\>");
380
381    /* bigdeer4 */
382    mvwaddch(bigdeer4, 0, 17, (chtype) '\\');
383    mvwaddch(bigdeer4, 0, 18, (chtype) '/');
384    mvwaddch(bigdeer4, 0, 20, (chtype) '\\');
385    mvwaddch(bigdeer4, 0, 21, (chtype) '/');
386    mvwaddch(bigdeer4, 1, 18, (chtype) '\\');
387    mvwaddch(bigdeer4, 1, 20, (chtype) '/');
388    mvwaddch(bigdeer4, 2, 19, (chtype) '|');
389    mvwaddch(bigdeer4, 2, 20, (chtype) '_');
390    mvwaddch(bigdeer4, 3, 18, (chtype) '/');
391    mvwaddch(bigdeer4, 3, 19, (chtype) '^');
392    mvwaddch(bigdeer4, 3, 20, (chtype) '0');
393    mvwaddch(bigdeer4, 3, 21, (chtype) '\\');
394    mvwaddch(bigdeer4, 4, 17, (chtype) '/');
395    mvwaddch(bigdeer4, 4, 18, (chtype) '/');
396    mvwaddch(bigdeer4, 4, 19, (chtype) '\\');
397    mvwaddch(bigdeer4, 4, 22, (chtype) '\\');
398    mvwaddstr(bigdeer4, 5, 7, "^~~~~~~~~//  ~~U");
399    mvwaddstr(bigdeer4, 6, 6, "( )______( /");
400    mvwaddstr(bigdeer4, 7, 5, "(/          \\");
401    mvwaddstr(bigdeer4, 8, 0, "v___=             ----^");
402
403    /* lookdeer1 */
404    mvwaddstr(lookdeer1, 0, 16, "\\/     \\/");
405    mvwaddstr(lookdeer1, 1, 17, "\\Y/ \\Y/");
406    mvwaddstr(lookdeer1, 2, 19, "\\=/");
407    mvwaddstr(lookdeer1, 3, 17, "^\\o o/^");
408    mvwaddstr(lookdeer1, 4, 17, "//( )");
409    mvwaddstr(lookdeer1, 5, 7, "^~~~~~~~~// \\O/");
410    mvwaddstr(lookdeer1, 6, 7, "( \\_____( /");
411    mvwaddstr(lookdeer1, 7, 8, "( )    /");
412    mvwaddstr(lookdeer1, 8, 9, "\\\\   /");
413    mvwaddstr(lookdeer1, 9, 11, "\\>/>");
414
415    /* lookdeer2 */
416    mvwaddstr(lookdeer2, 0, 16, "\\/     \\/");
417    mvwaddstr(lookdeer2, 1, 17, "\\Y/ \\Y/");
418    mvwaddstr(lookdeer2, 2, 19, "\\=/");
419    mvwaddstr(lookdeer2, 3, 17, "^\\o o/^");
420    mvwaddstr(lookdeer2, 4, 17, "//( )");
421    mvwaddstr(lookdeer2, 5, 7, "^~~~~~~~~// \\O/");
422    mvwaddstr(lookdeer2, 6, 7, "(( )____( /");
423    mvwaddstr(lookdeer2, 7, 7, "( /      |");
424    mvwaddstr(lookdeer2, 8, 8, "\\/      |");
425    mvwaddstr(lookdeer2, 9, 9, "|>     |>");
426
427    /* lookdeer3 */
428    mvwaddstr(lookdeer3, 0, 16, "\\/     \\/");
429    mvwaddstr(lookdeer3, 1, 17, "\\Y/ \\Y/");
430    mvwaddstr(lookdeer3, 2, 19, "\\=/");
431    mvwaddstr(lookdeer3, 3, 17, "^\\o o/^");
432    mvwaddstr(lookdeer3, 4, 17, "//( )");
433    mvwaddstr(lookdeer3, 5, 7, "^~~~~~~~~// \\O/");
434    mvwaddstr(lookdeer3, 6, 6, "( ()_____( /");
435    mvwaddstr(lookdeer3, 7, 6, "/ /       /");
436    mvwaddstr(lookdeer3, 8, 5, "|/          \\");
437    mvwaddstr(lookdeer3, 9, 5, "/>           \\>");
438
439    /* lookdeer4 */
440    mvwaddstr(lookdeer4, 0, 16, "\\/     \\/");
441    mvwaddstr(lookdeer4, 1, 17, "\\Y/ \\Y/");
442    mvwaddstr(lookdeer4, 2, 19, "\\=/");
443    mvwaddstr(lookdeer4, 3, 17, "^\\o o/^");
444    mvwaddstr(lookdeer4, 4, 17, "//( )");
445    mvwaddstr(lookdeer4, 5, 7, "^~~~~~~~~// \\O/");
446    mvwaddstr(lookdeer4, 6, 6, "( )______( /");
447    mvwaddstr(lookdeer4, 7, 5, "(/          \\");
448    mvwaddstr(lookdeer4, 8, 0, "v___=             ----^");
449
450	/***********************************************/
451    cbreak();
452    nodelay(stdscr, TRUE);
453    for (;;) {
454	clear();
455	werase(treescrn);
456	touchwin(w_del_msg);
457	touchwin(treescrn);
458	werase(treescrn2);
459	touchwin(treescrn2);
460	werase(treescrn8);
461	touchwin(treescrn8);
462	refresh();
463	look_out(150);
464	boxit();
465	refresh();
466	look_out(150);
467	seas();
468	refresh();
469	look_out(150);
470	greet();
471	refresh();
472	look_out(150);
473	fromwho();
474	refresh();
475	look_out(150);
476	tree();
477	look_out(150);
478	balls();
479	look_out(150);
480	star();
481	look_out(150);
482	strng1();
483	strng2();
484	strng3();
485	strng4();
486	strng5();
487
488	/* set up the windows for our blinking trees */
489	/* **************************************** */
490	/* treescrn3 */
491
492	overlay(treescrn, treescrn3);
493
494	/*balls */
495	mvwaddch(treescrn3, 4, 18, ' ');
496	mvwaddch(treescrn3, 7, 6, ' ');
497	mvwaddch(treescrn3, 8, 19, ' ');
498	mvwaddch(treescrn3, 11, 22, ' ');
499
500	/*star */
501	mvwaddch(treescrn3, 0, 12, '*');
502
503	/*strng1 */
504	mvwaddch(treescrn3, 3, 11, ' ');
505
506	/*strng2 */
507	mvwaddch(treescrn3, 5, 13, ' ');
508	mvwaddch(treescrn3, 6, 10, ' ');
509
510	/*strng3 */
511	mvwaddch(treescrn3, 7, 16, ' ');
512	mvwaddch(treescrn3, 7, 14, ' ');
513
514	/*strng4 */
515	mvwaddch(treescrn3, 10, 13, ' ');
516	mvwaddch(treescrn3, 10, 10, ' ');
517	mvwaddch(treescrn3, 11, 8, ' ');
518
519	/*strng5 */
520	mvwaddch(treescrn3, 11, 18, ' ');
521	mvwaddch(treescrn3, 12, 13, ' ');
522
523	/* treescrn4 */
524
525	overlay(treescrn, treescrn4);
526
527	/*balls */
528	mvwaddch(treescrn4, 3, 9, ' ');
529	mvwaddch(treescrn4, 4, 16, ' ');
530	mvwaddch(treescrn4, 7, 6, ' ');
531	mvwaddch(treescrn4, 8, 19, ' ');
532	mvwaddch(treescrn4, 11, 2, ' ');
533	mvwaddch(treescrn4, 12, 23, ' ');
534
535	/*star */
536	wstandout(treescrn4);
537	mvwaddch(treescrn4, 0, 12, '*');
538	wstandend(treescrn4);
539
540	/*strng1 */
541	mvwaddch(treescrn4, 3, 13, ' ');
542
543	/*strng2 */
544
545	/*strng3 */
546	mvwaddch(treescrn4, 7, 15, ' ');
547	mvwaddch(treescrn4, 8, 11, ' ');
548
549	/*strng4 */
550	mvwaddch(treescrn4, 9, 16, ' ');
551	mvwaddch(treescrn4, 10, 12, ' ');
552	mvwaddch(treescrn4, 11, 8, ' ');
553
554	/*strng5 */
555	mvwaddch(treescrn4, 11, 18, ' ');
556	mvwaddch(treescrn4, 12, 14, ' ');
557
558	/* treescrn5 */
559
560	overlay(treescrn, treescrn5);
561
562	/*balls */
563	mvwaddch(treescrn5, 3, 15, ' ');
564	mvwaddch(treescrn5, 10, 20, ' ');
565	mvwaddch(treescrn5, 12, 1, ' ');
566
567	/*star */
568	mvwaddch(treescrn5, 0, 12, '*');
569
570	/*strng1 */
571	mvwaddch(treescrn5, 3, 11, ' ');
572
573	/*strng2 */
574	mvwaddch(treescrn5, 5, 12, ' ');
575
576	/*strng3 */
577	mvwaddch(treescrn5, 7, 14, ' ');
578	mvwaddch(treescrn5, 8, 10, ' ');
579
580	/*strng4 */
581	mvwaddch(treescrn5, 9, 15, ' ');
582	mvwaddch(treescrn5, 10, 11, ' ');
583	mvwaddch(treescrn5, 11, 7, ' ');
584
585	/*strng5 */
586	mvwaddch(treescrn5, 11, 17, ' ');
587	mvwaddch(treescrn5, 12, 13, ' ');
588
589	/* treescrn6 */
590
591	overlay(treescrn, treescrn6);
592
593	/*balls */
594	mvwaddch(treescrn6, 6, 7, ' ');
595	mvwaddch(treescrn6, 7, 18, ' ');
596	mvwaddch(treescrn6, 10, 4, ' ');
597	mvwaddch(treescrn6, 11, 23, ' ');
598
599	/*star */
600	wstandout(treescrn6);
601	mvwaddch(treescrn6, 0, 12, '*');
602	wstandend(treescrn6);
603
604	/*strng1 */
605
606	/*strng2 */
607	mvwaddch(treescrn6, 5, 11, ' ');
608
609	/*strng3 */
610	mvwaddch(treescrn6, 7, 13, ' ');
611	mvwaddch(treescrn6, 8, 9, ' ');
612
613	/*strng4 */
614	mvwaddch(treescrn6, 9, 14, ' ');
615	mvwaddch(treescrn6, 10, 10, ' ');
616	mvwaddch(treescrn6, 11, 6, ' ');
617
618	/*strng5 */
619	mvwaddch(treescrn6, 11, 16, ' ');
620	mvwaddch(treescrn6, 12, 12, ' ');
621
622	/* treescrn7 */
623
624	overlay(treescrn, treescrn7);
625
626	/*balls */
627	mvwaddch(treescrn7, 3, 15, ' ');
628	mvwaddch(treescrn7, 6, 7, ' ');
629	mvwaddch(treescrn7, 7, 18, ' ');
630	mvwaddch(treescrn7, 10, 4, ' ');
631	mvwaddch(treescrn7, 11, 22, ' ');
632
633	/*star */
634	mvwaddch(treescrn7, 0, 12, '*');
635
636	/*strng1 */
637	mvwaddch(treescrn7, 3, 12, ' ');
638
639	/*strng2 */
640	mvwaddch(treescrn7, 5, 13, ' ');
641	mvwaddch(treescrn7, 6, 9, ' ');
642
643	/*strng3 */
644	mvwaddch(treescrn7, 7, 15, ' ');
645	mvwaddch(treescrn7, 8, 11, ' ');
646
647	/*strng4 */
648	mvwaddch(treescrn7, 9, 16, ' ');
649	mvwaddch(treescrn7, 10, 12, ' ');
650	mvwaddch(treescrn7, 11, 8, ' ');
651
652	/*strng5 */
653	mvwaddch(treescrn7, 11, 18, ' ');
654	mvwaddch(treescrn7, 12, 14, ' ');
655
656	look_out(150);
657	reindeer();
658
659	touchwin(w_holiday);
660	wrefresh(w_holiday);
661	wrefresh(w_del_msg);
662
663	look_out(500);
664	for (loopy = 0; loopy < 100; loopy++) {
665	    blinkit();
666	}
667
668#ifdef NOLOOP
669	done(0);
670#endif
671    }
672    /*NOTREACHED */
673}
674
675static int
676boxit(void)
677{
678    int x = 0;
679
680    while (x < 20) {
681	mvaddch(x, 7, '|');
682	++x;
683    }
684
685    x = 8;
686
687    while (x < 80) {
688	mvaddch(19, x, '_');
689	++x;
690    }
691
692    x = 0;
693
694    while (x < 80) {
695	mvaddch(22, x, '_');
696	++x;
697    }
698
699    return (0);
700}
701
702static int
703seas(void)
704{
705    mvaddch(4, 1, 'S');
706    mvaddch(6, 1, 'E');
707    mvaddch(8, 1, 'A');
708    mvaddch(10, 1, 'S');
709    mvaddch(12, 1, 'O');
710    mvaddch(14, 1, 'N');
711    mvaddch(16, 1, '`');
712    mvaddch(18, 1, 'S');
713
714    return (0);
715}
716
717static int
718greet(void)
719{
720    mvaddch(3, 5, 'G');
721    mvaddch(5, 5, 'R');
722    mvaddch(7, 5, 'E');
723    mvaddch(9, 5, 'E');
724    mvaddch(11, 5, 'T');
725    mvaddch(13, 5, 'I');
726    mvaddch(15, 5, 'N');
727    mvaddch(17, 5, 'G');
728    mvaddch(19, 5, 'S');
729
730    return (0);
731}
732
733static int
734fromwho(void)
735{
736    mvaddstr(21, 13, FROMWHO);
737    return (0);
738}
739
740static int
741tree(void)
742{
743    set_color(treescrn, COLOR_GREEN);
744    mvwaddch(treescrn, 1, 11, (chtype) '/');
745    mvwaddch(treescrn, 2, 11, (chtype) '/');
746    mvwaddch(treescrn, 3, 10, (chtype) '/');
747    mvwaddch(treescrn, 4, 9, (chtype) '/');
748    mvwaddch(treescrn, 5, 9, (chtype) '/');
749    mvwaddch(treescrn, 6, 8, (chtype) '/');
750    mvwaddch(treescrn, 7, 7, (chtype) '/');
751    mvwaddch(treescrn, 8, 6, (chtype) '/');
752    mvwaddch(treescrn, 9, 6, (chtype) '/');
753    mvwaddch(treescrn, 10, 5, (chtype) '/');
754    mvwaddch(treescrn, 11, 3, (chtype) '/');
755    mvwaddch(treescrn, 12, 2, (chtype) '/');
756
757    mvwaddch(treescrn, 1, 13, (chtype) '\\');
758    mvwaddch(treescrn, 2, 13, (chtype) '\\');
759    mvwaddch(treescrn, 3, 14, (chtype) '\\');
760    mvwaddch(treescrn, 4, 15, (chtype) '\\');
761    mvwaddch(treescrn, 5, 15, (chtype) '\\');
762    mvwaddch(treescrn, 6, 16, (chtype) '\\');
763    mvwaddch(treescrn, 7, 17, (chtype) '\\');
764    mvwaddch(treescrn, 8, 18, (chtype) '\\');
765    mvwaddch(treescrn, 9, 18, (chtype) '\\');
766    mvwaddch(treescrn, 10, 19, (chtype) '\\');
767    mvwaddch(treescrn, 11, 21, (chtype) '\\');
768    mvwaddch(treescrn, 12, 22, (chtype) '\\');
769
770    mvwaddch(treescrn, 4, 10, (chtype) '_');
771    mvwaddch(treescrn, 4, 14, (chtype) '_');
772    mvwaddch(treescrn, 8, 7, (chtype) '_');
773    mvwaddch(treescrn, 8, 17, (chtype) '_');
774
775    mvwaddstr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\");
776
777    mvwaddstr(treescrn, 14, 11, "| |");
778    mvwaddstr(treescrn, 15, 11, "|_|");
779
780    unset_color(treescrn);
781    wrefresh(treescrn);
782    wrefresh(w_del_msg);
783
784    return (0);
785}
786
787static int
788balls(void)
789{
790    overlay(treescrn, treescrn2);
791
792    set_color(treescrn2, COLOR_BLUE);
793    mvwaddch(treescrn2, 3, 9, (chtype) '@');
794    mvwaddch(treescrn2, 3, 15, (chtype) '@');
795    mvwaddch(treescrn2, 4, 8, (chtype) '@');
796    mvwaddch(treescrn2, 4, 16, (chtype) '@');
797    mvwaddch(treescrn2, 5, 7, (chtype) '@');
798    mvwaddch(treescrn2, 5, 17, (chtype) '@');
799    mvwaddch(treescrn2, 7, 6, (chtype) '@');
800    mvwaddch(treescrn2, 7, 18, (chtype) '@');
801    mvwaddch(treescrn2, 8, 5, (chtype) '@');
802    mvwaddch(treescrn2, 8, 19, (chtype) '@');
803    mvwaddch(treescrn2, 10, 4, (chtype) '@');
804    mvwaddch(treescrn2, 10, 20, (chtype) '@');
805    mvwaddch(treescrn2, 11, 2, (chtype) '@');
806    mvwaddch(treescrn2, 11, 22, (chtype) '@');
807    mvwaddch(treescrn2, 12, 1, (chtype) '@');
808    mvwaddch(treescrn2, 12, 23, (chtype) '@');
809
810    unset_color(treescrn2);
811    wrefresh(treescrn2);
812    wrefresh(w_del_msg);
813    return (0);
814}
815
816static int
817star(void)
818{
819    wattrset(treescrn2, A_BOLD | A_BLINK);
820    set_color(treescrn2, COLOR_YELLOW);
821
822    mvwaddch(treescrn2, 0, 12, (chtype) '*');
823    wstandend(treescrn2);
824
825    unset_color(treescrn2);
826    wrefresh(treescrn2);
827    wrefresh(w_del_msg);
828    return (0);
829}
830
831static int
832strng1(void)
833{
834    wattrset(treescrn2, A_BOLD | A_BLINK);
835    set_color(treescrn2, COLOR_WHITE);
836
837    mvwaddch(treescrn2, 3, 13, (chtype) '\'');
838    mvwaddch(treescrn2, 3, 12, (chtype) ':');
839    mvwaddch(treescrn2, 3, 11, (chtype) '.');
840
841    wattroff(treescrn2, A_BOLD | A_BLINK);
842    unset_color(treescrn2);
843
844    wrefresh(treescrn2);
845    wrefresh(w_del_msg);
846    return (0);
847}
848
849static int
850strng2(void)
851{
852    wattrset(treescrn2, A_BOLD | A_BLINK);
853    set_color(treescrn2, COLOR_WHITE);
854
855    mvwaddch(treescrn2, 5, 14, (chtype) '\'');
856    mvwaddch(treescrn2, 5, 13, (chtype) ':');
857    mvwaddch(treescrn2, 5, 12, (chtype) '.');
858    mvwaddch(treescrn2, 5, 11, (chtype) ',');
859    mvwaddch(treescrn2, 6, 10, (chtype) '\'');
860    mvwaddch(treescrn2, 6, 9, (chtype) ':');
861
862    wattroff(treescrn2, A_BOLD | A_BLINK);
863    unset_color(treescrn2);
864
865    wrefresh(treescrn2);
866    wrefresh(w_del_msg);
867    return (0);
868}
869
870static int
871strng3(void)
872{
873    wattrset(treescrn2, A_BOLD | A_BLINK);
874    set_color(treescrn2, COLOR_WHITE);
875
876    mvwaddch(treescrn2, 7, 16, (chtype) '\'');
877    mvwaddch(treescrn2, 7, 15, (chtype) ':');
878    mvwaddch(treescrn2, 7, 14, (chtype) '.');
879    mvwaddch(treescrn2, 7, 13, (chtype) ',');
880    mvwaddch(treescrn2, 8, 12, (chtype) '\'');
881    mvwaddch(treescrn2, 8, 11, (chtype) ':');
882    mvwaddch(treescrn2, 8, 10, (chtype) '.');
883    mvwaddch(treescrn2, 8, 9, (chtype) ',');
884
885    wattroff(treescrn2, A_BOLD | A_BLINK);
886    unset_color(treescrn2);
887
888    wrefresh(treescrn2);
889    wrefresh(w_del_msg);
890    return (0);
891}
892
893static int
894strng4(void)
895{
896    wattrset(treescrn2, A_BOLD | A_BLINK);
897    set_color(treescrn2, COLOR_WHITE);
898
899    mvwaddch(treescrn2, 9, 17, (chtype) '\'');
900    mvwaddch(treescrn2, 9, 16, (chtype) ':');
901    mvwaddch(treescrn2, 9, 15, (chtype) '.');
902    mvwaddch(treescrn2, 9, 14, (chtype) ',');
903    mvwaddch(treescrn2, 10, 13, (chtype) '\'');
904    mvwaddch(treescrn2, 10, 12, (chtype) ':');
905    mvwaddch(treescrn2, 10, 11, (chtype) '.');
906    mvwaddch(treescrn2, 10, 10, (chtype) ',');
907    mvwaddch(treescrn2, 11, 9, (chtype) '\'');
908    mvwaddch(treescrn2, 11, 8, (chtype) ':');
909    mvwaddch(treescrn2, 11, 7, (chtype) '.');
910    mvwaddch(treescrn2, 11, 6, (chtype) ',');
911    mvwaddch(treescrn2, 12, 5, (chtype) '\'');
912
913    wattroff(treescrn2, A_BOLD | A_BLINK);
914    unset_color(treescrn2);
915
916    wrefresh(treescrn2);
917    wrefresh(w_del_msg);
918    return (0);
919}
920
921static int
922strng5(void)
923{
924    wattrset(treescrn2, A_BOLD | A_BLINK);
925    set_color(treescrn2, COLOR_WHITE);
926
927    mvwaddch(treescrn2, 11, 19, (chtype) '\'');
928    mvwaddch(treescrn2, 11, 18, (chtype) ':');
929    mvwaddch(treescrn2, 11, 17, (chtype) '.');
930    mvwaddch(treescrn2, 11, 16, (chtype) ',');
931    mvwaddch(treescrn2, 12, 15, (chtype) '\'');
932    mvwaddch(treescrn2, 12, 14, (chtype) ':');
933    mvwaddch(treescrn2, 12, 13, (chtype) '.');
934    mvwaddch(treescrn2, 12, 12, (chtype) ',');
935
936    wattroff(treescrn2, A_BOLD | A_BLINK);
937    unset_color(treescrn2);
938
939    /* save a fully lit tree */
940    overlay(treescrn2, treescrn);
941
942    wrefresh(treescrn2);
943    wrefresh(w_del_msg);
944    return (0);
945}
946
947static int
948blinkit(void)
949{
950    static int cycle;
951
952    if (cycle > 4) {
953	cycle = 0;
954    }
955
956    touchwin(treescrn8);
957
958    switch (cycle) {
959    case 0:
960	overlay(treescrn3, treescrn8);
961	wrefresh(treescrn8);
962	wrefresh(w_del_msg);
963	break;
964    case 1:
965	overlay(treescrn4, treescrn8);
966	wrefresh(treescrn8);
967	wrefresh(w_del_msg);
968	break;
969    case 2:
970	overlay(treescrn5, treescrn8);
971	wrefresh(treescrn8);
972	wrefresh(w_del_msg);
973	break;
974    case 3:
975	overlay(treescrn6, treescrn8);
976	wrefresh(treescrn8);
977	wrefresh(w_del_msg);
978	break;
979    case 4:
980	overlay(treescrn7, treescrn8);
981	wrefresh(treescrn8);
982	wrefresh(w_del_msg);
983	break;
984    }
985    touchwin(treescrn8);
986
987    /*ALL ON************************************************** */
988
989    overlay(treescrn, treescrn8);
990    wrefresh(treescrn8);
991    wrefresh(w_del_msg);
992
993    ++cycle;
994    return (0);
995}
996
997static void
998deer_step(WINDOW *win, int y, int x)
999{
1000    mvwin(win, y, x);
1001    wrefresh(win);
1002    wrefresh(w_del_msg);
1003    look_out(5);
1004}
1005
1006static int
1007reindeer(void)
1008{
1009    int looper;
1010    y_pos = 0;
1011
1012    for (x_pos = 70; x_pos > 62; x_pos--) {
1013	if (x_pos < 62) {
1014	    y_pos = 1;
1015	}
1016	for (looper = 0; looper < 4; looper++) {
1017	    mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '.');
1018	    wrefresh(dotdeer0);
1019	    wrefresh(w_del_msg);
1020	    werase(dotdeer0);
1021	    wrefresh(dotdeer0);
1022	    wrefresh(w_del_msg);
1023	    look_out(50);
1024	}
1025    }
1026
1027    y_pos = 2;
1028
1029    for (; x_pos > 50; x_pos--) {
1030	for (looper = 0; looper < 4; looper++) {
1031
1032	    if (x_pos < 56) {
1033		y_pos = 3;
1034
1035		mvwaddch(stardeer0, y_pos, x_pos, (chtype) '*');
1036		wrefresh(stardeer0);
1037		wrefresh(w_del_msg);
1038		werase(stardeer0);
1039		wrefresh(stardeer0);
1040		wrefresh(w_del_msg);
1041	    } else {
1042		mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '*');
1043		wrefresh(dotdeer0);
1044		wrefresh(w_del_msg);
1045		werase(dotdeer0);
1046		wrefresh(dotdeer0);
1047		wrefresh(w_del_msg);
1048	    }
1049	}
1050    }
1051
1052    x_pos = 58;
1053
1054    for (y_pos = 2; y_pos < 5; y_pos++) {
1055
1056	touchwin(lildeer0);
1057	wrefresh(lildeer0);
1058	wrefresh(w_del_msg);
1059
1060	for (looper = 0; looper < 4; looper++) {
1061	    deer_step(lildeer3, y_pos, x_pos);
1062	    deer_step(lildeer2, y_pos, x_pos);
1063	    deer_step(lildeer1, y_pos, x_pos);
1064	    deer_step(lildeer2, y_pos, x_pos);
1065	    deer_step(lildeer3, y_pos, x_pos);
1066
1067	    touchwin(lildeer0);
1068	    wrefresh(lildeer0);
1069	    wrefresh(w_del_msg);
1070
1071	    x_pos -= 2;
1072	}
1073    }
1074
1075    x_pos = 35;
1076
1077    for (y_pos = 5; y_pos < 10; y_pos++) {
1078
1079	touchwin(middeer0);
1080	wrefresh(middeer0);
1081	wrefresh(w_del_msg);
1082
1083	for (looper = 0; looper < 2; looper++) {
1084	    deer_step(middeer3, y_pos, x_pos);
1085	    deer_step(middeer2, y_pos, x_pos);
1086	    deer_step(middeer1, y_pos, x_pos);
1087	    deer_step(middeer2, y_pos, x_pos);
1088	    deer_step(middeer3, y_pos, x_pos);
1089
1090	    touchwin(middeer0);
1091	    wrefresh(middeer0);
1092	    wrefresh(w_del_msg);
1093
1094	    x_pos -= 3;
1095	}
1096    }
1097
1098    look_out(300);
1099
1100    y_pos = 1;
1101
1102    for (x_pos = 8; x_pos < 16; x_pos++) {
1103	deer_step(bigdeer4, y_pos, x_pos);
1104	deer_step(bigdeer3, y_pos, x_pos);
1105	deer_step(bigdeer2, y_pos, x_pos);
1106	deer_step(bigdeer1, y_pos, x_pos);
1107	deer_step(bigdeer2, y_pos, x_pos);
1108	deer_step(bigdeer3, y_pos, x_pos);
1109	deer_step(bigdeer4, y_pos, x_pos);
1110	deer_step(bigdeer0, y_pos, x_pos);
1111    }
1112
1113    --x_pos;
1114
1115    for (looper = 0; looper < 6; looper++) {
1116	deer_step(lookdeer4, y_pos, x_pos);
1117	deer_step(lookdeer3, y_pos, x_pos);
1118	deer_step(lookdeer2, y_pos, x_pos);
1119	deer_step(lookdeer1, y_pos, x_pos);
1120	deer_step(lookdeer2, y_pos, x_pos);
1121	deer_step(lookdeer3, y_pos, x_pos);
1122	deer_step(lookdeer4, y_pos, x_pos);
1123    }
1124
1125    deer_step(lookdeer0, y_pos, x_pos);
1126
1127    for (; y_pos < 10; y_pos++) {
1128	for (looper = 0; looper < 2; looper++) {
1129	    deer_step(bigdeer4, y_pos, x_pos);
1130	    deer_step(bigdeer3, y_pos, x_pos);
1131	    deer_step(bigdeer2, y_pos, x_pos);
1132	    deer_step(bigdeer1, y_pos, x_pos);
1133	    deer_step(bigdeer2, y_pos, x_pos);
1134	    deer_step(bigdeer3, y_pos, x_pos);
1135	    deer_step(bigdeer4, y_pos, x_pos);
1136	}
1137	deer_step(bigdeer0, y_pos, x_pos);
1138    }
1139
1140    --y_pos;
1141
1142    deer_step(lookdeer3, y_pos, x_pos);
1143    return (0);
1144}
1145
1146static RETSIGTYPE
1147done(int sig GCC_UNUSED)
1148{
1149    CATCHALL(done);
1150
1151    move(LINES - 1, 0);
1152    refresh();
1153    endwin();
1154    curs_set(1);
1155
1156#if NO_LEAKS
1157    if (my_pairs != 0)
1158	free(my_pairs);
1159#endif
1160
1161    ExitProgram(EXIT_SUCCESS);
1162}
1163