Remove duplicate include of header file "sys/bus.h".
[dragonfly.git] / contrib / ncurses-5.4 / test / xmas.c
blobc9f338c0cd5dc8a238a7dbb254b5566636083ad8
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 /******************************************************************************/
95 * $Id: xmas.c,v 1.19 2002/06/29 23:32:18 tom Exp $
97 #include <test.priv.h>
99 #define FROMWHO "Mark Hessling - (M.Hessling@gu.edu.au)"
101 static int my_bg = COLOR_BLACK;
102 static int y_pos, x_pos;
104 static WINDOW *treescrn;
105 static WINDOW *treescrn2;
106 static WINDOW *treescrn3;
107 static WINDOW *treescrn4;
108 static WINDOW *treescrn5;
109 static WINDOW *treescrn6;
110 static WINDOW *treescrn7;
111 static WINDOW *treescrn8;
112 static WINDOW *dotdeer0;
113 static WINDOW *stardeer0;
114 static WINDOW *lildeer0;
115 static WINDOW *lildeer1;
116 static WINDOW *lildeer2;
117 static WINDOW *lildeer3;
118 static WINDOW *middeer0;
119 static WINDOW *middeer1;
120 static WINDOW *middeer2;
121 static WINDOW *middeer3;
122 static WINDOW *bigdeer0;
123 static WINDOW *bigdeer1;
124 static WINDOW *bigdeer2;
125 static WINDOW *bigdeer3;
126 static WINDOW *bigdeer4;
127 static WINDOW *lookdeer0;
128 static WINDOW *lookdeer1;
129 static WINDOW *lookdeer2;
130 static WINDOW *lookdeer3;
131 static WINDOW *lookdeer4;
132 static WINDOW *w_holiday;
133 static WINDOW *w_del_msg;
135 static int boxit(void);
136 static int seas(void);
137 static int greet(void);
138 static int fromwho(void);
139 static int tree(void);
140 static int balls(void);
141 static int star(void);
142 static int strng1(void);
143 static int strng2(void);
144 static int strng3(void);
145 static int strng4(void);
146 static int strng5(void);
147 static int reindeer(void);
148 static int blinkit(void);
150 static RETSIGTYPE done(int sig) GCC_NORETURN;
152 static void
153 set_color(WINDOW *win, chtype color)
155 if (has_colors()) {
156 static bool *pairs;
157 int n = (color + 1);
158 if (pairs == 0)
159 pairs = (bool *) calloc(COLORS + 1, sizeof(bool));
160 if (!pairs[n]) {
161 init_pair(n, color, my_bg);
162 pairs[n] = TRUE;
164 wattroff(win, A_COLOR);
165 wattron(win, COLOR_PAIR(n));
169 static void
170 unset_color(WINDOW *win)
172 if (has_colors())
173 wattrset(win, COLOR_PAIR(0));
176 static void
177 look_out(int msecs)
179 napms(msecs);
180 if (getch() != ERR) {
181 beep();
182 done(0);
187 main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
189 int loopy;
191 setlocale(LC_ALL, "");
193 initscr();
194 noecho();
195 nonl();
196 refresh();
197 signal(SIGINT, done);
198 signal(SIGTERM, done);
199 #if !defined DOS && !defined OS2
200 signal(SIGHUP, done);
201 signal(SIGQUIT, done);
202 #endif
203 if (has_colors()) {
204 start_color();
205 #if HAVE_USE_DEFAULT_COLORS
206 if (use_default_colors() == OK)
207 my_bg = -1;
208 #endif
210 curs_set(0);
212 treescrn = newwin(16, 27, 3, 53);
213 treescrn2 = newwin(16, 27, 3, 53);
214 treescrn3 = newwin(16, 27, 3, 53);
215 treescrn4 = newwin(16, 27, 3, 53);
216 treescrn5 = newwin(16, 27, 3, 53);
217 treescrn6 = newwin(16, 27, 3, 53);
218 treescrn7 = newwin(16, 27, 3, 53);
219 treescrn8 = newwin(16, 27, 3, 53);
221 dotdeer0 = newwin(3, 71, 0, 8);
223 stardeer0 = newwin(4, 56, 0, 8);
225 lildeer0 = newwin(7, 53, 0, 8);
226 lildeer1 = newwin(2, 4, 0, 0);
227 lildeer2 = newwin(2, 4, 0, 0);
228 lildeer3 = newwin(2, 4, 0, 0);
230 middeer0 = newwin(15, 42, 0, 8);
231 middeer1 = newwin(3, 7, 0, 0);
232 middeer2 = newwin(3, 7, 0, 0);
233 middeer3 = newwin(3, 7, 0, 0);
235 bigdeer0 = newwin(10, 23, 0, 0);
236 bigdeer1 = newwin(10, 23, 0, 0);
237 bigdeer2 = newwin(10, 23, 0, 0);
238 bigdeer3 = newwin(10, 23, 0, 0);
239 bigdeer4 = newwin(10, 23, 0, 0);
241 lookdeer0 = newwin(10, 25, 0, 0);
242 lookdeer1 = newwin(10, 25, 0, 0);
243 lookdeer2 = newwin(10, 25, 0, 0);
244 lookdeer3 = newwin(10, 25, 0, 0);
245 lookdeer4 = newwin(10, 25, 0, 0);
247 w_holiday = newwin(1, 26, 3, 27);
249 w_del_msg = newwin(1, 19, 23, 60);
251 mvwaddstr(w_del_msg, 0, 0, "Hit any key to quit");
253 mvwaddstr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S");
255 /* set up the windows for our various reindeer */
257 /* lildeer1 */
258 mvwaddch(lildeer1, 0, 0, (chtype) 'V');
259 mvwaddch(lildeer1, 1, 0, (chtype) '@');
260 mvwaddch(lildeer1, 1, 1, (chtype) '<');
261 mvwaddch(lildeer1, 1, 2, (chtype) '>');
262 mvwaddch(lildeer1, 1, 3, (chtype) '~');
264 /* lildeer2 */
265 mvwaddch(lildeer2, 0, 0, (chtype) 'V');
266 mvwaddch(lildeer2, 1, 0, (chtype) '@');
267 mvwaddch(lildeer2, 1, 1, (chtype) '|');
268 mvwaddch(lildeer2, 1, 2, (chtype) '|');
269 mvwaddch(lildeer2, 1, 3, (chtype) '~');
271 /* lildeer3 */
272 mvwaddch(lildeer3, 0, 0, (chtype) 'V');
273 mvwaddch(lildeer3, 1, 0, (chtype) '@');
274 mvwaddch(lildeer3, 1, 1, (chtype) '>');
275 mvwaddch(lildeer3, 1, 2, (chtype) '<');
276 mvwaddch(lildeer2, 1, 3, (chtype) '~');
278 /* middeer1 */
279 mvwaddch(middeer1, 0, 2, (chtype) 'y');
280 mvwaddch(middeer1, 0, 3, (chtype) 'y');
281 mvwaddch(middeer1, 1, 2, (chtype) '0');
282 mvwaddch(middeer1, 1, 3, (chtype) '(');
283 mvwaddch(middeer1, 1, 4, (chtype) '=');
284 mvwaddch(middeer1, 1, 5, (chtype) ')');
285 mvwaddch(middeer1, 1, 6, (chtype) '~');
286 mvwaddch(middeer1, 2, 3, (chtype) '\\');
287 mvwaddch(middeer1, 2, 4, (chtype) '/');
289 /* middeer2 */
290 mvwaddch(middeer2, 0, 2, (chtype) 'y');
291 mvwaddch(middeer2, 0, 3, (chtype) 'y');
292 mvwaddch(middeer2, 1, 2, (chtype) '0');
293 mvwaddch(middeer2, 1, 3, (chtype) '(');
294 mvwaddch(middeer2, 1, 4, (chtype) '=');
295 mvwaddch(middeer2, 1, 5, (chtype) ')');
296 mvwaddch(middeer2, 1, 6, (chtype) '~');
297 mvwaddch(middeer2, 2, 3, (chtype) '|');
298 mvwaddch(middeer2, 2, 5, (chtype) '|');
300 /* middeer3 */
301 mvwaddch(middeer3, 0, 2, (chtype) 'y');
302 mvwaddch(middeer3, 0, 3, (chtype) 'y');
303 mvwaddch(middeer3, 1, 2, (chtype) '0');
304 mvwaddch(middeer3, 1, 3, (chtype) '(');
305 mvwaddch(middeer3, 1, 4, (chtype) '=');
306 mvwaddch(middeer3, 1, 5, (chtype) ')');
307 mvwaddch(middeer3, 1, 6, (chtype) '~');
308 mvwaddch(middeer3, 2, 2, (chtype) '/');
309 mvwaddch(middeer3, 2, 6, (chtype) '\\');
311 /* bigdeer1 */
312 mvwaddch(bigdeer1, 0, 17, (chtype) '\\');
313 mvwaddch(bigdeer1, 0, 18, (chtype) '/');
314 mvwaddch(bigdeer1, 0, 20, (chtype) '\\');
315 mvwaddch(bigdeer1, 0, 21, (chtype) '/');
316 mvwaddch(bigdeer1, 1, 18, (chtype) '\\');
317 mvwaddch(bigdeer1, 1, 20, (chtype) '/');
318 mvwaddch(bigdeer1, 2, 19, (chtype) '|');
319 mvwaddch(bigdeer1, 2, 20, (chtype) '_');
320 mvwaddch(bigdeer1, 3, 18, (chtype) '/');
321 mvwaddch(bigdeer1, 3, 19, (chtype) '^');
322 mvwaddch(bigdeer1, 3, 20, (chtype) '0');
323 mvwaddch(bigdeer1, 3, 21, (chtype) '\\');
324 mvwaddch(bigdeer1, 4, 17, (chtype) '/');
325 mvwaddch(bigdeer1, 4, 18, (chtype) '/');
326 mvwaddch(bigdeer1, 4, 19, (chtype) '\\');
327 mvwaddch(bigdeer1, 4, 22, (chtype) '\\');
328 mvwaddstr(bigdeer1, 5, 7, "^~~~~~~~~// ~~U");
329 mvwaddstr(bigdeer1, 6, 7, "( \\_____( /");
330 mvwaddstr(bigdeer1, 7, 8, "( ) /");
331 mvwaddstr(bigdeer1, 8, 9, "\\\\ /");
332 mvwaddstr(bigdeer1, 9, 11, "\\>/>");
334 /* bigdeer2 */
335 mvwaddch(bigdeer2, 0, 17, (chtype) '\\');
336 mvwaddch(bigdeer2, 0, 18, (chtype) '/');
337 mvwaddch(bigdeer2, 0, 20, (chtype) '\\');
338 mvwaddch(bigdeer2, 0, 21, (chtype) '/');
339 mvwaddch(bigdeer2, 1, 18, (chtype) '\\');
340 mvwaddch(bigdeer2, 1, 20, (chtype) '/');
341 mvwaddch(bigdeer2, 2, 19, (chtype) '|');
342 mvwaddch(bigdeer2, 2, 20, (chtype) '_');
343 mvwaddch(bigdeer2, 3, 18, (chtype) '/');
344 mvwaddch(bigdeer2, 3, 19, (chtype) '^');
345 mvwaddch(bigdeer2, 3, 20, (chtype) '0');
346 mvwaddch(bigdeer2, 3, 21, (chtype) '\\');
347 mvwaddch(bigdeer2, 4, 17, (chtype) '/');
348 mvwaddch(bigdeer2, 4, 18, (chtype) '/');
349 mvwaddch(bigdeer2, 4, 19, (chtype) '\\');
350 mvwaddch(bigdeer2, 4, 22, (chtype) '\\');
351 mvwaddstr(bigdeer2, 5, 7, "^~~~~~~~~// ~~U");
352 mvwaddstr(bigdeer2, 6, 7, "(( )____( /");
353 mvwaddstr(bigdeer2, 7, 7, "( / |");
354 mvwaddstr(bigdeer2, 8, 8, "\\/ |");
355 mvwaddstr(bigdeer2, 9, 9, "|> |>");
357 /* bigdeer3 */
358 mvwaddch(bigdeer3, 0, 17, (chtype) '\\');
359 mvwaddch(bigdeer3, 0, 18, (chtype) '/');
360 mvwaddch(bigdeer3, 0, 20, (chtype) '\\');
361 mvwaddch(bigdeer3, 0, 21, (chtype) '/');
362 mvwaddch(bigdeer3, 1, 18, (chtype) '\\');
363 mvwaddch(bigdeer3, 1, 20, (chtype) '/');
364 mvwaddch(bigdeer3, 2, 19, (chtype) '|');
365 mvwaddch(bigdeer3, 2, 20, (chtype) '_');
366 mvwaddch(bigdeer3, 3, 18, (chtype) '/');
367 mvwaddch(bigdeer3, 3, 19, (chtype) '^');
368 mvwaddch(bigdeer3, 3, 20, (chtype) '0');
369 mvwaddch(bigdeer3, 3, 21, (chtype) '\\');
370 mvwaddch(bigdeer3, 4, 17, (chtype) '/');
371 mvwaddch(bigdeer3, 4, 18, (chtype) '/');
372 mvwaddch(bigdeer3, 4, 19, (chtype) '\\');
373 mvwaddch(bigdeer3, 4, 22, (chtype) '\\');
374 mvwaddstr(bigdeer3, 5, 7, "^~~~~~~~~// ~~U");
375 mvwaddstr(bigdeer3, 6, 6, "( ()_____( /");
376 mvwaddstr(bigdeer3, 7, 6, "/ / /");
377 mvwaddstr(bigdeer3, 8, 5, "|/ \\");
378 mvwaddstr(bigdeer3, 9, 5, "/> \\>");
380 /* bigdeer4 */
381 mvwaddch(bigdeer4, 0, 17, (chtype) '\\');
382 mvwaddch(bigdeer4, 0, 18, (chtype) '/');
383 mvwaddch(bigdeer4, 0, 20, (chtype) '\\');
384 mvwaddch(bigdeer4, 0, 21, (chtype) '/');
385 mvwaddch(bigdeer4, 1, 18, (chtype) '\\');
386 mvwaddch(bigdeer4, 1, 20, (chtype) '/');
387 mvwaddch(bigdeer4, 2, 19, (chtype) '|');
388 mvwaddch(bigdeer4, 2, 20, (chtype) '_');
389 mvwaddch(bigdeer4, 3, 18, (chtype) '/');
390 mvwaddch(bigdeer4, 3, 19, (chtype) '^');
391 mvwaddch(bigdeer4, 3, 20, (chtype) '0');
392 mvwaddch(bigdeer4, 3, 21, (chtype) '\\');
393 mvwaddch(bigdeer4, 4, 17, (chtype) '/');
394 mvwaddch(bigdeer4, 4, 18, (chtype) '/');
395 mvwaddch(bigdeer4, 4, 19, (chtype) '\\');
396 mvwaddch(bigdeer4, 4, 22, (chtype) '\\');
397 mvwaddstr(bigdeer4, 5, 7, "^~~~~~~~~// ~~U");
398 mvwaddstr(bigdeer4, 6, 6, "( )______( /");
399 mvwaddstr(bigdeer4, 7, 5, "(/ \\");
400 mvwaddstr(bigdeer4, 8, 0, "v___= ----^");
402 /* lookdeer1 */
403 mvwaddstr(lookdeer1, 0, 16, "\\/ \\/");
404 mvwaddstr(lookdeer1, 1, 17, "\\Y/ \\Y/");
405 mvwaddstr(lookdeer1, 2, 19, "\\=/");
406 mvwaddstr(lookdeer1, 3, 17, "^\\o o/^");
407 mvwaddstr(lookdeer1, 4, 17, "//( )");
408 mvwaddstr(lookdeer1, 5, 7, "^~~~~~~~~// \\O/");
409 mvwaddstr(lookdeer1, 6, 7, "( \\_____( /");
410 mvwaddstr(lookdeer1, 7, 8, "( ) /");
411 mvwaddstr(lookdeer1, 8, 9, "\\\\ /");
412 mvwaddstr(lookdeer1, 9, 11, "\\>/>");
414 /* lookdeer2 */
415 mvwaddstr(lookdeer2, 0, 16, "\\/ \\/");
416 mvwaddstr(lookdeer2, 1, 17, "\\Y/ \\Y/");
417 mvwaddstr(lookdeer2, 2, 19, "\\=/");
418 mvwaddstr(lookdeer2, 3, 17, "^\\o o/^");
419 mvwaddstr(lookdeer2, 4, 17, "//( )");
420 mvwaddstr(lookdeer2, 5, 7, "^~~~~~~~~// \\O/");
421 mvwaddstr(lookdeer2, 6, 7, "(( )____( /");
422 mvwaddstr(lookdeer2, 7, 7, "( / |");
423 mvwaddstr(lookdeer2, 8, 8, "\\/ |");
424 mvwaddstr(lookdeer2, 9, 9, "|> |>");
426 /* lookdeer3 */
427 mvwaddstr(lookdeer3, 0, 16, "\\/ \\/");
428 mvwaddstr(lookdeer3, 1, 17, "\\Y/ \\Y/");
429 mvwaddstr(lookdeer3, 2, 19, "\\=/");
430 mvwaddstr(lookdeer3, 3, 17, "^\\o o/^");
431 mvwaddstr(lookdeer3, 4, 17, "//( )");
432 mvwaddstr(lookdeer3, 5, 7, "^~~~~~~~~// \\O/");
433 mvwaddstr(lookdeer3, 6, 6, "( ()_____( /");
434 mvwaddstr(lookdeer3, 7, 6, "/ / /");
435 mvwaddstr(lookdeer3, 8, 5, "|/ \\");
436 mvwaddstr(lookdeer3, 9, 5, "/> \\>");
438 /* lookdeer4 */
439 mvwaddstr(lookdeer4, 0, 16, "\\/ \\/");
440 mvwaddstr(lookdeer4, 1, 17, "\\Y/ \\Y/");
441 mvwaddstr(lookdeer4, 2, 19, "\\=/");
442 mvwaddstr(lookdeer4, 3, 17, "^\\o o/^");
443 mvwaddstr(lookdeer4, 4, 17, "//( )");
444 mvwaddstr(lookdeer4, 5, 7, "^~~~~~~~~// \\O/");
445 mvwaddstr(lookdeer4, 6, 6, "( )______( /");
446 mvwaddstr(lookdeer4, 7, 5, "(/ \\");
447 mvwaddstr(lookdeer4, 8, 0, "v___= ----^");
449 /***********************************************/
450 cbreak();
451 nodelay(stdscr, TRUE);
452 for (;;) {
453 clear();
454 werase(treescrn);
455 touchwin(w_del_msg);
456 touchwin(treescrn);
457 werase(treescrn2);
458 touchwin(treescrn2);
459 werase(treescrn8);
460 touchwin(treescrn8);
461 refresh();
462 look_out(150);
463 boxit();
464 refresh();
465 look_out(150);
466 seas();
467 refresh();
468 look_out(150);
469 greet();
470 refresh();
471 look_out(150);
472 fromwho();
473 refresh();
474 look_out(150);
475 tree();
476 look_out(150);
477 balls();
478 look_out(150);
479 star();
480 look_out(150);
481 strng1();
482 strng2();
483 strng3();
484 strng4();
485 strng5();
487 /* set up the windows for our blinking trees */
488 /* **************************************** */
489 /* treescrn3 */
491 overlay(treescrn, treescrn3);
493 /*balls */
494 mvwaddch(treescrn3, 4, 18, ' ');
495 mvwaddch(treescrn3, 7, 6, ' ');
496 mvwaddch(treescrn3, 8, 19, ' ');
497 mvwaddch(treescrn3, 11, 22, ' ');
499 /*star */
500 mvwaddch(treescrn3, 0, 12, '*');
502 /*strng1 */
503 mvwaddch(treescrn3, 3, 11, ' ');
505 /*strng2 */
506 mvwaddch(treescrn3, 5, 13, ' ');
507 mvwaddch(treescrn3, 6, 10, ' ');
509 /*strng3 */
510 mvwaddch(treescrn3, 7, 16, ' ');
511 mvwaddch(treescrn3, 7, 14, ' ');
513 /*strng4 */
514 mvwaddch(treescrn3, 10, 13, ' ');
515 mvwaddch(treescrn3, 10, 10, ' ');
516 mvwaddch(treescrn3, 11, 8, ' ');
518 /*strng5 */
519 mvwaddch(treescrn3, 11, 18, ' ');
520 mvwaddch(treescrn3, 12, 13, ' ');
522 /* treescrn4 */
524 overlay(treescrn, treescrn4);
526 /*balls */
527 mvwaddch(treescrn4, 3, 9, ' ');
528 mvwaddch(treescrn4, 4, 16, ' ');
529 mvwaddch(treescrn4, 7, 6, ' ');
530 mvwaddch(treescrn4, 8, 19, ' ');
531 mvwaddch(treescrn4, 11, 2, ' ');
532 mvwaddch(treescrn4, 12, 23, ' ');
534 /*star */
535 wstandout(treescrn4);
536 mvwaddch(treescrn4, 0, 12, '*');
537 wstandend(treescrn4);
539 /*strng1 */
540 mvwaddch(treescrn4, 3, 13, ' ');
542 /*strng2 */
544 /*strng3 */
545 mvwaddch(treescrn4, 7, 15, ' ');
546 mvwaddch(treescrn4, 8, 11, ' ');
548 /*strng4 */
549 mvwaddch(treescrn4, 9, 16, ' ');
550 mvwaddch(treescrn4, 10, 12, ' ');
551 mvwaddch(treescrn4, 11, 8, ' ');
553 /*strng5 */
554 mvwaddch(treescrn4, 11, 18, ' ');
555 mvwaddch(treescrn4, 12, 14, ' ');
557 /* treescrn5 */
559 overlay(treescrn, treescrn5);
561 /*balls */
562 mvwaddch(treescrn5, 3, 15, ' ');
563 mvwaddch(treescrn5, 10, 20, ' ');
564 mvwaddch(treescrn5, 12, 1, ' ');
566 /*star */
567 mvwaddch(treescrn5, 0, 12, '*');
569 /*strng1 */
570 mvwaddch(treescrn5, 3, 11, ' ');
572 /*strng2 */
573 mvwaddch(treescrn5, 5, 12, ' ');
575 /*strng3 */
576 mvwaddch(treescrn5, 7, 14, ' ');
577 mvwaddch(treescrn5, 8, 10, ' ');
579 /*strng4 */
580 mvwaddch(treescrn5, 9, 15, ' ');
581 mvwaddch(treescrn5, 10, 11, ' ');
582 mvwaddch(treescrn5, 11, 7, ' ');
584 /*strng5 */
585 mvwaddch(treescrn5, 11, 17, ' ');
586 mvwaddch(treescrn5, 12, 13, ' ');
588 /* treescrn6 */
590 overlay(treescrn, treescrn6);
592 /*balls */
593 mvwaddch(treescrn6, 6, 7, ' ');
594 mvwaddch(treescrn6, 7, 18, ' ');
595 mvwaddch(treescrn6, 10, 4, ' ');
596 mvwaddch(treescrn6, 11, 23, ' ');
598 /*star */
599 wstandout(treescrn6);
600 mvwaddch(treescrn6, 0, 12, '*');
601 wstandend(treescrn6);
603 /*strng1 */
605 /*strng2 */
606 mvwaddch(treescrn6, 5, 11, ' ');
608 /*strng3 */
609 mvwaddch(treescrn6, 7, 13, ' ');
610 mvwaddch(treescrn6, 8, 9, ' ');
612 /*strng4 */
613 mvwaddch(treescrn6, 9, 14, ' ');
614 mvwaddch(treescrn6, 10, 10, ' ');
615 mvwaddch(treescrn6, 11, 6, ' ');
617 /*strng5 */
618 mvwaddch(treescrn6, 11, 16, ' ');
619 mvwaddch(treescrn6, 12, 12, ' ');
621 /* treescrn7 */
623 overlay(treescrn, treescrn7);
625 /*balls */
626 mvwaddch(treescrn7, 3, 15, ' ');
627 mvwaddch(treescrn7, 6, 7, ' ');
628 mvwaddch(treescrn7, 7, 18, ' ');
629 mvwaddch(treescrn7, 10, 4, ' ');
630 mvwaddch(treescrn7, 11, 22, ' ');
632 /*star */
633 mvwaddch(treescrn7, 0, 12, '*');
635 /*strng1 */
636 mvwaddch(treescrn7, 3, 12, ' ');
638 /*strng2 */
639 mvwaddch(treescrn7, 5, 13, ' ');
640 mvwaddch(treescrn7, 6, 9, ' ');
642 /*strng3 */
643 mvwaddch(treescrn7, 7, 15, ' ');
644 mvwaddch(treescrn7, 8, 11, ' ');
646 /*strng4 */
647 mvwaddch(treescrn7, 9, 16, ' ');
648 mvwaddch(treescrn7, 10, 12, ' ');
649 mvwaddch(treescrn7, 11, 8, ' ');
651 /*strng5 */
652 mvwaddch(treescrn7, 11, 18, ' ');
653 mvwaddch(treescrn7, 12, 14, ' ');
655 look_out(150);
656 reindeer();
658 touchwin(w_holiday);
659 wrefresh(w_holiday);
660 wrefresh(w_del_msg);
662 look_out(500);
663 for (loopy = 0; loopy < 100; loopy++) {
664 blinkit();
667 #ifdef NOLOOP
668 done(0);
669 #endif
671 /*NOTREACHED */
674 static int
675 boxit(void)
677 int x = 0;
679 while (x < 20) {
680 mvaddch(x, 7, '|');
681 ++x;
684 x = 8;
686 while (x < 80) {
687 mvaddch(19, x, '_');
688 ++x;
691 x = 0;
693 while (x < 80) {
694 mvaddch(22, x, '_');
695 ++x;
698 return (0);
701 static int
702 seas(void)
704 mvaddch(4, 1, 'S');
705 mvaddch(6, 1, 'E');
706 mvaddch(8, 1, 'A');
707 mvaddch(10, 1, 'S');
708 mvaddch(12, 1, 'O');
709 mvaddch(14, 1, 'N');
710 mvaddch(16, 1, '`');
711 mvaddch(18, 1, 'S');
713 return (0);
716 static int
717 greet(void)
719 mvaddch(3, 5, 'G');
720 mvaddch(5, 5, 'R');
721 mvaddch(7, 5, 'E');
722 mvaddch(9, 5, 'E');
723 mvaddch(11, 5, 'T');
724 mvaddch(13, 5, 'I');
725 mvaddch(15, 5, 'N');
726 mvaddch(17, 5, 'G');
727 mvaddch(19, 5, 'S');
729 return (0);
732 static int
733 fromwho(void)
735 mvaddstr(21, 13, FROMWHO);
736 return (0);
739 static int
740 tree(void)
742 set_color(treescrn, COLOR_GREEN);
743 mvwaddch(treescrn, 1, 11, (chtype) '/');
744 mvwaddch(treescrn, 2, 11, (chtype) '/');
745 mvwaddch(treescrn, 3, 10, (chtype) '/');
746 mvwaddch(treescrn, 4, 9, (chtype) '/');
747 mvwaddch(treescrn, 5, 9, (chtype) '/');
748 mvwaddch(treescrn, 6, 8, (chtype) '/');
749 mvwaddch(treescrn, 7, 7, (chtype) '/');
750 mvwaddch(treescrn, 8, 6, (chtype) '/');
751 mvwaddch(treescrn, 9, 6, (chtype) '/');
752 mvwaddch(treescrn, 10, 5, (chtype) '/');
753 mvwaddch(treescrn, 11, 3, (chtype) '/');
754 mvwaddch(treescrn, 12, 2, (chtype) '/');
756 mvwaddch(treescrn, 1, 13, (chtype) '\\');
757 mvwaddch(treescrn, 2, 13, (chtype) '\\');
758 mvwaddch(treescrn, 3, 14, (chtype) '\\');
759 mvwaddch(treescrn, 4, 15, (chtype) '\\');
760 mvwaddch(treescrn, 5, 15, (chtype) '\\');
761 mvwaddch(treescrn, 6, 16, (chtype) '\\');
762 mvwaddch(treescrn, 7, 17, (chtype) '\\');
763 mvwaddch(treescrn, 8, 18, (chtype) '\\');
764 mvwaddch(treescrn, 9, 18, (chtype) '\\');
765 mvwaddch(treescrn, 10, 19, (chtype) '\\');
766 mvwaddch(treescrn, 11, 21, (chtype) '\\');
767 mvwaddch(treescrn, 12, 22, (chtype) '\\');
769 mvwaddch(treescrn, 4, 10, (chtype) '_');
770 mvwaddch(treescrn, 4, 14, (chtype) '_');
771 mvwaddch(treescrn, 8, 7, (chtype) '_');
772 mvwaddch(treescrn, 8, 17, (chtype) '_');
774 mvwaddstr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\");
776 mvwaddstr(treescrn, 14, 11, "| |");
777 mvwaddstr(treescrn, 15, 11, "|_|");
779 unset_color(treescrn);
780 wrefresh(treescrn);
781 wrefresh(w_del_msg);
783 return (0);
786 static int
787 balls(void)
789 overlay(treescrn, treescrn2);
791 set_color(treescrn2, COLOR_BLUE);
792 mvwaddch(treescrn2, 3, 9, (chtype) '@');
793 mvwaddch(treescrn2, 3, 15, (chtype) '@');
794 mvwaddch(treescrn2, 4, 8, (chtype) '@');
795 mvwaddch(treescrn2, 4, 16, (chtype) '@');
796 mvwaddch(treescrn2, 5, 7, (chtype) '@');
797 mvwaddch(treescrn2, 5, 17, (chtype) '@');
798 mvwaddch(treescrn2, 7, 6, (chtype) '@');
799 mvwaddch(treescrn2, 7, 18, (chtype) '@');
800 mvwaddch(treescrn2, 8, 5, (chtype) '@');
801 mvwaddch(treescrn2, 8, 19, (chtype) '@');
802 mvwaddch(treescrn2, 10, 4, (chtype) '@');
803 mvwaddch(treescrn2, 10, 20, (chtype) '@');
804 mvwaddch(treescrn2, 11, 2, (chtype) '@');
805 mvwaddch(treescrn2, 11, 22, (chtype) '@');
806 mvwaddch(treescrn2, 12, 1, (chtype) '@');
807 mvwaddch(treescrn2, 12, 23, (chtype) '@');
809 unset_color(treescrn2);
810 wrefresh(treescrn2);
811 wrefresh(w_del_msg);
812 return (0);
815 static int
816 star(void)
818 wattrset(treescrn2, A_BOLD | A_BLINK);
819 set_color(treescrn2, COLOR_YELLOW);
821 mvwaddch(treescrn2, 0, 12, (chtype) '*');
822 wstandend(treescrn2);
824 unset_color(treescrn2);
825 wrefresh(treescrn2);
826 wrefresh(w_del_msg);
827 return (0);
830 static int
831 strng1(void)
833 wattrset(treescrn2, A_BOLD | A_BLINK);
834 set_color(treescrn2, COLOR_WHITE);
836 mvwaddch(treescrn2, 3, 13, (chtype) '\'');
837 mvwaddch(treescrn2, 3, 12, (chtype) ':');
838 mvwaddch(treescrn2, 3, 11, (chtype) '.');
840 wattroff(treescrn2, A_BOLD | A_BLINK);
841 unset_color(treescrn2);
843 wrefresh(treescrn2);
844 wrefresh(w_del_msg);
845 return (0);
848 static int
849 strng2(void)
851 wattrset(treescrn2, A_BOLD | A_BLINK);
852 set_color(treescrn2, COLOR_WHITE);
854 mvwaddch(treescrn2, 5, 14, (chtype) '\'');
855 mvwaddch(treescrn2, 5, 13, (chtype) ':');
856 mvwaddch(treescrn2, 5, 12, (chtype) '.');
857 mvwaddch(treescrn2, 5, 11, (chtype) ',');
858 mvwaddch(treescrn2, 6, 10, (chtype) '\'');
859 mvwaddch(treescrn2, 6, 9, (chtype) ':');
861 wattroff(treescrn2, A_BOLD | A_BLINK);
862 unset_color(treescrn2);
864 wrefresh(treescrn2);
865 wrefresh(w_del_msg);
866 return (0);
869 static int
870 strng3(void)
872 wattrset(treescrn2, A_BOLD | A_BLINK);
873 set_color(treescrn2, COLOR_WHITE);
875 mvwaddch(treescrn2, 7, 16, (chtype) '\'');
876 mvwaddch(treescrn2, 7, 15, (chtype) ':');
877 mvwaddch(treescrn2, 7, 14, (chtype) '.');
878 mvwaddch(treescrn2, 7, 13, (chtype) ',');
879 mvwaddch(treescrn2, 8, 12, (chtype) '\'');
880 mvwaddch(treescrn2, 8, 11, (chtype) ':');
881 mvwaddch(treescrn2, 8, 10, (chtype) '.');
882 mvwaddch(treescrn2, 8, 9, (chtype) ',');
884 wattroff(treescrn2, A_BOLD | A_BLINK);
885 unset_color(treescrn2);
887 wrefresh(treescrn2);
888 wrefresh(w_del_msg);
889 return (0);
892 static int
893 strng4(void)
895 wattrset(treescrn2, A_BOLD | A_BLINK);
896 set_color(treescrn2, COLOR_WHITE);
898 mvwaddch(treescrn2, 9, 17, (chtype) '\'');
899 mvwaddch(treescrn2, 9, 16, (chtype) ':');
900 mvwaddch(treescrn2, 9, 15, (chtype) '.');
901 mvwaddch(treescrn2, 9, 14, (chtype) ',');
902 mvwaddch(treescrn2, 10, 13, (chtype) '\'');
903 mvwaddch(treescrn2, 10, 12, (chtype) ':');
904 mvwaddch(treescrn2, 10, 11, (chtype) '.');
905 mvwaddch(treescrn2, 10, 10, (chtype) ',');
906 mvwaddch(treescrn2, 11, 9, (chtype) '\'');
907 mvwaddch(treescrn2, 11, 8, (chtype) ':');
908 mvwaddch(treescrn2, 11, 7, (chtype) '.');
909 mvwaddch(treescrn2, 11, 6, (chtype) ',');
910 mvwaddch(treescrn2, 12, 5, (chtype) '\'');
912 wattroff(treescrn2, A_BOLD | A_BLINK);
913 unset_color(treescrn2);
915 wrefresh(treescrn2);
916 wrefresh(w_del_msg);
917 return (0);
920 static int
921 strng5(void)
923 wattrset(treescrn2, A_BOLD | A_BLINK);
924 set_color(treescrn2, COLOR_WHITE);
926 mvwaddch(treescrn2, 11, 19, (chtype) '\'');
927 mvwaddch(treescrn2, 11, 18, (chtype) ':');
928 mvwaddch(treescrn2, 11, 17, (chtype) '.');
929 mvwaddch(treescrn2, 11, 16, (chtype) ',');
930 mvwaddch(treescrn2, 12, 15, (chtype) '\'');
931 mvwaddch(treescrn2, 12, 14, (chtype) ':');
932 mvwaddch(treescrn2, 12, 13, (chtype) '.');
933 mvwaddch(treescrn2, 12, 12, (chtype) ',');
935 wattroff(treescrn2, A_BOLD | A_BLINK);
936 unset_color(treescrn2);
938 /* save a fully lit tree */
939 overlay(treescrn2, treescrn);
941 wrefresh(treescrn2);
942 wrefresh(w_del_msg);
943 return (0);
946 static int
947 blinkit(void)
949 static int cycle;
951 if (cycle > 4) {
952 cycle = 0;
955 touchwin(treescrn8);
957 switch (cycle) {
958 case 0:
959 overlay(treescrn3, treescrn8);
960 wrefresh(treescrn8);
961 wrefresh(w_del_msg);
962 break;
963 case 1:
964 overlay(treescrn4, treescrn8);
965 wrefresh(treescrn8);
966 wrefresh(w_del_msg);
967 break;
968 case 2:
969 overlay(treescrn5, treescrn8);
970 wrefresh(treescrn8);
971 wrefresh(w_del_msg);
972 break;
973 case 3:
974 overlay(treescrn6, treescrn8);
975 wrefresh(treescrn8);
976 wrefresh(w_del_msg);
977 break;
978 case 4:
979 overlay(treescrn7, treescrn8);
980 wrefresh(treescrn8);
981 wrefresh(w_del_msg);
982 break;
984 touchwin(treescrn8);
986 /*ALL ON************************************************** */
988 overlay(treescrn, treescrn8);
989 wrefresh(treescrn8);
990 wrefresh(w_del_msg);
992 ++cycle;
993 return (0);
996 static void
997 deer_step(WINDOW *win, int y, int x)
999 mvwin(win, y, x);
1000 wrefresh(win);
1001 wrefresh(w_del_msg);
1002 look_out(5);
1005 static int
1006 reindeer(void)
1008 int looper;
1009 y_pos = 0;
1011 for (x_pos = 70; x_pos > 62; x_pos--) {
1012 if (x_pos < 62) {
1013 y_pos = 1;
1015 for (looper = 0; looper < 4; looper++) {
1016 mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '.');
1017 wrefresh(dotdeer0);
1018 wrefresh(w_del_msg);
1019 werase(dotdeer0);
1020 wrefresh(dotdeer0);
1021 wrefresh(w_del_msg);
1022 look_out(50);
1026 y_pos = 2;
1028 for (; x_pos > 50; x_pos--) {
1029 for (looper = 0; looper < 4; looper++) {
1031 if (x_pos < 56) {
1032 y_pos = 3;
1034 mvwaddch(stardeer0, y_pos, x_pos, (chtype) '*');
1035 wrefresh(stardeer0);
1036 wrefresh(w_del_msg);
1037 werase(stardeer0);
1038 wrefresh(stardeer0);
1039 wrefresh(w_del_msg);
1040 } else {
1041 mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '*');
1042 wrefresh(dotdeer0);
1043 wrefresh(w_del_msg);
1044 werase(dotdeer0);
1045 wrefresh(dotdeer0);
1046 wrefresh(w_del_msg);
1051 x_pos = 58;
1053 for (y_pos = 2; y_pos < 5; y_pos++) {
1055 touchwin(lildeer0);
1056 wrefresh(lildeer0);
1057 wrefresh(w_del_msg);
1059 for (looper = 0; looper < 4; looper++) {
1060 deer_step(lildeer3, y_pos, x_pos);
1061 deer_step(lildeer2, y_pos, x_pos);
1062 deer_step(lildeer1, y_pos, x_pos);
1063 deer_step(lildeer2, y_pos, x_pos);
1064 deer_step(lildeer3, y_pos, x_pos);
1066 touchwin(lildeer0);
1067 wrefresh(lildeer0);
1068 wrefresh(w_del_msg);
1070 x_pos -= 2;
1074 x_pos = 35;
1076 for (y_pos = 5; y_pos < 10; y_pos++) {
1078 touchwin(middeer0);
1079 wrefresh(middeer0);
1080 wrefresh(w_del_msg);
1082 for (looper = 0; looper < 2; looper++) {
1083 deer_step(middeer3, y_pos, x_pos);
1084 deer_step(middeer2, y_pos, x_pos);
1085 deer_step(middeer1, y_pos, x_pos);
1086 deer_step(middeer2, y_pos, x_pos);
1087 deer_step(middeer3, y_pos, x_pos);
1089 touchwin(middeer0);
1090 wrefresh(middeer0);
1091 wrefresh(w_del_msg);
1093 x_pos -= 3;
1097 look_out(300);
1099 y_pos = 1;
1101 for (x_pos = 8; x_pos < 16; x_pos++) {
1102 deer_step(bigdeer4, y_pos, x_pos);
1103 deer_step(bigdeer3, y_pos, x_pos);
1104 deer_step(bigdeer2, y_pos, x_pos);
1105 deer_step(bigdeer1, y_pos, x_pos);
1106 deer_step(bigdeer2, y_pos, x_pos);
1107 deer_step(bigdeer3, y_pos, x_pos);
1108 deer_step(bigdeer4, y_pos, x_pos);
1109 deer_step(bigdeer0, y_pos, x_pos);
1112 --x_pos;
1114 for (looper = 0; looper < 6; looper++) {
1115 deer_step(lookdeer4, y_pos, x_pos);
1116 deer_step(lookdeer3, y_pos, x_pos);
1117 deer_step(lookdeer2, y_pos, x_pos);
1118 deer_step(lookdeer1, y_pos, x_pos);
1119 deer_step(lookdeer2, y_pos, x_pos);
1120 deer_step(lookdeer3, y_pos, x_pos);
1121 deer_step(lookdeer4, y_pos, x_pos);
1124 deer_step(lookdeer0, y_pos, x_pos);
1126 for (; y_pos < 10; y_pos++) {
1127 for (looper = 0; looper < 2; looper++) {
1128 deer_step(bigdeer4, y_pos, x_pos);
1129 deer_step(bigdeer3, y_pos, x_pos);
1130 deer_step(bigdeer2, y_pos, x_pos);
1131 deer_step(bigdeer1, y_pos, x_pos);
1132 deer_step(bigdeer2, y_pos, x_pos);
1133 deer_step(bigdeer3, y_pos, x_pos);
1134 deer_step(bigdeer4, y_pos, x_pos);
1136 deer_step(bigdeer0, y_pos, x_pos);
1139 --y_pos;
1141 deer_step(lookdeer3, y_pos, x_pos);
1142 return (0);
1145 static RETSIGTYPE
1146 done(int sig GCC_UNUSED)
1148 signal(SIGINT, done);
1149 signal(SIGTERM, done);
1150 #if !defined DOS && !defined OS2
1151 signal(SIGHUP, done);
1152 signal(SIGQUIT, done);
1153 #endif
1154 move(LINES - 1, 0);
1155 refresh();
1156 endwin();
1157 curs_set(1);
1158 ExitProgram(EXIT_SUCCESS);