diff options
Diffstat (limited to 'contrib/ncurses/test')
-rw-r--r-- | contrib/ncurses/test/cardfile.c | 10 | ||||
-rwxr-xr-x | contrib/ncurses/test/configure | 95 | ||||
-rw-r--r-- | contrib/ncurses/test/configure.in | 9 | ||||
-rw-r--r-- | contrib/ncurses/test/filter.c | 92 | ||||
-rw-r--r-- | contrib/ncurses/test/firework.c | 4 | ||||
-rw-r--r-- | contrib/ncurses/test/gdc.c | 4 | ||||
-rw-r--r-- | contrib/ncurses/test/hanoi.c | 375 | ||||
-rw-r--r-- | contrib/ncurses/test/hashtest.c | 3 | ||||
-rw-r--r-- | contrib/ncurses/test/knight.c | 726 | ||||
-rw-r--r-- | contrib/ncurses/test/ncurses.c | 353 | ||||
-rw-r--r-- | contrib/ncurses/test/railroad.c | 80 | ||||
-rw-r--r-- | contrib/ncurses/test/rain.c | 4 | ||||
-rw-r--r-- | contrib/ncurses/test/tclock.c | 2 | ||||
-rw-r--r-- | contrib/ncurses/test/test.priv.h | 29 | ||||
-rw-r--r-- | contrib/ncurses/test/view.c | 6 | ||||
-rw-r--r-- | contrib/ncurses/test/worm.c | 4 | ||||
-rw-r--r-- | contrib/ncurses/test/xmas.c | 1642 |
17 files changed, 1817 insertions, 1621 deletions
diff --git a/contrib/ncurses/test/cardfile.c b/contrib/ncurses/test/cardfile.c index 980ffbe..75d2077 100644 --- a/contrib/ncurses/test/cardfile.c +++ b/contrib/ncurses/test/cardfile.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 1999 * - * $Id: cardfile.c,v 1.4 2000/03/19 01:34:00 tom Exp $ + * $Id: cardfile.c,v 1.5 2000/09/09 19:08:32 tom Exp $ * * File format: text beginning in column 1 is a title; other text forms the content. */ @@ -72,8 +72,8 @@ strdup(char *s) } #endif /* not HAVE_STRDUP */ -static char * -skip(char *buffer) +static const char * +skip(const char *buffer) { while (isspace(*buffer)) buffer++; @@ -119,7 +119,7 @@ add_title(const char *title) } static void -add_content(CARD * card, char *content) +add_content(CARD * card, const char *content) { unsigned total, offset; @@ -359,7 +359,7 @@ cardfile(char *fname) doupdate(); switch (form_driver(top_card->form, ch = - form_virtualize(panel_window(top_card->panel)))) { + form_virtualize(panel_window(top_card->panel)))) { case E_OK: break; case E_UNKNOWN_COMMAND: diff --git a/contrib/ncurses/test/configure b/contrib/ncurses/test/configure index 2266114..e27f5ef 100755 --- a/contrib/ncurses/test/configure +++ b/contrib/ncurses/test/configure @@ -886,6 +886,7 @@ fi if test -f $p/include/ncurses/curses.h then CPPFLAGS="$CPPFLAGS -I$p/include/ncurses" + test $p != /usr && CPPFLAGS="$CPPFLAGS -I$p/include" test $p != /usr && LIBS="-L$p/lib $LIBS" break elif test $p != /usr @@ -907,12 +908,12 @@ fi echo $ac_n "checking for initscr""... $ac_c" 1>&6 -echo "configure:911: checking for initscr" >&5 +echo "configure:912: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 916 "configure" +#line 917 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char initscr(); below. */ @@ -935,7 +936,7 @@ initscr(); ; return 0; } EOF -if { (eval echo configure:939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else @@ -954,7 +955,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for initscr in -l$LIB_NAME""... $ac_c" 1>&6 -echo "configure:958: checking for initscr in -l$LIB_NAME" >&5 +echo "configure:959: checking for initscr in -l$LIB_NAME" >&5 ac_lib_var=`echo $LIB_NAME'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -962,7 +963,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$LIB_NAME $LIBS" cat > conftest.$ac_ext <<EOF -#line 966 "configure" +#line 967 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -973,7 +974,7 @@ int main() { initscr() ; return 0; } EOF -if { (eval echo configure:977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1003,7 +1004,7 @@ fi fi echo $ac_n "checking for form_driver in -lform""... $ac_c" 1>&6 -echo "configure:1007: checking for form_driver in -lform" >&5 +echo "configure:1008: checking for form_driver in -lform" >&5 ac_lib_var=`echo form'_'form_driver | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1011,7 +1012,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lform $LIBS" cat > conftest.$ac_ext <<EOF -#line 1015 "configure" +#line 1016 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1022,7 +1023,7 @@ int main() { form_driver() ; return 0; } EOF -if { (eval echo configure:1026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1050,7 +1051,7 @@ else fi echo $ac_n "checking for menu_driver in -lmenu""... $ac_c" 1>&6 -echo "configure:1054: checking for menu_driver in -lmenu" >&5 +echo "configure:1055: checking for menu_driver in -lmenu" >&5 ac_lib_var=`echo menu'_'menu_driver | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1058,7 +1059,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmenu $LIBS" cat > conftest.$ac_ext <<EOF -#line 1062 "configure" +#line 1063 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1069,7 +1070,7 @@ int main() { menu_driver() ; return 0; } EOF -if { (eval echo configure:1073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1097,7 +1098,7 @@ else fi echo $ac_n "checking for new_panel in -lpanel""... $ac_c" 1>&6 -echo "configure:1101: checking for new_panel in -lpanel" >&5 +echo "configure:1102: checking for new_panel in -lpanel" >&5 ac_lib_var=`echo panel'_'new_panel | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1105,7 +1106,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpanel $LIBS" cat > conftest.$ac_ext <<EOF -#line 1109 "configure" +#line 1110 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1116,7 +1117,7 @@ int main() { new_panel() ; return 0; } EOF -if { (eval echo configure:1120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1145,12 +1146,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1149: checking return type of signal handlers" >&5 +echo "configure:1150: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1154 "configure" +#line 1155 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1167,7 +1168,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1171: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1172: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1187,7 +1188,7 @@ EOF echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1191: checking how to run the C preprocessor" >&5 +echo "configure:1192: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1202,13 +1203,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1206 "configure" +#line 1207 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1213: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1219,13 +1220,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1223 "configure" +#line 1224 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1230: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1236,13 +1237,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1240 "configure" +#line 1241 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1267,12 +1268,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1271: checking for ANSI C header files" >&5 +echo "configure:1272: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1276 "configure" +#line 1277 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1280,7 +1281,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1297,7 +1298,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1301 "configure" +#line 1302 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1315,7 +1316,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1319 "configure" +#line 1320 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1336,7 +1337,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1340 "configure" +#line 1341 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1347,7 +1348,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1371,12 +1372,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1375: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1376: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1380 "configure" +#line 1381 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -1385,7 +1386,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1389: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1390: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1420,17 +1421,17 @@ unistd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1424: checking for $ac_hdr" >&5 +echo "configure:1425: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1429 "configure" +#line 1430 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1434: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1468,12 +1469,12 @@ wresize \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1472: checking for $ac_func" >&5 +echo "configure:1473: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1477 "configure" +#line 1478 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1496,7 +1497,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1522,7 +1523,7 @@ done echo $ac_n "checking for function curses_version""... $ac_c" 1>&6 -echo "configure:1526: checking for function curses_version" >&5 +echo "configure:1527: checking for function curses_version" >&5 if eval "test \"`echo '$''{'cf_cv_func_curses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1531,7 +1532,7 @@ if test "$cross_compiling" = yes; then cf_cv_func_curses_version=unknown else cat > conftest.$ac_ext <<EOF -#line 1535 "configure" +#line 1536 "configure" #include "confdefs.h" #include <curses.h> @@ -1543,7 +1544,7 @@ int main() } EOF -if { (eval echo configure:1547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_func_curses_version=yes @@ -1567,13 +1568,13 @@ EOF echo $ac_n "checking if sys/time.h conflicts with sys/select.h""... $ac_c" 1>&6 -echo "configure:1571: checking if sys/time.h conflicts with sys/select.h" >&5 +echo "configure:1572: checking if sys/time.h conflicts with sys/select.h" >&5 if eval "test \"`echo '$''{'cf_cv_sys_time_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1577 "configure" +#line 1578 "configure" #include "confdefs.h" #if HAVE_SYS_TIME_H @@ -1587,7 +1588,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sys_time_select=yes else diff --git a/contrib/ncurses/test/configure.in b/contrib/ncurses/test/configure.in index 35e2b47..3399932 100644 --- a/contrib/ncurses/test/configure.in +++ b/contrib/ncurses/test/configure.in @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 1998,1999 Free Software Foundation, Inc. * +dnl Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -26,9 +26,9 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl Author: Thomas E. Dickey <dickey@clark.net> 1996,1997,1998 +dnl Author: Thomas E. Dickey 1996,1997,1998,2000 dnl -dnl $Id: configure.in,v 1.29 1999/12/19 03:12:13 tom Exp $ +dnl $Id: configure.in,v 1.30 2000/08/12 22:43:08 tom Exp $ dnl This is a simple configuration-script for the ncurses test programs that dnl allows the test-directory to be separately configured against a reference dnl system (i.e., sysvr4 curses) @@ -36,7 +36,7 @@ dnl dnl If you're configuring ncurses, you shouldn't need to use this script. dnl It's only for testing purposes. dnl -dnl dickey@clark.net (Thomas Dickey) +dnl dickey@herndon4.his.com (Thomas Dickey) AC_PREREQ(2.12) AC_INIT(ncurses.c) AC_CONFIG_HEADER(ncurses_cfg.h:ncurses_tst.hin) @@ -86,6 +86,7 @@ AC_ARG_WITH(ncurses, if test -f $p/include/ncurses/curses.h then CPPFLAGS="$CPPFLAGS -I$p/include/ncurses" + test $p != /usr && CPPFLAGS="$CPPFLAGS -I$p/include" test $p != /usr && LIBS="-L$p/lib $LIBS" break elif test $p != /usr diff --git a/contrib/ncurses/test/filter.c b/contrib/ncurses/test/filter.c index 5d161cb..272f372 100644 --- a/contrib/ncurses/test/filter.c +++ b/contrib/ncurses/test/filter.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 1998 * - * $Id: filter.c,v 1.3 1999/11/13 23:39:19 tom Exp $ + * $Id: filter.c,v 1.4 2000/09/02 18:50:38 tom Exp $ */ #include <test.priv.h> @@ -50,60 +50,60 @@ #define getnstr(s,n) getstr(s) #endif -static int new_command(char *buffer, int length, attr_t underline) +static int +new_command(char *buffer, int length, attr_t underline) { - int code; + int code; - attron(A_BOLD); - printw("Command: "); - attron(underline); - code = getnstr(buffer, length); - attroff(underline); - attroff(A_BOLD); - printw("\n"); + attron(A_BOLD); + printw("Command: "); + attron(underline); + code = getnstr(buffer, length); + attroff(underline); + attroff(A_BOLD); + printw("\n"); - return code; + return code; } -int main( - int argc GCC_UNUSED, - char *argv[] GCC_UNUSED) +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - SCREEN *sp; - char buffer[80]; - attr_t underline; + SCREEN *sp; + char buffer[80]; + attr_t underline; - filter(); - sp = newterm((char *)0, stdout, stdin); - cbreak(); - keypad(stdscr, TRUE); + filter(); + sp = newterm((char *) 0, stdout, stdin); + cbreak(); + keypad(stdscr, TRUE); - if (has_colors()) { - int background = COLOR_BLACK; - start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS - if (use_default_colors () != ERR) - background = -1; + if (has_colors()) { + int background = COLOR_BLACK; + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (use_default_colors() != ERR) + background = -1; #endif - init_pair(1, COLOR_CYAN, background); - underline = COLOR_PAIR(1); - } else { - underline = A_UNDERLINE; - } + init_pair(1, COLOR_CYAN, background); + underline = COLOR_PAIR(1); + } else { + underline = A_UNDERLINE; + } - while (new_command(buffer, sizeof(buffer)-1, underline) != ERR - && strlen(buffer) != 0) { - reset_shell_mode(); - printf("\n"); - fflush(stdout); - system(buffer); - reset_prog_mode(); - touchwin(stdscr); - erase(); - refresh(); - } - printw("done"); + while (new_command(buffer, sizeof(buffer) - 1, underline) != ERR + && strlen(buffer) != 0) { + reset_shell_mode(); + printf("\n"); + fflush(stdout); + system(buffer); + reset_prog_mode(); + touchwin(stdscr); + erase(); refresh(); - endwin(); - return 0; + } + printw("done"); + refresh(); + endwin(); + return 0; } diff --git a/contrib/ncurses/test/firework.c b/contrib/ncurses/test/firework.c index ba5cbda..66c1227 100644 --- a/contrib/ncurses/test/firework.c +++ b/contrib/ncurses/test/firework.c @@ -1,5 +1,5 @@ /* - * $Id: firework.c,v 1.16 1999/11/13 23:39:16 tom Exp $ + * $Id: firework.c,v 1.17 2000/09/02 18:41:12 tom Exp $ */ #include <test.priv.h> @@ -133,7 +133,7 @@ main( if (has_colors()) { start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS +#if HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) my_bg = -1; #endif diff --git a/contrib/ncurses/test/gdc.c b/contrib/ncurses/test/gdc.c index ea88d6c..df9a0c3 100644 --- a/contrib/ncurses/test/gdc.c +++ b/contrib/ncurses/test/gdc.c @@ -6,7 +6,7 @@ * modified 10-18-89 for curses (jrl) * 10-18-89 added signal handling * - * $Id: gdc.c,v 1.14 2000/04/23 00:03:11 tom Exp $ + * $Id: gdc.c,v 1.15 2000/09/02 18:40:39 tom Exp $ */ #include <test.priv.h> @@ -179,7 +179,7 @@ main(int argc, char *argv[]) if (hascolor) { int bg = COLOR_BLACK; start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS +#if HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif diff --git a/contrib/ncurses/test/hanoi.c b/contrib/ncurses/test/hanoi.c index 23a8646..0b032f8 100644 --- a/contrib/ncurses/test/hanoi.c +++ b/contrib/ncurses/test/hanoi.c @@ -14,7 +14,7 @@ * * Date: 05.Nov.90 * - * $Id: hanoi.c,v 1.18 2000/04/01 20:01:08 tom Exp $ + * $Id: hanoi.c,v 1.19 2000/09/02 18:51:16 tom Exp $ */ #include <test.priv.h> @@ -36,22 +36,24 @@ #define OTHER(a,b) (3-((a)+(b))) struct Peg { - size_t Length[MAXTILES]; - int Count; + size_t Length[MAXTILES]; + int Count; }; static struct Peg Pegs[NPEGS]; -static int PegPos[] = { LEFTPEG, MIDPEG, RIGHTPEG }; -static int TileColour[] = { - COLOR_GREEN, /* Length 3 */ - COLOR_MAGENTA, /* Length 5 */ - COLOR_RED, /* Length 7 */ - COLOR_BLUE, /* Length 9 */ - COLOR_CYAN, /* Length 11 */ - COLOR_YELLOW, /* Length 13 */ - COLOR_GREEN, /* Length 15 */ - COLOR_MAGENTA, /* Length 17 */ - COLOR_RED, /* Length 19 */ +static int PegPos[] = +{LEFTPEG, MIDPEG, RIGHTPEG}; +static int TileColour[] = +{ + COLOR_GREEN, /* Length 3 */ + COLOR_MAGENTA, /* Length 5 */ + COLOR_RED, /* Length 7 */ + COLOR_BLUE, /* Length 9 */ + COLOR_CYAN, /* Length 11 */ + COLOR_YELLOW, /* Length 13 */ + COLOR_GREEN, /* Length 15 */ + COLOR_MAGENTA, /* Length 17 */ + COLOR_RED, /* Length 19 */ }; static int NMoves = 0; @@ -67,232 +69,235 @@ static int InvalidMove(int From, int To); int main(int argc, char **argv) { -int NTiles, FromCol, ToCol; -unsigned char AutoFlag = 0; + int NTiles, FromCol, ToCol; + unsigned char AutoFlag = 0; - switch(argc) { - case 1: - NTiles = DEFAULTTILES; - break; - case 2: - NTiles = atoi(argv[1]); - if (NTiles > MAXTILES || NTiles < MINTILES) { - fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); - return EXIT_FAILURE; - } - break; - case 3: - if (strcmp(argv[2], "a")) { - Usage(); - return EXIT_FAILURE; - } - NTiles = atoi(argv[1]); - if (NTiles > MAXTILES || NTiles < MINTILES) { - fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); - return EXIT_FAILURE; - } - AutoFlag = TRUE; - break; - default: - Usage(); - return EXIT_FAILURE; + switch (argc) { + case 1: + NTiles = DEFAULTTILES; + break; + case 2: + NTiles = atoi(argv[1]); + if (NTiles > MAXTILES || NTiles < MINTILES) { + fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); + return EXIT_FAILURE; + } + break; + case 3: + if (strcmp(argv[2], "a")) { + Usage(); + return EXIT_FAILURE; } + NTiles = atoi(argv[1]); + if (NTiles > MAXTILES || NTiles < MINTILES) { + fprintf(stderr, "Range %d to %d\n", MINTILES, MAXTILES); + return EXIT_FAILURE; + } + AutoFlag = TRUE; + break; + default: + Usage(); + return EXIT_FAILURE; + } #ifdef TRACE - trace(TRACE_MAXIMUM); + trace(TRACE_MAXIMUM); #endif - initscr(); - if (has_colors()) { - int i; - int bg = COLOR_BLACK; - start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) - bg = -1; + initscr(); + if (has_colors()) { + int i; + int bg = COLOR_BLACK; + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (use_default_colors() == OK) + bg = -1; #endif - for (i = 0; i < 9; i++) - init_pair(i+1, bg, TileColour[i]); - } - cbreak(); - if (LINES < 24) { - endwin(); - fprintf(stderr, "Min screen length 24 lines\n"); - return EXIT_FAILURE; - } - if(AutoFlag) { - curs_set(0); - leaveok(stdscr, TRUE); /* Attempt to remove cursor */ - } - InitTiles(NTiles); - DisplayTiles(); - if(AutoFlag) { - do { - noecho(); - AutoMove(0, 2, NTiles); - } while(!Solved(NTiles)); - sleep(2); - } else { - echo(); - for(;;) { - if(GetMove(&FromCol, &ToCol)) - break; - if(InvalidMove(FromCol, ToCol)) { - mvaddstr(STATUSLINE, 0, "Invalid Move !!"); - refresh(); - beep(); - continue; - } - MakeMove(FromCol, ToCol); - if(Solved(NTiles)) { - mvprintw(STATUSLINE, 0, "Well Done !! You did it in %d moves", NMoves); - refresh(); - sleep(5); - break; - } - } - } + for (i = 0; i < 9; i++) + init_pair(i + 1, bg, TileColour[i]); + } + cbreak(); + if (LINES < 24) { endwin(); - return EXIT_SUCCESS; + fprintf(stderr, "Min screen length 24 lines\n"); + return EXIT_FAILURE; + } + if (AutoFlag) { + curs_set(0); + leaveok(stdscr, TRUE); /* Attempt to remove cursor */ + } + InitTiles(NTiles); + DisplayTiles(); + if (AutoFlag) { + do { + noecho(); + AutoMove(0, 2, NTiles); + } while (!Solved(NTiles)); + sleep(2); + } else { + echo(); + for (;;) { + if (GetMove(&FromCol, &ToCol)) + break; + if (InvalidMove(FromCol, ToCol)) { + mvaddstr(STATUSLINE, 0, "Invalid Move !!"); + refresh(); + beep(); + continue; + } + MakeMove(FromCol, ToCol); + if (Solved(NTiles)) { + mvprintw(STATUSLINE, 0, + "Well Done !! You did it in %d moves", NMoves); + refresh(); + sleep(5); + break; + } + } + } + endwin(); + return EXIT_SUCCESS; } static int InvalidMove(int From, int To) { - if(From >= NPEGS) - return TRUE; - if(From < 0) - return TRUE; - if(To >= NPEGS) - return TRUE; - if(To < 0) - return TRUE; - if(From == To) - return TRUE; - if(!Pegs[From].Count) - return TRUE; - if(Pegs[To].Count && - Pegs[From].Length[Pegs[From].Count-1] > - Pegs[To].Length[Pegs[To].Count-1]) - return TRUE; - return FALSE; + if (From >= NPEGS) + return TRUE; + if (From < 0) + return TRUE; + if (To >= NPEGS) + return TRUE; + if (To < 0) + return TRUE; + if (From == To) + return TRUE; + if (!Pegs[From].Count) + return TRUE; + if (Pegs[To].Count && + Pegs[From].Length[Pegs[From].Count - 1] > + Pegs[To].Length[Pegs[To].Count - 1]) + return TRUE; + return FALSE; } static void InitTiles(int NTiles) { - int Size, SlotNo; + int Size, SlotNo; - for(Size=NTiles*2+1, SlotNo=0; Size>=3; Size-=2) - Pegs[0].Length[SlotNo++] = Size; + for (Size = NTiles * 2 + 1, SlotNo = 0; Size >= 3; Size -= 2) + Pegs[0].Length[SlotNo++] = Size; - Pegs[0].Count = NTiles; - Pegs[1].Count = 0; - Pegs[2].Count = 0; + Pegs[0].Count = NTiles; + Pegs[1].Count = 0; + Pegs[2].Count = 0; } static void DisplayTiles(void) { - int Line, peg, SlotNo; - char TileBuf[BUFSIZ]; + int Line, peg, SlotNo; + char TileBuf[BUFSIZ]; - erase(); - mvaddstr(1, 24, "T O W E R S O F H A N O I"); - mvaddstr(3, 34, "SJR 1990"); - mvprintw(19, 5, "Moves : %d", NMoves); - attrset(A_REVERSE); - mvaddstr(BASELINE, 8, " "); + erase(); + mvaddstr(1, 24, "T O W E R S O F H A N O I"); + mvaddstr(3, 34, "SJR 1990"); + mvprintw(19, 5, "Moves : %d", NMoves); + attrset(A_REVERSE); + mvaddstr(BASELINE, 8, + " "); - for(Line=TOPLINE; Line<BASELINE; Line++) { - mvaddch(Line, LEFTPEG, ' '); - mvaddch(Line, MIDPEG, ' '); - mvaddch(Line, RIGHTPEG, ' '); - } - mvaddch(BASELINE, LEFTPEG, '1'); - mvaddch(BASELINE, MIDPEG, '2'); - mvaddch(BASELINE, RIGHTPEG, '3'); - attrset(A_NORMAL); + for (Line = TOPLINE; Line < BASELINE; Line++) { + mvaddch(Line, LEFTPEG, ' '); + mvaddch(Line, MIDPEG, ' '); + mvaddch(Line, RIGHTPEG, ' '); + } + mvaddch(BASELINE, LEFTPEG, '1'); + mvaddch(BASELINE, MIDPEG, '2'); + mvaddch(BASELINE, RIGHTPEG, '3'); + attrset(A_NORMAL); - /* Draw tiles */ - for(peg=0; peg<NPEGS; peg++) { - for(SlotNo=0; SlotNo<Pegs[peg].Count; SlotNo++) { - memset(TileBuf, ' ', Pegs[peg].Length[SlotNo]); - TileBuf[Pegs[peg].Length[SlotNo]] = '\0'; - if (has_colors()) - attrset(COLOR_PAIR(LENTOIND(Pegs[peg].Length[SlotNo]))); - else - attrset(A_REVERSE); - mvaddstr(BASELINE-(SlotNo+1), - (int)(PegPos[peg] - Pegs[peg].Length[SlotNo]/2), - TileBuf); - } + /* Draw tiles */ + for (peg = 0; peg < NPEGS; peg++) { + for (SlotNo = 0; SlotNo < Pegs[peg].Count; SlotNo++) { + memset(TileBuf, ' ', Pegs[peg].Length[SlotNo]); + TileBuf[Pegs[peg].Length[SlotNo]] = '\0'; + if (has_colors()) + attrset(COLOR_PAIR(LENTOIND(Pegs[peg].Length[SlotNo]))); + else + attrset(A_REVERSE); + mvaddstr(BASELINE - (SlotNo + 1), + (int) (PegPos[peg] - Pegs[peg].Length[SlotNo] / 2), + TileBuf); } - attrset(A_NORMAL); - refresh(); + } + attrset(A_NORMAL); + refresh(); } static int GetMove(int *From, int *To) { - mvaddstr(STATUSLINE, 0, "Next move ('q' to quit) from "); - clrtoeol(); - refresh(); - if((*From = getch()) == 'q') - return TRUE; - *From -= ('0'+1); - addstr(" to "); - clrtoeol(); - refresh(); + mvaddstr(STATUSLINE, 0, "Next move ('q' to quit) from "); + clrtoeol(); + refresh(); + if ((*From = getch()) == 'q') + return TRUE; + *From -= ('0' + 1); + addstr(" to "); + clrtoeol(); + refresh(); - if((*To = getch()) == 'q') - return TRUE; - *To -= ('0'+1); - refresh(); - napms(500); + if ((*To = getch()) == 'q') + return TRUE; + *To -= ('0' + 1); + refresh(); + napms(500); - move(STATUSLINE, 0); - clrtoeol(); - refresh(); - return FALSE; + move(STATUSLINE, 0); + clrtoeol(); + refresh(); + return FALSE; } static void MakeMove(int From, int To) { - Pegs[From].Count--; - Pegs[To].Length[Pegs[To].Count] = Pegs[From].Length[Pegs[From].Count]; - Pegs[To].Count++; - NMoves++; - DisplayTiles(); + Pegs[From].Count--; + Pegs[To].Length[Pegs[To].Count] = Pegs[From].Length[Pegs[From].Count]; + Pegs[To].Count++; + NMoves++; + DisplayTiles(); } static void AutoMove(int From, int To, int Num) { - if(Num == 1) { - MakeMove(From, To); - napms(500); - return; - } - AutoMove(From, OTHER(From, To), Num-1); + if (Num == 1) { MakeMove(From, To); napms(500); - AutoMove(OTHER(From, To), To, Num-1); + return; + } + AutoMove(From, OTHER(From, To), Num - 1); + MakeMove(From, To); + napms(500); + AutoMove(OTHER(From, To), To, Num - 1); } static int Solved(int NumTiles) { - int i; + int i; - for(i = 1; i < NPEGS; i++) - if (Pegs[i].Count == NumTiles) - return TRUE; - return FALSE; + for (i = 1; i < NPEGS; i++) + if (Pegs[i].Count == NumTiles) + return TRUE; + return FALSE; } static void Usage() { - fprintf(stderr, "Usage: hanoi [<No Of Tiles>] [a]\n"); - fprintf(stderr, "The 'a' option causes the tower to be solved automatically\n"); + fprintf(stderr, "Usage: hanoi [<No Of Tiles>] [a]\n"); + fprintf(stderr, + "The 'a' option causes the tower to be solved automatically\n"); } diff --git a/contrib/ncurses/test/hashtest.c b/contrib/ncurses/test/hashtest.c index 514ac89..52e5c21 100644 --- a/contrib/ncurses/test/hashtest.c +++ b/contrib/ncurses/test/hashtest.c @@ -3,7 +3,7 @@ * * Generate timing statistics for vertical-motion optimization. * - * $Id: hashtest.c,v 1.14 1998/06/13 22:45:39 tom Exp $ + * $Id: hashtest.c,v 1.15 2000/09/02 19:23:33 tom Exp $ */ #ifdef TRACE @@ -11,6 +11,7 @@ #define USE_TRACE 1 #else #define Trace(p) /* nothing */ +#define USE_TRACE 0 #endif #include <test.priv.h> diff --git a/contrib/ncurses/test/knight.c b/contrib/ncurses/test/knight.c index ad923b4..0729d49 100644 --- a/contrib/ncurses/test/knight.c +++ b/contrib/ncurses/test/knight.c @@ -6,7 +6,7 @@ * Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support * added September 20th 1995. * - * $Id: knight.c,v 1.15 1999/11/13 23:39:10 tom Exp $ + * $Id: knight.c,v 1.17 2000/09/02 18:48:19 tom Exp $ */ #include <test.priv.h> @@ -41,24 +41,22 @@ #define CXINV(x) (((x) - 1) / 4) #define CYINV(y) (((y) - 2) / 2) -typedef struct -{ - short x, y; -} -cell; - -static short board[BDEPTH][BWIDTH]; /* the squares */ -static int rw,col; /* current row and column */ -static int lastrow,lastcol; /* last location visited */ -static cell history[BDEPTH*BWIDTH]; /* choice history */ -static int movecount; /* count of moves so far */ -static WINDOW *boardwin; /* the board window */ -static WINDOW *helpwin; /* the help window */ -static WINDOW *msgwin; /* the message window */ -static chtype trail = '#'; /* trail character */ -static chtype plus = '+'; /* cursor hot-spot character */ -static chtype minus = '-'; /* possible-move character */ -static chtype oldch; +typedef struct { + short x, y; +} cell; + +static short board[BDEPTH][BWIDTH]; /* the squares */ +static int rw, col; /* current row and column */ +static int lastrow, lastcol; /* last location visited */ +static cell history[BDEPTH * BWIDTH]; /* choice history */ +static int movecount; /* count of moves so far */ +static WINDOW *boardwin; /* the board window */ +static WINDOW *helpwin; /* the help window */ +static WINDOW *msgwin; /* the message window */ +static chtype trail = '#'; /* trail character */ +static chtype plus = '+'; /* cursor hot-spot character */ +static chtype minus = '-'; /* possible-move character */ +static chtype oldch; static void init(void); static void play(void); @@ -67,11 +65,10 @@ static void drawmove(char, int, int, int, int); static bool evalmove(int, int); static bool chkmoves(void); static bool chksqr(int, int); -static int iabs(int); +static int iabs(int); -int main( - int argc GCC_UNUSED, - char *argv[] GCC_UNUSED) +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { init(); @@ -81,321 +78,324 @@ int main( return EXIT_SUCCESS; } -static void init (void) +static void +init(void) { - srand ((unsigned)getpid()); - initscr (); - cbreak (); /* immediate char return */ - noecho (); /* no immediate echo */ + srand((unsigned) getpid()); + initscr(); + cbreak(); /* immediate char return */ + noecho(); /* no immediate echo */ boardwin = newwin(BDEPTH * 2 + 1, BWIDTH * 4 + 1, BOARDY, BOARDX); helpwin = newwin(0, 0, INSTRY, INSTRX); - msgwin = newwin(1, INSTRX-1, NOTIFYY, 0); + msgwin = newwin(1, INSTRX - 1, NOTIFYY, 0); scrollok(msgwin, TRUE); keypad(boardwin, TRUE); - if (has_colors()) - { + if (has_colors()) { int bg = COLOR_BLACK; start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS +#if HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif - (void) init_pair(TRAIL_COLOR, COLOR_CYAN, bg); - (void) init_pair(PLUS_COLOR, COLOR_RED, bg); + (void) init_pair(TRAIL_COLOR, COLOR_CYAN, bg); + (void) init_pair(PLUS_COLOR, COLOR_RED, bg); (void) init_pair(MINUS_COLOR, COLOR_GREEN, bg); trail |= COLOR_PAIR(TRAIL_COLOR); - plus |= COLOR_PAIR(PLUS_COLOR); + plus |= COLOR_PAIR(PLUS_COLOR); minus |= COLOR_PAIR(MINUS_COLOR); } - #ifdef NCURSES_MOUSE_VERSION - (void) mousemask(BUTTON1_CLICKED, (mmask_t *)NULL); -#endif /* NCURSES_MOUSE_VERSION*/ + (void) mousemask(BUTTON1_CLICKED, (mmask_t *) NULL); +#endif /* NCURSES_MOUSE_VERSION */ oldch = minus; } -static void help1(void) +static void +help1(void) /* game explanation -- initial help screen */ { - (void)waddstr(helpwin, "Knight's move is a solitaire puzzle. Your\n"); - (void)waddstr(helpwin, "objective is to visit each square of the \n"); - (void)waddstr(helpwin, "chessboard exactly once by making knight's\n"); - (void)waddstr(helpwin, "moves (one square right or left followed \n"); - (void)waddstr(helpwin, "by two squares up or down, or two squares \n"); - (void)waddstr(helpwin, "right or left followed by one square up or\n"); - (void)waddstr(helpwin, "down). You may start anywhere.\n\n"); - - (void)waddstr(helpwin, "Use arrow keys to move the cursor around.\n"); - (void)waddstr(helpwin, "When you want to move your knight to the \n"); - (void)waddstr(helpwin, "cursor location, press <space> or Enter.\n"); - (void)waddstr(helpwin, "Illegal moves will be rejected with an \n"); - (void)waddstr(helpwin, "audible beep.\n\n"); - (void)waddstr(helpwin, "The program will detect if you solve the\n"); - (void)waddstr(helpwin, "puzzle; also inform you when you run out\n"); - (void)waddstr(helpwin, "of legal moves.\n\n"); - - (void)mvwaddstr(helpwin, NOTIFYY-INSTRY, 0, - "Press `?' to go to keystroke help."); + (void) waddstr(helpwin, "Knight's move is a solitaire puzzle. Your\n"); + (void) waddstr(helpwin, "objective is to visit each square of the \n"); + (void) waddstr(helpwin, "chessboard exactly once by making knight's\n"); + (void) waddstr(helpwin, "moves (one square right or left followed \n"); + (void) waddstr(helpwin, "by two squares up or down, or two squares \n"); + (void) waddstr(helpwin, "right or left followed by one square up or\n"); + (void) waddstr(helpwin, "down). You may start anywhere.\n\n"); + + (void) waddstr(helpwin, "Use arrow keys to move the cursor around.\n"); + (void) waddstr(helpwin, "When you want to move your knight to the \n"); + (void) waddstr(helpwin, "cursor location, press <space> or Enter.\n"); + (void) waddstr(helpwin, "Illegal moves will be rejected with an \n"); + (void) waddstr(helpwin, "audible beep.\n\n"); + (void) waddstr(helpwin, "The program will detect if you solve the\n"); + (void) waddstr(helpwin, "puzzle; also inform you when you run out\n"); + (void) waddstr(helpwin, "of legal moves.\n\n"); + + (void) mvwaddstr(helpwin, NOTIFYY - INSTRY, 0, + "Press `?' to go to keystroke help."); } -static void help2(void) +static void +help2(void) /* keystroke help screen */ { - (void)waddstr(helpwin, "Possible moves are shown with `-'.\n\n"); - - (void)waddstr(helpwin, "You can move around with the arrow keys or\n"); - (void)waddstr(helpwin, "with the rogue/hack movement keys. Other\n"); - (void)waddstr(helpwin, "commands allow you to undo moves or redraw.\n"); - (void)waddstr(helpwin, "Your mouse may work; try left-button to\n"); - (void)waddstr(helpwin, "move to the square under the pointer.\n\n"); - - (void)waddstr(helpwin, "x,q -- exit y k u 7 8 9\n"); - (void)waddstr(helpwin, "r -- redraw screen \\|/ \\|/ \n"); - (void)waddstr(helpwin, "u -- undo move h-+-l 4-+-6\n"); - (void)waddstr(helpwin, " /|\\ /|\\ \n"); - (void)waddstr(helpwin, " b j n 1 2 3\n"); - - (void)waddstr(helpwin,"\nYou can place your knight on the selected\n"); - (void)waddstr(helpwin, "square with spacebar, Enter, or the keypad\n"); - (void)waddstr(helpwin, "center key. You can quit with `x' or `q'.\n"); - - (void)mvwaddstr(helpwin, NOTIFYY-INSTRY, 0, - "Press `?' to go to game explanation"); + (void) waddstr(helpwin, "Possible moves are shown with `-'.\n\n"); + + (void) waddstr(helpwin, "You can move around with the arrow keys or\n"); + (void) waddstr(helpwin, "with the rogue/hack movement keys. Other\n"); + (void) waddstr(helpwin, "commands allow you to undo moves or redraw.\n"); + (void) waddstr(helpwin, "Your mouse may work; try left-button to\n"); + (void) waddstr(helpwin, "move to the square under the pointer.\n\n"); + + (void) waddstr(helpwin, "x,q -- exit y k u 7 8 9\n"); + (void) waddstr(helpwin, "r -- redraw screen \\|/ \\|/ \n"); + (void) waddstr(helpwin, "u -- undo move h-+-l 4-+-6\n"); + (void) waddstr(helpwin, " /|\\ /|\\ \n"); + (void) waddstr(helpwin, " b j n 1 2 3\n"); + + (void) waddstr(helpwin, "\nYou can place your knight on the selected\n"); + (void) waddstr(helpwin, "square with spacebar, Enter, or the keypad\n"); + (void) waddstr(helpwin, "center key. You can quit with `x' or `q'.\n"); + + (void) mvwaddstr(helpwin, NOTIFYY - INSTRY, 0, + "Press `?' to go to game explanation"); } -static void play (void) +static void +play(void) /* play the game */ { - bool keyhelp; /* TRUE if keystroke help is up */ - int c, ny = 0, nx = 0; + bool keyhelp; /* TRUE if keystroke help is up */ + int c, ny = 0, nx = 0; int i, j, count; do { - /* clear screen and draw board */ - werase(boardwin); - werase(helpwin); - werase(msgwin); - dosquares(); - help1(); - wnoutrefresh(stdscr); - wnoutrefresh(helpwin); - wnoutrefresh(msgwin); - wnoutrefresh(boardwin); - doupdate(); - - for (i = 0; i < BDEPTH; i++) - for (j = 0; j < BWIDTH; j++) - { - board[i][j] = FALSE; - cellmove(i, j); - waddch(boardwin, minus); - } - memset(history, '\0', sizeof(history)); - history[0].y = history[0].x = -1; - lastrow = lastcol = -2; - movecount = 1; - keyhelp = FALSE; - - for (;;) - { - if (rw != lastrow || col != lastcol) - { - if (lastrow >= 0 && lastcol >= 0) - { - cellmove(lastrow, lastcol); - if (board[lastrow][lastcol]) - waddch(boardwin, trail); - else - waddch(boardwin, oldch); - } - - cellmove(rw, col); - oldch = winch(boardwin); - - lastrow = rw; - lastcol= col; - } - cellmove(rw, col); - waddch(boardwin, plus); - cellmove(rw, col); - - wrefresh(msgwin); - - c = wgetch(boardwin); - - werase(msgwin); - - switch (c) - { - case 'k': case '8': - case KEY_UP: - ny = rw+BDEPTH-1; nx = col; - break; - case 'j': case '2': - case KEY_DOWN: - ny = rw+1; nx = col; - break; - case 'h': case '4': - case KEY_LEFT: - ny = rw; nx = col+BWIDTH-1; - break; - case 'l': case '6': - case KEY_RIGHT: - ny = rw; nx = col+1; - break; - case 'y': case '7': - case KEY_A1: - ny = rw+BDEPTH-1; nx = col+BWIDTH-1; - break; - case 'b': case '1': - case KEY_C1: - ny = rw+1; nx = col+BWIDTH-1; - break; - case 'u': case '9': - case KEY_A3: - ny = rw+BDEPTH-1; nx = col+1; - break; - case 'n': case '3': - case KEY_C3: - ny = rw+1; nx = col+1; - break; + /* clear screen and draw board */ + werase(boardwin); + werase(helpwin); + werase(msgwin); + dosquares(); + help1(); + wnoutrefresh(stdscr); + wnoutrefresh(helpwin); + wnoutrefresh(msgwin); + wnoutrefresh(boardwin); + doupdate(); + + for (i = 0; i < BDEPTH; i++) + for (j = 0; j < BWIDTH; j++) { + board[i][j] = FALSE; + cellmove(i, j); + waddch(boardwin, minus); + } + memset(history, '\0', sizeof(history)); + history[0].y = history[0].x = -1; + lastrow = lastcol = -2; + movecount = 1; + keyhelp = FALSE; + + for (;;) { + if (rw != lastrow || col != lastcol) { + if (lastrow >= 0 && lastcol >= 0) { + cellmove(lastrow, lastcol); + if (board[lastrow][lastcol]) + waddch(boardwin, trail); + else + waddch(boardwin, oldch); + } + + cellmove(rw, col); + oldch = winch(boardwin); + + lastrow = rw; + lastcol = col; + } + cellmove(rw, col); + waddch(boardwin, plus); + cellmove(rw, col); + + wrefresh(msgwin); + + c = wgetch(boardwin); + + werase(msgwin); + + switch (c) { + case 'k': + case '8': + case KEY_UP: + ny = rw + BDEPTH - 1; + nx = col; + break; + case 'j': + case '2': + case KEY_DOWN: + ny = rw + 1; + nx = col; + break; + case 'h': + case '4': + case KEY_LEFT: + ny = rw; + nx = col + BWIDTH - 1; + break; + case 'l': + case '6': + case KEY_RIGHT: + ny = rw; + nx = col + 1; + break; + case 'y': + case '7': + case KEY_A1: + ny = rw + BDEPTH - 1; + nx = col + BWIDTH - 1; + break; + case 'b': + case '1': + case KEY_C1: + ny = rw + 1; + nx = col + BWIDTH - 1; + break; + case 'u': + case '9': + case KEY_A3: + ny = rw + BDEPTH - 1; + nx = col + 1; + break; + case 'n': + case '3': + case KEY_C3: + ny = rw + 1; + nx = col + 1; + break; #ifdef NCURSES_MOUSE_VERSION - case KEY_MOUSE: - { - MEVENT myevent; - - getmouse(&myevent); - if (myevent.y >= CY(0) && myevent.y <= CY(BDEPTH) - && myevent.x >= CX(0) && myevent.x <= CX(BWIDTH)) - { - nx = CXINV(myevent.x); - ny = CYINV(myevent.y); - ungetch('\n'); - break; - } - else - { - beep(); - continue; - } - } + case KEY_MOUSE: + { + MEVENT myevent; + + getmouse(&myevent); + if (myevent.y >= CY(0) && myevent.y <= CY(BDEPTH) + && myevent.x >= CX(0) && myevent.x <= CX(BWIDTH)) { + nx = CXINV(myevent.x); + ny = CYINV(myevent.y); + ungetch('\n'); + break; + } else { + beep(); + continue; + } + } #endif /* NCURSES_MOUSE_VERSION */ - case KEY_B2: - case '\n': - case ' ': - if (evalmove(rw, col)) - { - drawmove(trail, - history[movecount-1].y, history[movecount-1].x, - rw, col); - history[movecount].y = rw; - history[movecount].x = col; - movecount++; - - if (!chkmoves()) - goto dropout; - } - else - beep(); - break; - - case KEY_REDO: - case '\f': - case 'r': - clearok(curscr, TRUE); - wnoutrefresh(stdscr); - wnoutrefresh(boardwin); - wnoutrefresh(msgwin); - wnoutrefresh(helpwin); - doupdate(); - break; - - case KEY_UNDO: - case KEY_BACKSPACE: - case '\b': - if (movecount == 1) - { - ny = lastrow; - nx = lastcol; - waddstr(msgwin, "\nNo previous move."); - beep(); - } - else - { - int oldy = history[movecount-1].y; - int oldx = history[movecount-1].x; - - board[oldy][oldx] = FALSE; - --movecount; - ny = history[movecount-1].y; - nx = history[movecount-1].x; - drawmove(' ', oldy, oldx, ny, nx); - - /* avoid problems if we just changed the current cell */ - cellmove(lastrow, lastcol); - oldch = winch(boardwin); - } - break; - - case 'q': - case 'x': - goto dropout; - - case '?': - werase(helpwin); - if (keyhelp) - { - help1(); - keyhelp = FALSE; - } - else - { - help2(); - keyhelp = TRUE; - } - wrefresh(helpwin); - break; - - default: - beep(); - break; - } - - col = nx % BWIDTH; - rw = ny % BDEPTH; - } - - dropout: - count = 0; - for (i = 0; i < BDEPTH; i++) - for (j = 0; j < BWIDTH; j++) - if (board[i][j] != 0) - count += 1; - if (count == (BWIDTH * BDEPTH)) - wprintw(msgwin, "\nYou won. Care to try again? "); - else - wprintw(msgwin, "\n%d squares filled. Try again? ", count); - } while - (tolower(wgetch(msgwin)) == 'y'); + case KEY_B2: + case '\n': + case ' ': + if (evalmove(rw, col)) { + drawmove(trail, + history[movecount - 1].y, history[movecount - + 1].x, + rw, col); + history[movecount].y = rw; + history[movecount].x = col; + movecount++; + + if (!chkmoves()) + goto dropout; + } else + beep(); + break; + + case KEY_REDO: + case '\f': + case 'r': + clearok(curscr, TRUE); + wnoutrefresh(stdscr); + wnoutrefresh(boardwin); + wnoutrefresh(msgwin); + wnoutrefresh(helpwin); + doupdate(); + break; + + case KEY_UNDO: + case KEY_BACKSPACE: + case '\b': + if (movecount == 1) { + ny = lastrow; + nx = lastcol; + waddstr(msgwin, "\nNo previous move."); + beep(); + } else { + int oldy = history[movecount - 1].y; + int oldx = history[movecount - 1].x; + + board[oldy][oldx] = FALSE; + --movecount; + ny = history[movecount - 1].y; + nx = history[movecount - 1].x; + drawmove(' ', oldy, oldx, ny, nx); + + /* avoid problems if we just changed the current cell */ + cellmove(lastrow, lastcol); + oldch = winch(boardwin); + } + break; + + case 'q': + case 'x': + goto dropout; + + case '?': + werase(helpwin); + if (keyhelp) { + help1(); + keyhelp = FALSE; + } else { + help2(); + keyhelp = TRUE; + } + wrefresh(helpwin); + break; + + default: + beep(); + break; + } + + col = nx % BWIDTH; + rw = ny % BDEPTH; + } + + dropout: + count = 0; + for (i = 0; i < BDEPTH; i++) + for (j = 0; j < BWIDTH; j++) + if (board[i][j] != 0) + count += 1; + if (count == (BWIDTH * BDEPTH)) + wprintw(msgwin, "\nYou won. Care to try again? "); + else + wprintw(msgwin, "\n%d squares filled. Try again? ", count); + } while + (tolower(wgetch(msgwin)) == 'y'); } -static void dosquares (void) +static void +dosquares(void) { int i, j; mvaddstr(0, 20, "KNIGHT'S MOVE -- a logical solitaire"); - move(BOARDY,BOARDX); + move(BOARDY, BOARDX); waddch(boardwin, ACS_ULCORNER); - for (j = 0; j < 7; j++) - { + for (j = 0; j < 7; j++) { waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); @@ -406,21 +406,18 @@ static void dosquares (void) waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_URCORNER); - for (i = 1; i < BDEPTH; i++) - { + for (i = 1; i < BDEPTH; i++) { move(BOARDY + i * 2 - 1, BOARDX); - waddch(boardwin, ACS_VLINE); - for (j = 0; j < BWIDTH; j++) - { + waddch(boardwin, ACS_VLINE); + for (j = 0; j < BWIDTH; j++) { waddch(boardwin, ' '); waddch(boardwin, ' '); waddch(boardwin, ' '); waddch(boardwin, ACS_VLINE); } move(BOARDY + i * 2, BOARDX); - waddch(boardwin, ACS_LTEE); - for (j = 0; j < BWIDTH - 1; j++) - { + waddch(boardwin, ACS_LTEE); + for (j = 0; j < BWIDTH - 1; j++) { waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); @@ -434,8 +431,7 @@ static void dosquares (void) move(BOARDY + i * 2 - 1, BOARDX); waddch(boardwin, ACS_VLINE); - for (j = 0; j < BWIDTH; j++) - { + for (j = 0; j < BWIDTH; j++) { waddch(boardwin, ' '); waddch(boardwin, ' '); waddch(boardwin, ' '); @@ -444,8 +440,7 @@ static void dosquares (void) move(BOARDY + i * 2, BOARDX); waddch(boardwin, ACS_LLCORNER); - for (j = 0; j < BWIDTH - 1; j++) - { + for (j = 0; j < BWIDTH - 1; j++) { waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); waddch(boardwin, ACS_HLINE); @@ -457,35 +452,57 @@ static void dosquares (void) waddch(boardwin, ACS_LRCORNER); } -static void mark_possibles(int prow, int pcol, chtype mark) +static void +mark_possibles(int prow, int pcol, chtype mark) { - if (chksqr(prow+2,pcol+1)){cellmove(prow+2,pcol+1);waddch(boardwin,mark);}; - if (chksqr(prow+2,pcol-1)){cellmove(prow+2,pcol-1);waddch(boardwin,mark);}; - if (chksqr(prow-2,pcol+1)){cellmove(prow-2,pcol+1);waddch(boardwin,mark);}; - if (chksqr(prow-2,pcol-1)){cellmove(prow-2,pcol-1);waddch(boardwin,mark);}; - if (chksqr(prow+1,pcol+2)){cellmove(prow+1,pcol+2);waddch(boardwin,mark);}; - if (chksqr(prow+1,pcol-2)){cellmove(prow+1,pcol-2);waddch(boardwin,mark);}; - if (chksqr(prow-1,pcol+2)){cellmove(prow-1,pcol+2);waddch(boardwin,mark);}; - if (chksqr(prow-1,pcol-2)){cellmove(prow-1,pcol-2);waddch(boardwin,mark);}; + if (chksqr(prow + 2, pcol + 1)) { + cellmove(prow + 2, pcol + 1); + waddch(boardwin, mark); + }; + if (chksqr(prow + 2, pcol - 1)) { + cellmove(prow + 2, pcol - 1); + waddch(boardwin, mark); + }; + if (chksqr(prow - 2, pcol + 1)) { + cellmove(prow - 2, pcol + 1); + waddch(boardwin, mark); + }; + if (chksqr(prow - 2, pcol - 1)) { + cellmove(prow - 2, pcol - 1); + waddch(boardwin, mark); + }; + if (chksqr(prow + 1, pcol + 2)) { + cellmove(prow + 1, pcol + 2); + waddch(boardwin, mark); + }; + if (chksqr(prow + 1, pcol - 2)) { + cellmove(prow + 1, pcol - 2); + waddch(boardwin, mark); + }; + if (chksqr(prow - 1, pcol + 2)) { + cellmove(prow - 1, pcol + 2); + waddch(boardwin, mark); + }; + if (chksqr(prow - 1, pcol - 2)) { + cellmove(prow - 1, pcol - 2); + waddch(boardwin, mark); + }; } -static void drawmove(char tchar, int oldy, int oldx, int row, int column) +static void +drawmove(char tchar, int oldy, int oldx, int row, int column) /* place the stars, update board & currents */ { - if (movecount <= 1) - { + if (movecount <= 1) { int i, j; for (i = 0; i < BDEPTH; i++) - for (j = 0; j < BWIDTH; j++) - { + for (j = 0; j < BWIDTH; j++) { cellmove(i, j); if (winch(boardwin) == minus) waddch(boardwin, movecount ? ' ' : minus); } - } - else - { + } else { cellmove(oldy, oldx); waddch(boardwin, '\b'); waddch(boardwin, tchar); @@ -494,8 +511,7 @@ static void drawmove(char tchar, int oldy, int oldx, int row, int column) mark_possibles(oldy, oldx, ' '); } - if (row != -1 && column != -1) - { + if (row != -1 && column != -1) { cellmove(row, column); waddch(boardwin, '\b'); waddch(boardwin, trail); @@ -508,57 +524,67 @@ static void drawmove(char tchar, int oldy, int oldx, int row, int column) wprintw(msgwin, "\nMove %d", movecount); } -static bool evalmove(int row, int column) +static bool +evalmove(int row, int column) /* evaluate move */ { if (movecount == 1) - return(TRUE); - else if (board[row][column] == TRUE) - { + return (TRUE); + else if (board[row][column] == TRUE) { waddstr(msgwin, "\nYou've already been there."); - return(FALSE); - } - else - { - int rdif = iabs(row - history[movecount-1].y); - int cdif = iabs(column - history[movecount-1].x); + return (FALSE); + } else { + int rdif = iabs(row - history[movecount - 1].y); + int cdif = iabs(column - history[movecount - 1].x); - if (!((rdif == 1) && (cdif == 2)) && !((rdif == 2) && (cdif == 1))) - { + if (!((rdif == 1) && (cdif == 2)) && !((rdif == 2) && (cdif == 1))) { waddstr(msgwin, "\nThat's not a legal knight's move."); - return(FALSE); + return (FALSE); } } - return(TRUE); + return (TRUE); } -static bool chkmoves (void) +static bool +chkmoves(void) /* check to see if valid moves are available */ { - if (chksqr(rw+2,col+1)) return(TRUE); - if (chksqr(rw+2,col-1)) return(TRUE); - if (chksqr(rw-2,col+1)) return(TRUE); - if (chksqr(rw-2,col-1)) return(TRUE); - if (chksqr(rw+1,col+2)) return(TRUE); - if (chksqr(rw+1,col-2)) return(TRUE); - if (chksqr(rw-1,col+2)) return(TRUE); - if (chksqr(rw-1,col-2)) return(TRUE); + if (chksqr(rw + 2, col + 1)) + return (TRUE); + if (chksqr(rw + 2, col - 1)) + return (TRUE); + if (chksqr(rw - 2, col + 1)) + return (TRUE); + if (chksqr(rw - 2, col - 1)) + return (TRUE); + if (chksqr(rw + 1, col + 2)) + return (TRUE); + if (chksqr(rw + 1, col - 2)) + return (TRUE); + if (chksqr(rw - 1, col + 2)) + return (TRUE); + if (chksqr(rw - 1, col - 2)) + return (TRUE); return (FALSE); } -static int iabs(int num) +static int +iabs(int num) { - if (num < 0) return (-num); - else return (num); + if (num < 0) + return (-num); + else + return (num); } -static bool chksqr (int r1, int c1) +static bool +chksqr(int r1, int c1) { if ((r1 < 0) || (r1 > BDEPTH - 1)) - return(FALSE); + return (FALSE); if ((c1 < 0) || (c1 > BWIDTH - 1)) - return(FALSE); + return (FALSE); return ((!board[r1][c1]) ? TRUE : FALSE); } diff --git a/contrib/ncurses/test/ncurses.c b/contrib/ncurses/test/ncurses.c index 074ca70..ad1aa01 100644 --- a/contrib/ncurses/test/ncurses.c +++ b/contrib/ncurses/test/ncurses.c @@ -39,7 +39,7 @@ DESCRIPTION AUTHOR Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993 -$Id: ncurses.c,v 1.129 2000/06/17 20:02:22 tom Exp $ +$Id: ncurses.c,v 1.138 2000/09/17 01:24:00 tom Exp $ ***************************************************************************/ @@ -92,7 +92,7 @@ static int save_trace = TRACE_ORDINARY | TRACE_CALLS; extern int _nc_tracing; #endif -#if !HAVE_NAPMS +#if !defined(HAVE_NAPMS) #define HAVE_NAPMS 1 #endif @@ -198,7 +198,7 @@ mouse_decode(MEVENT const *ep) static char buf[80]; (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", - ep->id, ep->x, ep->y, ep->z, ep->bstate); + ep->id, ep->x, ep->y, ep->z, ep->bstate); #define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} SHOW(BUTTON1_RELEASED, "release-1"); @@ -347,21 +347,43 @@ getch_test(void) } static int -show_attr(int row, int skip, chtype attr, const char *name, bool once) +show_attr(int row, int skip, chtype attr, const char *name) { + static const char *string = "abcde fghij klmno pqrst uvwxy z"; int ncv = tigetnum("ncv"); mvprintw(row, 8, "%s mode:", name); mvprintw(row, 24, "|"); if (skip) printw("%*s", skip, " "); - if (once) - attron(attr); - else - attrset(attr); - addstr("abcde fghij klmno pqrst uvwxy z"); - if (once) - attroff(attr); + attrset(attr); + /* + * If we're to write a string in the alternate character set, it is not + * sufficient to just set A_ALTCHARSET. We have to perform the mapping + * that corresponds. This is not needed for vt100-compatible devices + * because the acs_map[] is 1:1, but for PC-style devices such as Linux + * console, the acs_map[] is scattered about the range. + * + * The addch/addstr functions do not themselves do this mapping, since it + * is possible to turn off the A_ALTCHARSET flag for the characters which + * are added, and it would be an unexpected result to have the mapped + * characters visible on the screen. + * + * This example works because the indices into acs_map[] are mostly from + * the lowercase characters. + */ + if (attr & A_ALTCHARSET) { + const char *s = string; + while (*s) { + int ch = *s++; + if ((ch = acs_map[ch]) == 0) + ch = ' '; + addch(ch); + } + } else { + addstr(string); + } + attroff(attr); if (skip) printw("%*s", skip, " "); printw("|"); @@ -398,7 +420,7 @@ show_attr(int row, int skip, chtype attr, const char *name, bool once) } static bool -attr_getc(int *skip, int *fg, int *bg) +attr_getc(int *skip, int *fg, int *bg, int *ac) { int ch = Getchar(); @@ -411,6 +433,12 @@ attr_getc(int *skip, int *fg, int *bg) return TRUE; } else if (has_colors()) { switch (ch) { + case 'a': + *ac = 0; + break; + case 'A': + *ac = A_ALTCHARSET; + break; case 'f': *fg = (*fg + 1); break; @@ -435,6 +463,18 @@ attr_getc(int *skip, int *fg, int *bg) if (*bg < 0) *bg = COLORS - 1; return TRUE; + } else { + switch (ch) { + case 'a': + *ac = 0; + break; + case 'A': + *ac = A_ALTCHARSET; + break; + default: + return FALSE; + } + return TRUE; } return FALSE; } @@ -447,6 +487,7 @@ attr_test(void) int skip = tigetnum("xmc"); int fg = COLOR_BLACK; /* color pair 0 is special */ int bg = COLOR_BLACK; + int ac = 0; bool *pairs = (bool *) calloc(COLOR_PAIRS, sizeof(bool)); pairs[0] = TRUE; @@ -472,28 +513,31 @@ attr_test(void) mvaddstr(0, 20, "Character attribute test display"); - row = show_attr(row, n, A_STANDOUT, "STANDOUT", TRUE); - row = show_attr(row, n, A_REVERSE, "REVERSE", TRUE); - row = show_attr(row, n, A_BOLD, "BOLD", TRUE); - row = show_attr(row, n, A_UNDERLINE, "UNDERLINE", TRUE); - row = show_attr(row, n, A_DIM, "DIM", TRUE); - row = show_attr(row, n, A_BLINK, "BLINK", TRUE); - row = show_attr(row, n, A_PROTECT, "PROTECT", TRUE); - row = show_attr(row, n, A_INVIS, "INVISIBLE", TRUE); - row = show_attr(row, n, A_NORMAL, "NORMAL", FALSE); + row = show_attr(row, n, ac | A_STANDOUT, "STANDOUT"); + row = show_attr(row, n, ac | A_REVERSE, "REVERSE"); + row = show_attr(row, n, ac | A_BOLD, "BOLD"); + row = show_attr(row, n, ac | A_UNDERLINE, "UNDERLINE"); + row = show_attr(row, n, ac | A_DIM, "DIM"); + row = show_attr(row, n, ac | A_BLINK, "BLINK"); + row = show_attr(row, n, ac | A_PROTECT, "PROTECT"); + row = show_attr(row, n, ac | A_INVIS, "INVISIBLE"); + row = show_attr(row, n, ac | A_NORMAL, "NORMAL"); mvprintw(row, 8, - "This terminal does %shave the magic-cookie glitch", - tigetnum("xmc") > -1 ? "" : "not "); + "This terminal does %shave the magic-cookie glitch", + tigetnum("xmc") > -1 ? "" : "not "); mvprintw(row + 1, 8, - "Enter a digit to set gaps on each side of displayed attributes"); + "Enter a digit to set gaps on each side of displayed attributes"); mvprintw(row + 2, 8, - "^L = repaint"); + "^L = repaint"); if (has_colors()) - printw(". f/F/b/F toggle colors (now %d/%d)", fg, bg); + printw(". f/F/b/F toggle colors (now %d/%d), a/A altcharset (%d)", + fg, bg, ac != 0); + else + printw(". a/A altcharset (%d)", ac != 0); refresh(); - } while (attr_getc(&n, &fg, &bg)); + } while (attr_getc(&n, &fg, &bg, &ac)); free((char *) pairs); bkgdset(A_NORMAL | BLANK); @@ -554,9 +598,9 @@ color_test(void) top = (COLORS > 8) ? 0 : base * (COLORS + 3); clrtobot(); (void) mvprintw(top + 1, 0, - "%dx%d matrix of foreground/background colors, bright *%s*\n", - COLORS, COLORS, - base ? "on" : "off"); + "%dx%d matrix of foreground/background colors, bright *%s*\n", + COLORS, COLORS, + base ? "on" : "off"); for (i = 0; i < COLORS; i++) show_color_name(top + 2, (i + 1) * width, i); for (i = 0; i < COLORS; i++) @@ -627,9 +671,9 @@ color_edit(void) for (i = 0; i < max_colors; i++) { mvprintw(2 + i, 0, "%c %-8s:", - (i == current ? '>' : ' '), - (i < (int) SIZEOF(color_names) - ? color_names[i] : "")); + (i == current ? '>' : ' '), + (i < (int) SIZEOF(color_names) + ? color_names[i] : "")); attrset(COLOR_PAIR(i)); addstr(" "); attrset(A_NORMAL); @@ -666,9 +710,9 @@ color_edit(void) } mvaddstr(max_colors + 3, 0, - "Use up/down to select a color, left/right to change fields."); + "Use up/down to select a color, left/right to change fields."); mvaddstr(max_colors + 4, 0, - "Modify field by typing nnn=, nnn-, or nnn+. ? for help."); + "Modify field by typing nnn=, nnn-, or nnn+. ? for help."); move(2 + current, 0); @@ -882,7 +926,7 @@ show_upper_chars(int first) erase(); attron(A_BOLD); mvprintw(0, 20, "Display of %s Character Codes %d to %d", - C1 ? "C1" : "GR", first, last); + C1 ? "C1" : "GR", first, last); attroff(A_BOLD); refresh(); @@ -983,9 +1027,9 @@ acs_display(void) break; } mvprintw(LINES - 3, 0, - "Note: ANSI terminals may not display C1 characters."); + "Note: ANSI terminals may not display C1 characters."); mvprintw(LINES - 2, 0, - "Select: a=ACS, 0=C1, 1,2,3=GR characters, q=quit"); + "Select: a=ACS, 0=C1, 1,2,3=GR characters, q=quit"); refresh(); } while ((c = Getchar()) != 'x' && c != 'q'); @@ -1064,7 +1108,7 @@ test_sgr_attributes(void) bkgdset(normal); mvprintw(LINES - 2, 1, "%s background. ", pass == 0 ? "Dark" : - "Light"); + "Light"); clrtoeol(); Pause(); } @@ -1146,7 +1190,7 @@ newwin_legend(FRAME * curp) { "^R = restore window", 0 }, -#ifdef HAVE_WRESIZE +#if HAVE_WRESIZE { "^X = resize", 0 }, @@ -1196,8 +1240,8 @@ transient(FRAME * curp, NCURSES_CONST char *msg) move(LINES - 1, 0); printw("%s characters are echoed, window should %sscroll.", - HaveKeypad(curp) ? "Non-arrow" : "All other", - HaveScroll(curp) ? "" : "not "); + HaveKeypad(curp) ? "Non-arrow" : "All other", + HaveScroll(curp) ? "" : "not "); clrtoeol(); } @@ -1477,7 +1521,7 @@ acs_and_scroll(void) } break; -#ifdef HAVE_WRESIZE +#if HAVE_WRESIZE case CTRL('X'): /* resize window */ if (current) { pair *tmp, ul, lr; @@ -1585,8 +1629,8 @@ acs_and_scroll(void) wrefresh(usescr); } while ((c = wGetchar(usescr)) != QUIT - && !((c == ESCAPE) && (usescr->_use_keypad)) - && (c != ERR)); + && !((c == ESCAPE) && (usescr->_use_keypad)) + && (c != ERR)); breakout: while (current != 0) @@ -1739,38 +1783,38 @@ demo_panels(void) PANEL *p5; p1 = mkpanel(COLOR_RED, - LINES / 2 - 2, - COLS / 8 + 1, - 0, - 0); + LINES / 2 - 2, + COLS / 8 + 1, + 0, + 0); set_panel_userptr(p1, "p1"); p2 = mkpanel(COLOR_GREEN, - LINES / 2 + 1, - COLS / 7, - LINES / 4, - COLS / 10); + LINES / 2 + 1, + COLS / 7, + LINES / 4, + COLS / 10); set_panel_userptr(p2, "p2"); p3 = mkpanel(COLOR_YELLOW, - LINES / 4, - COLS / 10, - LINES / 2, - COLS / 9); + LINES / 4, + COLS / 10, + LINES / 2, + COLS / 9); set_panel_userptr(p3, "p3"); p4 = mkpanel(COLOR_BLUE, - LINES / 2 - 2, - COLS / 8, - LINES / 2 - 2, - COLS / 3); + LINES / 2 - 2, + COLS / 8, + LINES / 2 - 2, + COLS / 3); set_panel_userptr(p4, "p4"); p5 = mkpanel(COLOR_MAGENTA, - LINES / 2 - 2, - COLS / 8, - LINES / 2, - COLS / 2 - 2); + LINES / 2 - 2, + COLS / 8, + LINES / 2, + COLS / 2 - 2); set_panel_userptr(p5, "p5"); fill_panel(p1); @@ -1943,6 +1987,7 @@ demo_panels(void) #define GRIDSIZE 3 +static bool pending_pan = FALSE; static bool show_panner_legend = TRUE; static int @@ -1950,10 +1995,10 @@ panner_legend(int line) { static const char *const legend[] = { - "Use arrow keys (or U,D,L,R) to pan, q to quit (?,t,s flags)", - "Use ! to shell-out. Toggle legend:?, timer:t, scroll mark:s.", + "Use arrow keys (or U,D,L,R) to pan, q to quit, ! to shell-out.", "Use +,- (or j,k) to grow/shrink the panner vertically.", - "Use <,> (or h,l) to grow/shrink the panner horizontally." + "Use <,> (or h,l) to grow/shrink the panner horizontally.", + "Number repeats. Toggle legend:?, timer:t, scroll mark:s." }; int n = (SIZEOF(legend) - (LINES - line)); if (line < LINES && (n >= 0)) { @@ -1982,8 +2027,8 @@ panner_v_cleanup(int from_y, int from_x, int to_y) static void panner(WINDOW *pad, - int top_x, int top_y, int porty, int portx, - int (*pgetc) (WINDOW *)) + int top_x, int top_y, int porty, int portx, + int (*pgetc) (WINDOW *)) { #if HAVE_GETTIMEOFDAY struct timeval before, after; @@ -2205,29 +2250,31 @@ panner(WINDOW *pad, mvaddch(porty - 1, top_x - 1, ACS_LLCORNER); mvaddch(porty - 1, portx - 1, ACS_LRCORNER); + if (!pending_pan) { #if HAVE_GETTIMEOFDAY - gettimeofday(&before, 0); + gettimeofday(&before, 0); #endif - wnoutrefresh(stdscr); + wnoutrefresh(stdscr); - pnoutrefresh(pad, - basey, basex, - top_y, top_x, - porty - (pxmax > portx) - 1, - portx - (pymax > porty) - 1); + pnoutrefresh(pad, + basey, basex, + top_y, top_x, + porty - (pxmax > portx) - 1, + portx - (pymax > porty) - 1); - doupdate(); + doupdate(); #if HAVE_GETTIMEOFDAY - if (timing) { - double elapsed; - gettimeofday(&after, 0); - elapsed = (after.tv_sec + after.tv_usec / 1.0e6) - - (before.tv_sec + before.tv_usec / 1.0e6); - move(LINES - 1, COLS - 20); - printw("Secs: %2.03f", elapsed); - refresh(); - } + if (timing) { + double elapsed; + gettimeofday(&after, 0); + elapsed = (after.tv_sec + after.tv_usec / 1.0e6) + - (before.tv_sec + before.tv_usec / 1.0e6); + move(LINES - 1, COLS - 20); + printw("Secs: %2.03f", elapsed); + refresh(); + } #endif + } } while ((c = pgetc(pad)) != KEY_EXIT); @@ -2235,44 +2282,73 @@ panner(WINDOW *pad, scrollok(stdscr, TRUE); /* reset to driver's default */ } -static -int +static int padgetch(WINDOW *win) { + static int count; + static int last; int c; - switch (c = wGetchar(win)) { - case '!': - ShellOut(FALSE); - return KEY_REFRESH; - case CTRL('r'): - endwin(); - refresh(); - return KEY_REFRESH; - case CTRL('l'): - return KEY_REFRESH; - case 'U': - return (KEY_UP); - case 'D': - return (KEY_DOWN); - case 'R': - return (KEY_RIGHT); - case 'L': - return (KEY_LEFT); - case '+': - return (KEY_IL); - case '-': - return (KEY_DL); - case '>': - return (KEY_IC); - case '<': - return (KEY_DC); - case ERR: /* FALLTHRU */ - case 'q': - return (KEY_EXIT); - default: - return (c); + if ((pending_pan = (count > 0)) != FALSE) { + count--; + pending_pan = (count != 0); + } else { + for (;;) { + switch (c = wGetchar(win)) { + case '!': + ShellOut(FALSE); + c = KEY_REFRESH; + case CTRL('r'): + endwin(); + refresh(); + c = KEY_REFRESH; + break; + case CTRL('l'): + c = KEY_REFRESH; + break; + case 'U': + c = KEY_UP; + break; + case 'D': + c = KEY_DOWN; + break; + case 'R': + c = KEY_RIGHT; + break; + case 'L': + c = KEY_LEFT; + break; + case '+': + c = KEY_IL; + break; + case '-': + c = KEY_DL; + break; + case '>': + c = KEY_IC; + break; + case '<': + c = KEY_DC; + break; + case ERR: /* FALLTHRU */ + case 'q': + count = 0; + c = KEY_EXIT; + break; + default: + if (c >= '0' && c <= '9') { + count = count * 10 + (c - '0'); + continue; + } + break; + } + last = c; + break; + } + if (count > 0) + count--; } + return (last); } #define PAD_HIGH 200 @@ -2379,7 +2455,7 @@ flushinp_test(WINDOW *win) mvwaddstr(win, 2, 1, "Type random keys for 5 seconds."); mvwaddstr(win, 3, 1, - "These should be discarded (not echoed) after the subwindow goes away."); + "These should be discarded (not echoed) after the subwindow goes away."); wrefresh(win); for (i = 0; i < 5; i++) { @@ -2396,11 +2472,11 @@ flushinp_test(WINDOW *win) napms(1000); mvwaddstr(win, 2, 1, - "If you were still typing when the window timer expired,"); + "If you were still typing when the window timer expired,"); mvwaddstr(win, 3, 1, - "or else you typed nothing at all while it was running,"); + "or else you typed nothing at all while it was running,"); mvwaddstr(win, 4, 1, - "test was invalid. You'll see garbage or nothing at all. "); + "test was invalid. You'll see garbage or nothing at all. "); mvwaddstr(win, 6, 1, "Press a key"); wmove(win, 9, 10); wrefresh(win); @@ -2408,7 +2484,7 @@ flushinp_test(WINDOW *win) wGetchar(win); flushinp(); mvwaddstr(win, 12, 0, - "If you see any key other than what you typed, flushinp() is broken."); + "If you see any key other than what you typed, flushinp() is broken."); Continue(win); wmove(win, 9, 10); @@ -2417,7 +2493,7 @@ flushinp_test(WINDOW *win) wmove(win, 12, 0); clrtoeol(); waddstr(win, - "What you typed should now have been deleted; if not, wdelch() failed."); + "What you typed should now have been deleted; if not, wdelch() failed."); Continue(win); cbreak(); @@ -2483,7 +2559,7 @@ menu_test(void) mvaddstr(2, 0, " Use up and down arrow to move the select bar."); mvaddstr(3, 0, " 'n' and 'p' act like arrows."); mvaddstr(4, 0, - " 'b' and 'f' scroll up/down (page), 'u' and 'd' (line)."); + " 'b' and 'f' scroll up/down (page), 'u' and 'd' (line)."); mvaddstr(5, 0, " Press return to exit."); refresh(); @@ -2512,7 +2588,7 @@ menu_test(void) } (void) mvprintw(LINES - 2, 0, - "You chose: %s\n", item_name(current_item(m))); + "You chose: %s\n", item_name(current_item(m))); (void) addstr("Press any key to continue..."); wGetchar(stdscr); @@ -2548,6 +2624,7 @@ static struct { T_TBL(TRACE_ICALLS), T_TBL(TRACE_CCALLS), T_TBL(TRACE_DATABASE), + T_TBL(TRACE_ATTRS), T_TBL(TRACE_MAXIMUM), { (char *) 0, 0 @@ -2677,7 +2754,7 @@ trace_set(void) _tracef("trace level interactively set to %s", tracetrace(_nc_tracing)); (void) mvprintw(LINES - 2, 0, - "Trace level is %s\n", tracetrace(_nc_tracing)); + "Trace level is %s\n", tracetrace(_nc_tracing)); (void) addstr("Press any key to continue..."); wGetchar(stdscr); @@ -3277,6 +3354,7 @@ usage(void) ,"" ,"Options:" #ifdef NCURSES_VERSION + ," -a f,b set default-colors (assumed white-on-black)" ," -d use default-colors if terminal supports them" #endif ," -e fmt specify format for soft-keys test (e)" @@ -3344,6 +3422,9 @@ main(int argc, char *argv[]) int command, c; int my_e_param = 1; #ifdef NCURSES_VERSION + int default_fg = COLOR_WHITE; + int default_bg = COLOR_BLACK; + bool assumed_colors = FALSE; bool default_colors = FALSE; #endif @@ -3351,9 +3432,13 @@ main(int argc, char *argv[]) setlocale(LC_CTYPE, ""); #endif - while ((c = getopt(argc, argv, "de:fhs:t:")) != EOF) { + while ((c = getopt(argc, argv, "a:de:fhs:t:")) != EOF) { switch (c) { #ifdef NCURSES_VERSION + case 'a': + assumed_colors = TRUE; + sscanf(optarg, "%d,%d", &default_fg, &default_bg); + break; case 'd': default_colors = TRUE; break; @@ -3422,6 +3507,8 @@ main(int argc, char *argv[]) #ifdef NCURSES_VERSION if (default_colors) use_default_colors(); + else if (assumed_colors) + assume_default_colors(default_fg, default_bg); #endif } set_terminal_modes(); @@ -3437,9 +3524,9 @@ main(int argc, char *argv[]) (void) printf("Welcome to %s. Press ? for help.\n", curses_version()); #elif defined(NCURSES_VERSION_MAJOR) && defined(NCURSES_VERSION_MINOR) && defined(NCURSES_VERSION_PATCH) (void) printf("Welcome to ncurses %d.%d.%d. Press ? for help.\n", - NCURSES_VERSION_MAJOR, - NCURSES_VERSION_MINOR, - NCURSES_VERSION_PATCH); + NCURSES_VERSION_MAJOR, + NCURSES_VERSION_MINOR, + NCURSES_VERSION_PATCH); #else (void) puts("Welcome to ncurses. Press ? for help."); #endif diff --git a/contrib/ncurses/test/railroad.c b/contrib/ncurses/test/railroad.c index d3dc2ea..a9aa306 100644 --- a/contrib/ncurses/test/railroad.c +++ b/contrib/ncurses/test/railroad.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey <dickey@clark.net> 2000 * - * $Id: railroad.c,v 1.1 2000/01/15 02:41:27 tom Exp $ + * $Id: railroad.c,v 1.3 2000/09/24 00:20:33 tom Exp $ * * A simple demo of the termcap interface. */ @@ -39,6 +39,11 @@ #include <ctype.h> #include <signal.h> +static char *wipeit; +static char *moveit; +static int length; +static int height; + static char *finisC; static char *finisS; static char *finisU; @@ -68,7 +73,7 @@ PutChar(int ch) { putchar(ch); fflush(stdout); - napms(50); /* not really termcap... */ + napms(moveit ? 10 : 50); /* not really termcap... */ } static void @@ -104,33 +109,54 @@ Underline(int flag) static void ShowSign(char *string) { + char *base = string; int ch, first, last; + if (moveit != 0) { + tputs(tgoto(moveit, 0, height - 1), 1, outc); + tputs(wipeit, 1, outc); + } + while (*string != 0) { ch = *string; - last = ch; - if (isalpha(ch)) { - first = isupper(ch) ? 'A' : 'a'; - } else if (isdigit(ch)) { - first = '0'; + if (moveit != 0) { + for (first = length - 1; first > (string - base); first--) { + if (first < length - 1) { + tputs(tgoto(moveit, first + 1, height - 1), 1, outc); + PutChar(' '); + } + tputs(tgoto(moveit, first, height - 1), 1, outc); + PutChar(ch); + } } else { - first = ch; - } - if (first < last) { - Underline(1); - while (first < last) { - PutChar(first); - Backup(); - first++; + last = ch; + if (isalpha(ch)) { + first = isupper(ch) ? 'A' : 'a'; + } else if (isdigit(ch)) { + first = '0'; + } else { + first = ch; + } + if (first < last) { + Underline(1); + while (first < last) { + PutChar(first); + Backup(); + first++; + } + Underline(0); } - Underline(0); } + if (moveit != 0) + Backup(); StandOut(1); PutChar(ch); StandOut(0); fflush(stdout); string++; } + if (moveit != 0) + tputs(wipeit, 1, outc); putchar('\n'); } @@ -153,7 +179,7 @@ onsig(int n GCC_UNUSED) static void railroad(char **args) { - char *name = getenv("TERM"); + NCURSES_CONST char *name = getenv("TERM"); char buffer[1024]; char area[1024], *ap = area; int j; @@ -161,6 +187,22 @@ railroad(char **args) if (name == 0) name = "dumb"; if (tgetent(buffer, name)) { + + wipeit = tgetstr("ce", &ap); + height = tgetnum("li"); + length = tgetnum("co"); + moveit = tgetstr("cm", &ap); + + if (wipeit == 0 + || moveit == 0 + || height <= 0 + || length <= 0) { + wipeit = 0; + moveit = 0; + height = 0; + length = 0; + } + startS = tgetstr("so", &ap); finisS = tgetstr("se", &ap); @@ -186,9 +228,7 @@ railroad(char **args) } int -main( - int argc, - char *argv[]) +main(int argc, char *argv[]) { if (argc > 1) { railroad(argv + 1); diff --git a/contrib/ncurses/test/rain.c b/contrib/ncurses/test/rain.c index 262f87d..a7771b0 100644 --- a/contrib/ncurses/test/rain.c +++ b/contrib/ncurses/test/rain.c @@ -1,5 +1,5 @@ /* - * $Id: rain.c,v 1.14 1999/11/13 23:39:07 tom Exp $ + * $Id: rain.c,v 1.15 2000/09/02 18:41:22 tom Exp $ */ #include <test.priv.h> @@ -42,7 +42,7 @@ float c; if (has_colors()) { int bg = COLOR_BLACK; start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS +#if HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif diff --git a/contrib/ncurses/test/tclock.c b/contrib/ncurses/test/tclock.c index 838f45e..9f84655 100644 --- a/contrib/ncurses/test/tclock.c +++ b/contrib/ncurses/test/tclock.c @@ -128,7 +128,7 @@ main( if (has_colors()) { start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS +#if HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) my_bg = -1; #endif diff --git a/contrib/ncurses/test/test.priv.h b/contrib/ncurses/test/test.priv.h index affed8d..58bbd16 100644 --- a/contrib/ncurses/test/test.priv.h +++ b/contrib/ncurses/test/test.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,12 +29,35 @@ /**************************************************************************** * Author: Thomas E. Dickey <dickey@clark.net> 1996 * ****************************************************************************/ -/* $Id: test.priv.h,v 1.16 2000/04/15 17:52:08 tom Exp $ */ +/* $Id: test.priv.h,v 1.19 2000/09/02 19:31:58 tom Exp $ */ + #if HAVE_CONFIG_H #include <ncurses_cfg.h> +#else +#define HAVE_CURSES_VERSION 0 +#define HAVE_RESIZETERM 0 +#define HAVE_USE_DEFAULT_COLORS 0 +#define HAVE_WRESIZE 0 +#endif + +#ifndef HAVE_NC_ALLOC_H +#define HAVE_NC_ALLOC_H 0 +#endif + +#ifndef HAVE_LOCALE_H +#define HAVE_LOCALE_H 0 +#endif + +#ifndef NCURSES_NOMACROS +#define NCURSES_NOMACROS 0 +#endif + +#ifndef NEED_PTEM_H +#define NEED_PTEM_H 0 #endif #include <stdlib.h> +#include <string.h> #include <sys/types.h> #if HAVE_UNISTD_H @@ -43,7 +66,7 @@ #include <curses.h> -#ifdef NCURSES_NOMACROS +#if NCURSES_NOMACROS #include <nomacros.h> #endif diff --git a/contrib/ncurses/test/view.c b/contrib/ncurses/test/view.c index f4c2f06..4c1344c 100644 --- a/contrib/ncurses/test/view.c +++ b/contrib/ncurses/test/view.c @@ -23,7 +23,7 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.29 2000/05/21 01:43:03 tom Exp $ + * $Id: view.c,v 1.31 2000/09/02 18:14:52 tom Exp $ */ #include <test.priv.h> @@ -53,7 +53,7 @@ static RETSIGTYPE finish(int sig) GCC_NORETURN; static void show_all(void); -#if defined(SIGWINCH) && defined(TIOCGWINSZ) && defined(HAVE_RESIZETERM) +#if defined(SIGWINCH) && defined(TIOCGWINSZ) && HAVE_RESIZETERM #define CAN_RESIZE 1 #else #define CAN_RESIZE 0 @@ -433,7 +433,7 @@ show_all(void) scrollok(stdscr, FALSE); /* prevent screen from moving */ for (i = 1; i < LINES; i++) { move(i, 0); - printw("%3d:", (lptr + i - lines)); + printw("%3ld:", (long) (lptr + i - lines)); clrtoeol(); if ((s = lptr[i - 1]) != 0) { int len = ch_len(s); diff --git a/contrib/ncurses/test/worm.c b/contrib/ncurses/test/worm.c index 43a898f..142982a 100644 --- a/contrib/ncurses/test/worm.c +++ b/contrib/ncurses/test/worm.c @@ -34,7 +34,7 @@ Options: traces will be dumped. The program stops and waits for one character of input at the beginning and end of the interval. - $Id: worm.c,v 1.30 2000/04/15 17:51:56 tom Exp $ + $Id: worm.c,v 1.31 2000/09/02 18:41:01 tom Exp $ */ #include <test.priv.h> @@ -251,7 +251,7 @@ main(int argc, char *argv[]) if (has_colors()) { int bg = COLOR_BLACK; start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS +#if HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif diff --git a/contrib/ncurses/test/xmas.c b/contrib/ncurses/test/xmas.c index 57d4292..d99b821 100644 --- a/contrib/ncurses/test/xmas.c +++ b/contrib/ncurses/test/xmas.c @@ -92,7 +92,7 @@ /******************************************************************************/ /* - * $Id: xmas.c,v 1.13 1999/11/13 23:39:01 tom Exp $ + * $Id: xmas.c,v 1.15 2000/09/02 18:45:53 tom Exp $ */ #include <test.priv.h> @@ -103,17 +103,36 @@ static int my_bg = COLOR_BLACK; static int y_pos, x_pos; -static WINDOW - *treescrn, *treescrn2,*treescrn3, *treescrn4,*treescrn5, *treescrn6, - *treescrn7, *treescrn8, - *dotdeer0, - *stardeer0, - *lildeer0, *lildeer1, *lildeer2, *lildeer3, - *middeer0, *middeer1, *middeer2, *middeer3, - *bigdeer0, *bigdeer1, *bigdeer2, *bigdeer3, *bigdeer4, - *lookdeer0, *lookdeer1, *lookdeer2, *lookdeer3, *lookdeer4, - *w_holiday, - *w_del_msg; +static WINDOW *treescrn; +static WINDOW *treescrn2; +static WINDOW *treescrn3; +static WINDOW *treescrn4; +static WINDOW *treescrn5; +static WINDOW *treescrn6; +static WINDOW *treescrn7; +static WINDOW *treescrn8; +static WINDOW *dotdeer0; +static WINDOW *stardeer0; +static WINDOW *lildeer0; +static WINDOW *lildeer1; +static WINDOW *lildeer2; +static WINDOW *lildeer3; +static WINDOW *middeer0; +static WINDOW *middeer1; +static WINDOW *middeer2; +static WINDOW *middeer3; +static WINDOW *bigdeer0; +static WINDOW *bigdeer1; +static WINDOW *bigdeer2; +static WINDOW *bigdeer3; +static WINDOW *bigdeer4; +static WINDOW *lookdeer0; +static WINDOW *lookdeer1; +static WINDOW *lookdeer2; +static WINDOW *lookdeer3; +static WINDOW *lookdeer4; +static WINDOW *w_holiday; +static WINDOW *w_del_msg; static int boxit(void); static int seas(void); @@ -129,923 +148,916 @@ static int strng4(void); static int strng5(void); static int reindeer(void); static int blinkit(void); -static RETSIGTYPE done(int sig) GCC_NORETURN ; -static void -set_color(WINDOW *win, chtype color) +static RETSIGTYPE +done(int sig) GCC_NORETURN; + + static void + set_color(WINDOW *win, chtype color) { - if (has_colors()) { - static bool *pairs; - int n = (color + 1); - if (pairs == 0) - pairs = (bool *)calloc(COLORS+1, sizeof(bool)); - if (!pairs[n]) { - init_pair(n, color, my_bg); - pairs[n] = TRUE; - } - wattroff(win, A_COLOR); - wattron(win, COLOR_PAIR(n)); + if (has_colors()) { + static bool *pairs; + int n = (color + 1); + if (pairs == 0) + pairs = (bool *) calloc(COLORS + 1, sizeof(bool)); + if (!pairs[n]) { + init_pair(n, color, my_bg); + pairs[n] = TRUE; } + wattroff(win, A_COLOR); + wattron(win, COLOR_PAIR(n)); + } } static void unset_color(WINDOW *win) { - if (has_colors()) - wattrset(win, COLOR_PAIR(0)); + if (has_colors()) + wattrset(win, COLOR_PAIR(0)); } static void look_out(int msecs) { - napms(msecs); - if (getch() != ERR) { - beep(); - done(0); - } + napms(msecs); + if (getch() != ERR) { + beep(); + done(0); + } } -int main( - int argc GCC_UNUSED, - char **argv GCC_UNUSED) +int +main(int argc GCC_UNUSED, char **argv GCC_UNUSED) { -int loopy; - - initscr(); - noecho(); - nonl(); - refresh(); - signal(SIGINT,done); - signal(SIGTERM,done); + int loopy; + + initscr(); + noecho(); + nonl(); + refresh(); + signal(SIGINT, done); + signal(SIGTERM, done); #if !defined DOS && !defined OS2 - signal(SIGHUP,done); - signal(SIGQUIT,done); + signal(SIGHUP, done); + signal(SIGQUIT, done); #endif - if (has_colors()) { - start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS - if (use_default_colors() == OK) - my_bg = -1; + if (has_colors()) { + start_color(); +#if HAVE_USE_DEFAULT_COLORS + if (use_default_colors() == OK) + my_bg = -1; #endif - } - curs_set(0); - - treescrn = newwin(16,27,3,53); - treescrn2 = newwin(16,27,3,53); - treescrn3 = newwin(16,27,3,53); - treescrn4 = newwin(16,27,3,53); - treescrn5 = newwin(16,27,3,53); - treescrn6 = newwin(16,27,3,53); - treescrn7 = newwin(16,27,3,53); - treescrn8 = newwin(16,27,3,53); - - dotdeer0 = newwin(3,71,0,8); - - stardeer0 = newwin(4,56,0,8); - - lildeer0 = newwin(7,53,0,8); - lildeer1 = newwin(2,4,0,0); - lildeer2 = newwin(2,4,0,0); - lildeer3 = newwin(2,4,0,0); - - middeer0 = newwin(15,42,0,8); - middeer1 = newwin(3,7,0,0); - middeer2 = newwin(3,7,0,0); - middeer3 = newwin(3,7,0,0); - - bigdeer0 = newwin(10,23,0,0); - bigdeer1 = newwin(10,23,0,0); - bigdeer2 = newwin(10,23,0,0); - bigdeer3 = newwin(10,23,0,0); - bigdeer4 = newwin(10,23,0,0); - - lookdeer0 = newwin(10,25,0,0); - lookdeer1 = newwin(10,25,0,0); - lookdeer2 = newwin(10,25,0,0); - lookdeer3 = newwin(10,25,0,0); - lookdeer4 = newwin(10,25,0,0); - - w_holiday = newwin(1,26,3,27); - - w_del_msg = newwin(1,19,23,60); - - mvwaddstr(w_del_msg,0,0,"Hit any key to quit"); - - mvwaddstr(w_holiday,0,0,"H A P P Y H O L I D A Y S"); - - /* set up the windows for our various reindeer */ - - /* lildeer1 */ - mvwaddch(lildeer1,0,0,(chtype)'V'); - mvwaddch(lildeer1,1,0,(chtype)'@'); - mvwaddch(lildeer1,1,1,(chtype)'<'); - mvwaddch(lildeer1,1,2,(chtype)'>'); - mvwaddch(lildeer1,1,3,(chtype)'~'); - - /* lildeer2 */ - mvwaddch(lildeer2,0,0,(chtype)'V'); - mvwaddch(lildeer2,1,0,(chtype)'@'); - mvwaddch(lildeer2,1,1,(chtype)'|'); - mvwaddch(lildeer2,1,2,(chtype)'|'); - mvwaddch(lildeer2,1,3,(chtype)'~'); - - /* lildeer3 */ - mvwaddch(lildeer3,0,0,(chtype)'V'); - mvwaddch(lildeer3,1,0,(chtype)'@'); - mvwaddch(lildeer3,1,1,(chtype)'>'); - mvwaddch(lildeer3,1,2,(chtype)'<'); - mvwaddch(lildeer2,1,3,(chtype)'~'); - - - /* middeer1 */ - mvwaddch(middeer1,0,2,(chtype)'y'); - mvwaddch(middeer1,0,3,(chtype)'y'); - mvwaddch(middeer1,1,2,(chtype)'0'); - mvwaddch(middeer1,1,3,(chtype)'('); - mvwaddch(middeer1,1,4,(chtype)'='); - mvwaddch(middeer1,1,5,(chtype)')'); - mvwaddch(middeer1,1,6,(chtype)'~'); - mvwaddch(middeer1,2,3,(chtype)'\\'); - mvwaddch(middeer1,2,4,(chtype)'/'); - - /* middeer2 */ - mvwaddch(middeer2,0,2,(chtype)'y'); - mvwaddch(middeer2,0,3,(chtype)'y'); - mvwaddch(middeer2,1,2,(chtype)'0'); - mvwaddch(middeer2,1,3,(chtype)'('); - mvwaddch(middeer2,1,4,(chtype)'='); - mvwaddch(middeer2,1,5,(chtype)')'); - mvwaddch(middeer2,1,6,(chtype)'~'); - mvwaddch(middeer2,2,3,(chtype)'|'); - mvwaddch(middeer2,2,5,(chtype)'|'); - - /* middeer3 */ - mvwaddch(middeer3,0,2,(chtype)'y'); - mvwaddch(middeer3,0,3,(chtype)'y'); - mvwaddch(middeer3,1,2,(chtype)'0'); - mvwaddch(middeer3,1,3,(chtype)'('); - mvwaddch(middeer3,1,4,(chtype)'='); - mvwaddch(middeer3,1,5,(chtype)')'); - mvwaddch(middeer3,1,6,(chtype)'~'); - mvwaddch(middeer3,2,2,(chtype)'/'); - mvwaddch(middeer3,2,6,(chtype)'\\'); - - - /* bigdeer1 */ - mvwaddch(bigdeer1,0,17,(chtype)'\\'); - mvwaddch(bigdeer1,0,18,(chtype)'/'); - mvwaddch(bigdeer1,0,20,(chtype)'\\'); - mvwaddch(bigdeer1,0,21,(chtype)'/'); - mvwaddch(bigdeer1,1,18,(chtype)'\\'); - mvwaddch(bigdeer1,1,20,(chtype)'/'); - mvwaddch(bigdeer1,2,19,(chtype)'|'); - mvwaddch(bigdeer1,2,20,(chtype)'_'); - mvwaddch(bigdeer1,3,18,(chtype)'/'); - mvwaddch(bigdeer1,3,19,(chtype)'^'); - mvwaddch(bigdeer1,3,20,(chtype)'0'); - mvwaddch(bigdeer1,3,21,(chtype)'\\'); - mvwaddch(bigdeer1,4,17,(chtype)'/'); - mvwaddch(bigdeer1,4,18,(chtype)'/'); - mvwaddch(bigdeer1,4,19,(chtype)'\\'); - mvwaddch(bigdeer1,4,22,(chtype)'\\'); - mvwaddstr(bigdeer1,5,7,"^~~~~~~~~// ~~U"); - mvwaddstr(bigdeer1,6,7,"( \\_____( /"); - mvwaddstr(bigdeer1,7,8,"( ) /"); - mvwaddstr(bigdeer1,8,9,"\\\\ /"); - mvwaddstr(bigdeer1,9,11,"\\>/>"); - - /* bigdeer2 */ - mvwaddch(bigdeer2,0,17,(chtype)'\\'); - mvwaddch(bigdeer2,0,18,(chtype)'/'); - mvwaddch(bigdeer2,0,20,(chtype)'\\'); - mvwaddch(bigdeer2,0,21,(chtype)'/'); - mvwaddch(bigdeer2,1,18,(chtype)'\\'); - mvwaddch(bigdeer2,1,20,(chtype)'/'); - mvwaddch(bigdeer2,2,19,(chtype)'|'); - mvwaddch(bigdeer2,2,20,(chtype)'_'); - mvwaddch(bigdeer2,3,18,(chtype)'/'); - mvwaddch(bigdeer2,3,19,(chtype)'^'); - mvwaddch(bigdeer2,3,20,(chtype)'0'); - mvwaddch(bigdeer2,3,21,(chtype)'\\'); - mvwaddch(bigdeer2,4,17,(chtype)'/'); - mvwaddch(bigdeer2,4,18,(chtype)'/'); - mvwaddch(bigdeer2,4,19,(chtype)'\\'); - mvwaddch(bigdeer2,4,22,(chtype)'\\'); - mvwaddstr(bigdeer2,5,7,"^~~~~~~~~// ~~U"); - mvwaddstr(bigdeer2,6,7,"(( )____( /"); - mvwaddstr(bigdeer2,7,7,"( / |"); - mvwaddstr(bigdeer2,8,8,"\\/ |"); - mvwaddstr(bigdeer2,9,9,"|> |>"); - - /* bigdeer3 */ - mvwaddch(bigdeer3,0,17,(chtype)'\\'); - mvwaddch(bigdeer3,0,18,(chtype)'/'); - mvwaddch(bigdeer3,0,20,(chtype)'\\'); - mvwaddch(bigdeer3,0,21,(chtype)'/'); - mvwaddch(bigdeer3,1,18,(chtype)'\\'); - mvwaddch(bigdeer3,1,20,(chtype)'/'); - mvwaddch(bigdeer3,2,19,(chtype)'|'); - mvwaddch(bigdeer3,2,20,(chtype)'_'); - mvwaddch(bigdeer3,3,18,(chtype)'/'); - mvwaddch(bigdeer3,3,19,(chtype)'^'); - mvwaddch(bigdeer3,3,20,(chtype)'0'); - mvwaddch(bigdeer3,3,21,(chtype)'\\'); - mvwaddch(bigdeer3,4,17,(chtype)'/'); - mvwaddch(bigdeer3,4,18,(chtype)'/'); - mvwaddch(bigdeer3,4,19,(chtype)'\\'); - mvwaddch(bigdeer3,4,22,(chtype)'\\'); - mvwaddstr(bigdeer3,5,7,"^~~~~~~~~// ~~U"); - mvwaddstr(bigdeer3,6,6,"( ()_____( /"); - mvwaddstr(bigdeer3,7,6,"/ / /"); - mvwaddstr(bigdeer3,8,5,"|/ \\"); - mvwaddstr(bigdeer3,9,5,"/> \\>"); - - /* bigdeer4 */ - mvwaddch(bigdeer4,0,17,(chtype)'\\'); - mvwaddch(bigdeer4,0,18,(chtype)'/'); - mvwaddch(bigdeer4,0,20,(chtype)'\\'); - mvwaddch(bigdeer4,0,21,(chtype)'/'); - mvwaddch(bigdeer4,1,18,(chtype)'\\'); - mvwaddch(bigdeer4,1,20,(chtype)'/'); - mvwaddch(bigdeer4,2,19,(chtype)'|'); - mvwaddch(bigdeer4,2,20,(chtype)'_'); - mvwaddch(bigdeer4,3,18,(chtype)'/'); - mvwaddch(bigdeer4,3,19,(chtype)'^'); - mvwaddch(bigdeer4,3,20,(chtype)'0'); - mvwaddch(bigdeer4,3,21,(chtype)'\\'); - mvwaddch(bigdeer4,4,17,(chtype)'/'); - mvwaddch(bigdeer4,4,18,(chtype)'/'); - mvwaddch(bigdeer4,4,19,(chtype)'\\'); - mvwaddch(bigdeer4,4,22,(chtype)'\\'); - mvwaddstr(bigdeer4,5,7,"^~~~~~~~~// ~~U"); - mvwaddstr(bigdeer4,6,6,"( )______( /"); - mvwaddstr(bigdeer4,7,5,"(/ \\"); - mvwaddstr(bigdeer4,8,0,"v___= ----^"); - - - /* lookdeer1 */ - mvwaddstr(lookdeer1,0,16,"\\/ \\/"); - mvwaddstr(lookdeer1,1,17,"\\Y/ \\Y/"); - mvwaddstr(lookdeer1,2,19,"\\=/"); - mvwaddstr(lookdeer1,3,17,"^\\o o/^"); - mvwaddstr(lookdeer1,4,17,"//( )"); - mvwaddstr(lookdeer1,5,7,"^~~~~~~~~// \\O/"); - mvwaddstr(lookdeer1,6,7,"( \\_____( /"); - mvwaddstr(lookdeer1,7,8,"( ) /"); - mvwaddstr(lookdeer1,8,9,"\\\\ /"); - mvwaddstr(lookdeer1,9,11,"\\>/>"); - - /* lookdeer2 */ - mvwaddstr(lookdeer2,0,16,"\\/ \\/"); - mvwaddstr(lookdeer2,1,17,"\\Y/ \\Y/"); - mvwaddstr(lookdeer2,2,19,"\\=/"); - mvwaddstr(lookdeer2,3,17,"^\\o o/^"); - mvwaddstr(lookdeer2,4,17,"//( )"); - mvwaddstr(lookdeer2,5,7,"^~~~~~~~~// \\O/"); - mvwaddstr(lookdeer2,6,7,"(( )____( /"); - mvwaddstr(lookdeer2,7,7,"( / |"); - mvwaddstr(lookdeer2,8,8,"\\/ |"); - mvwaddstr(lookdeer2,9,9,"|> |>"); - - /* lookdeer3 */ - mvwaddstr(lookdeer3,0,16,"\\/ \\/"); - mvwaddstr(lookdeer3,1,17,"\\Y/ \\Y/"); - mvwaddstr(lookdeer3,2,19,"\\=/"); - mvwaddstr(lookdeer3,3,17,"^\\o o/^"); - mvwaddstr(lookdeer3,4,17,"//( )"); - mvwaddstr(lookdeer3,5,7,"^~~~~~~~~// \\O/"); - mvwaddstr(lookdeer3,6,6,"( ()_____( /"); - mvwaddstr(lookdeer3,7,6,"/ / /"); - mvwaddstr(lookdeer3,8,5,"|/ \\"); - mvwaddstr(lookdeer3,9,5,"/> \\>"); - - /* lookdeer4 */ - mvwaddstr(lookdeer4,0,16,"\\/ \\/"); - mvwaddstr(lookdeer4,1,17,"\\Y/ \\Y/"); - mvwaddstr(lookdeer4,2,19,"\\=/"); - mvwaddstr(lookdeer4,3,17,"^\\o o/^"); - mvwaddstr(lookdeer4,4,17,"//( )"); - mvwaddstr(lookdeer4,5,7,"^~~~~~~~~// \\O/"); - mvwaddstr(lookdeer4,6,6,"( )______( /"); - mvwaddstr(lookdeer4,7,5,"(/ \\"); - mvwaddstr(lookdeer4,8,0,"v___= ----^"); - - + } + curs_set(0); + + treescrn = newwin(16, 27, 3, 53); + treescrn2 = newwin(16, 27, 3, 53); + treescrn3 = newwin(16, 27, 3, 53); + treescrn4 = newwin(16, 27, 3, 53); + treescrn5 = newwin(16, 27, 3, 53); + treescrn6 = newwin(16, 27, 3, 53); + treescrn7 = newwin(16, 27, 3, 53); + treescrn8 = newwin(16, 27, 3, 53); + + dotdeer0 = newwin(3, 71, 0, 8); + + stardeer0 = newwin(4, 56, 0, 8); + + lildeer0 = newwin(7, 53, 0, 8); + lildeer1 = newwin(2, 4, 0, 0); + lildeer2 = newwin(2, 4, 0, 0); + lildeer3 = newwin(2, 4, 0, 0); + + middeer0 = newwin(15, 42, 0, 8); + middeer1 = newwin(3, 7, 0, 0); + middeer2 = newwin(3, 7, 0, 0); + middeer3 = newwin(3, 7, 0, 0); + + bigdeer0 = newwin(10, 23, 0, 0); + bigdeer1 = newwin(10, 23, 0, 0); + bigdeer2 = newwin(10, 23, 0, 0); + bigdeer3 = newwin(10, 23, 0, 0); + bigdeer4 = newwin(10, 23, 0, 0); + + lookdeer0 = newwin(10, 25, 0, 0); + lookdeer1 = newwin(10, 25, 0, 0); + lookdeer2 = newwin(10, 25, 0, 0); + lookdeer3 = newwin(10, 25, 0, 0); + lookdeer4 = newwin(10, 25, 0, 0); + + w_holiday = newwin(1, 26, 3, 27); + + w_del_msg = newwin(1, 19, 23, 60); + + mvwaddstr(w_del_msg, 0, 0, "Hit any key to quit"); + + mvwaddstr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S"); + + /* set up the windows for our various reindeer */ + + /* lildeer1 */ + mvwaddch(lildeer1, 0, 0, (chtype) 'V'); + mvwaddch(lildeer1, 1, 0, (chtype) '@'); + mvwaddch(lildeer1, 1, 1, (chtype) '<'); + mvwaddch(lildeer1, 1, 2, (chtype) '>'); + mvwaddch(lildeer1, 1, 3, (chtype) '~'); + + /* lildeer2 */ + mvwaddch(lildeer2, 0, 0, (chtype) 'V'); + mvwaddch(lildeer2, 1, 0, (chtype) '@'); + mvwaddch(lildeer2, 1, 1, (chtype) '|'); + mvwaddch(lildeer2, 1, 2, (chtype) '|'); + mvwaddch(lildeer2, 1, 3, (chtype) '~'); + + /* lildeer3 */ + mvwaddch(lildeer3, 0, 0, (chtype) 'V'); + mvwaddch(lildeer3, 1, 0, (chtype) '@'); + mvwaddch(lildeer3, 1, 1, (chtype) '>'); + mvwaddch(lildeer3, 1, 2, (chtype) '<'); + mvwaddch(lildeer2, 1, 3, (chtype) '~'); + + /* middeer1 */ + mvwaddch(middeer1, 0, 2, (chtype) 'y'); + mvwaddch(middeer1, 0, 3, (chtype) 'y'); + mvwaddch(middeer1, 1, 2, (chtype) '0'); + mvwaddch(middeer1, 1, 3, (chtype) '('); + mvwaddch(middeer1, 1, 4, (chtype) '='); + mvwaddch(middeer1, 1, 5, (chtype) ')'); + mvwaddch(middeer1, 1, 6, (chtype) '~'); + mvwaddch(middeer1, 2, 3, (chtype) '\\'); + mvwaddch(middeer1, 2, 4, (chtype) '/'); + + /* middeer2 */ + mvwaddch(middeer2, 0, 2, (chtype) 'y'); + mvwaddch(middeer2, 0, 3, (chtype) 'y'); + mvwaddch(middeer2, 1, 2, (chtype) '0'); + mvwaddch(middeer2, 1, 3, (chtype) '('); + mvwaddch(middeer2, 1, 4, (chtype) '='); + mvwaddch(middeer2, 1, 5, (chtype) ')'); + mvwaddch(middeer2, 1, 6, (chtype) '~'); + mvwaddch(middeer2, 2, 3, (chtype) '|'); + mvwaddch(middeer2, 2, 5, (chtype) '|'); + + /* middeer3 */ + mvwaddch(middeer3, 0, 2, (chtype) 'y'); + mvwaddch(middeer3, 0, 3, (chtype) 'y'); + mvwaddch(middeer3, 1, 2, (chtype) '0'); + mvwaddch(middeer3, 1, 3, (chtype) '('); + mvwaddch(middeer3, 1, 4, (chtype) '='); + mvwaddch(middeer3, 1, 5, (chtype) ')'); + mvwaddch(middeer3, 1, 6, (chtype) '~'); + mvwaddch(middeer3, 2, 2, (chtype) '/'); + mvwaddch(middeer3, 2, 6, (chtype) '\\'); + + /* bigdeer1 */ + mvwaddch(bigdeer1, 0, 17, (chtype) '\\'); + mvwaddch(bigdeer1, 0, 18, (chtype) '/'); + mvwaddch(bigdeer1, 0, 20, (chtype) '\\'); + mvwaddch(bigdeer1, 0, 21, (chtype) '/'); + mvwaddch(bigdeer1, 1, 18, (chtype) '\\'); + mvwaddch(bigdeer1, 1, 20, (chtype) '/'); + mvwaddch(bigdeer1, 2, 19, (chtype) '|'); + mvwaddch(bigdeer1, 2, 20, (chtype) '_'); + mvwaddch(bigdeer1, 3, 18, (chtype) '/'); + mvwaddch(bigdeer1, 3, 19, (chtype) '^'); + mvwaddch(bigdeer1, 3, 20, (chtype) '0'); + mvwaddch(bigdeer1, 3, 21, (chtype) '\\'); + mvwaddch(bigdeer1, 4, 17, (chtype) '/'); + mvwaddch(bigdeer1, 4, 18, (chtype) '/'); + mvwaddch(bigdeer1, 4, 19, (chtype) '\\'); + mvwaddch(bigdeer1, 4, 22, (chtype) '\\'); + mvwaddstr(bigdeer1, 5, 7, "^~~~~~~~~// ~~U"); + mvwaddstr(bigdeer1, 6, 7, "( \\_____( /"); + mvwaddstr(bigdeer1, 7, 8, "( ) /"); + mvwaddstr(bigdeer1, 8, 9, "\\\\ /"); + mvwaddstr(bigdeer1, 9, 11, "\\>/>"); + + /* bigdeer2 */ + mvwaddch(bigdeer2, 0, 17, (chtype) '\\'); + mvwaddch(bigdeer2, 0, 18, (chtype) '/'); + mvwaddch(bigdeer2, 0, 20, (chtype) '\\'); + mvwaddch(bigdeer2, 0, 21, (chtype) '/'); + mvwaddch(bigdeer2, 1, 18, (chtype) '\\'); + mvwaddch(bigdeer2, 1, 20, (chtype) '/'); + mvwaddch(bigdeer2, 2, 19, (chtype) '|'); + mvwaddch(bigdeer2, 2, 20, (chtype) '_'); + mvwaddch(bigdeer2, 3, 18, (chtype) '/'); + mvwaddch(bigdeer2, 3, 19, (chtype) '^'); + mvwaddch(bigdeer2, 3, 20, (chtype) '0'); + mvwaddch(bigdeer2, 3, 21, (chtype) '\\'); + mvwaddch(bigdeer2, 4, 17, (chtype) '/'); + mvwaddch(bigdeer2, 4, 18, (chtype) '/'); + mvwaddch(bigdeer2, 4, 19, (chtype) '\\'); + mvwaddch(bigdeer2, 4, 22, (chtype) '\\'); + mvwaddstr(bigdeer2, 5, 7, "^~~~~~~~~// ~~U"); + mvwaddstr(bigdeer2, 6, 7, "(( )____( /"); + mvwaddstr(bigdeer2, 7, 7, "( / |"); + mvwaddstr(bigdeer2, 8, 8, "\\/ |"); + mvwaddstr(bigdeer2, 9, 9, "|> |>"); + + /* bigdeer3 */ + mvwaddch(bigdeer3, 0, 17, (chtype) '\\'); + mvwaddch(bigdeer3, 0, 18, (chtype) '/'); + mvwaddch(bigdeer3, 0, 20, (chtype) '\\'); + mvwaddch(bigdeer3, 0, 21, (chtype) '/'); + mvwaddch(bigdeer3, 1, 18, (chtype) '\\'); + mvwaddch(bigdeer3, 1, 20, (chtype) '/'); + mvwaddch(bigdeer3, 2, 19, (chtype) '|'); + mvwaddch(bigdeer3, 2, 20, (chtype) '_'); + mvwaddch(bigdeer3, 3, 18, (chtype) '/'); + mvwaddch(bigdeer3, 3, 19, (chtype) '^'); + mvwaddch(bigdeer3, 3, 20, (chtype) '0'); + mvwaddch(bigdeer3, 3, 21, (chtype) '\\'); + mvwaddch(bigdeer3, 4, 17, (chtype) '/'); + mvwaddch(bigdeer3, 4, 18, (chtype) '/'); + mvwaddch(bigdeer3, 4, 19, (chtype) '\\'); + mvwaddch(bigdeer3, 4, 22, (chtype) '\\'); + mvwaddstr(bigdeer3, 5, 7, "^~~~~~~~~// ~~U"); + mvwaddstr(bigdeer3, 6, 6, "( ()_____( /"); + mvwaddstr(bigdeer3, 7, 6, "/ / /"); + mvwaddstr(bigdeer3, 8, 5, "|/ \\"); + mvwaddstr(bigdeer3, 9, 5, "/> \\>"); + + /* bigdeer4 */ + mvwaddch(bigdeer4, 0, 17, (chtype) '\\'); + mvwaddch(bigdeer4, 0, 18, (chtype) '/'); + mvwaddch(bigdeer4, 0, 20, (chtype) '\\'); + mvwaddch(bigdeer4, 0, 21, (chtype) '/'); + mvwaddch(bigdeer4, 1, 18, (chtype) '\\'); + mvwaddch(bigdeer4, 1, 20, (chtype) '/'); + mvwaddch(bigdeer4, 2, 19, (chtype) '|'); + mvwaddch(bigdeer4, 2, 20, (chtype) '_'); + mvwaddch(bigdeer4, 3, 18, (chtype) '/'); + mvwaddch(bigdeer4, 3, 19, (chtype) '^'); + mvwaddch(bigdeer4, 3, 20, (chtype) '0'); + mvwaddch(bigdeer4, 3, 21, (chtype) '\\'); + mvwaddch(bigdeer4, 4, 17, (chtype) '/'); + mvwaddch(bigdeer4, 4, 18, (chtype) '/'); + mvwaddch(bigdeer4, 4, 19, (chtype) '\\'); + mvwaddch(bigdeer4, 4, 22, (chtype) '\\'); + mvwaddstr(bigdeer4, 5, 7, "^~~~~~~~~// ~~U"); + mvwaddstr(bigdeer4, 6, 6, "( )______( /"); + mvwaddstr(bigdeer4, 7, 5, "(/ \\"); + mvwaddstr(bigdeer4, 8, 0, "v___= ----^"); + + /* lookdeer1 */ + mvwaddstr(lookdeer1, 0, 16, "\\/ \\/"); + mvwaddstr(lookdeer1, 1, 17, "\\Y/ \\Y/"); + mvwaddstr(lookdeer1, 2, 19, "\\=/"); + mvwaddstr(lookdeer1, 3, 17, "^\\o o/^"); + mvwaddstr(lookdeer1, 4, 17, "//( )"); + mvwaddstr(lookdeer1, 5, 7, "^~~~~~~~~// \\O/"); + mvwaddstr(lookdeer1, 6, 7, "( \\_____( /"); + mvwaddstr(lookdeer1, 7, 8, "( ) /"); + mvwaddstr(lookdeer1, 8, 9, "\\\\ /"); + mvwaddstr(lookdeer1, 9, 11, "\\>/>"); + + /* lookdeer2 */ + mvwaddstr(lookdeer2, 0, 16, "\\/ \\/"); + mvwaddstr(lookdeer2, 1, 17, "\\Y/ \\Y/"); + mvwaddstr(lookdeer2, 2, 19, "\\=/"); + mvwaddstr(lookdeer2, 3, 17, "^\\o o/^"); + mvwaddstr(lookdeer2, 4, 17, "//( )"); + mvwaddstr(lookdeer2, 5, 7, "^~~~~~~~~// \\O/"); + mvwaddstr(lookdeer2, 6, 7, "(( )____( /"); + mvwaddstr(lookdeer2, 7, 7, "( / |"); + mvwaddstr(lookdeer2, 8, 8, "\\/ |"); + mvwaddstr(lookdeer2, 9, 9, "|> |>"); + + /* lookdeer3 */ + mvwaddstr(lookdeer3, 0, 16, "\\/ \\/"); + mvwaddstr(lookdeer3, 1, 17, "\\Y/ \\Y/"); + mvwaddstr(lookdeer3, 2, 19, "\\=/"); + mvwaddstr(lookdeer3, 3, 17, "^\\o o/^"); + mvwaddstr(lookdeer3, 4, 17, "//( )"); + mvwaddstr(lookdeer3, 5, 7, "^~~~~~~~~// \\O/"); + mvwaddstr(lookdeer3, 6, 6, "( ()_____( /"); + mvwaddstr(lookdeer3, 7, 6, "/ / /"); + mvwaddstr(lookdeer3, 8, 5, "|/ \\"); + mvwaddstr(lookdeer3, 9, 5, "/> \\>"); + + /* lookdeer4 */ + mvwaddstr(lookdeer4, 0, 16, "\\/ \\/"); + mvwaddstr(lookdeer4, 1, 17, "\\Y/ \\Y/"); + mvwaddstr(lookdeer4, 2, 19, "\\=/"); + mvwaddstr(lookdeer4, 3, 17, "^\\o o/^"); + mvwaddstr(lookdeer4, 4, 17, "//( )"); + mvwaddstr(lookdeer4, 5, 7, "^~~~~~~~~// \\O/"); + mvwaddstr(lookdeer4, 6, 6, "( )______( /"); + mvwaddstr(lookdeer4, 7, 5, "(/ \\"); + mvwaddstr(lookdeer4, 8, 0, "v___= ----^"); /***********************************************/ - cbreak(); - nodelay(stdscr,TRUE); - for (;;) { - clear(); - werase(treescrn); - touchwin(w_del_msg); - touchwin(treescrn); - werase(treescrn2); - touchwin(treescrn2); - werase(treescrn8); - touchwin(treescrn8); - refresh(); - look_out(150); - boxit(); - refresh(); - look_out(150); - seas(); - refresh(); - look_out(150); - greet(); - refresh(); - look_out(150); - fromwho(); - refresh(); - look_out(150); - tree(); - look_out(150); - balls(); - look_out(150); - star(); - look_out(150); - strng1(); - strng2(); - strng3(); - strng4(); - strng5(); - + cbreak(); + nodelay(stdscr, TRUE); + for (;;) { + clear(); + werase(treescrn); + touchwin(w_del_msg); + touchwin(treescrn); + werase(treescrn2); + touchwin(treescrn2); + werase(treescrn8); + touchwin(treescrn8); + refresh(); + look_out(150); + boxit(); + refresh(); + look_out(150); + seas(); + refresh(); + look_out(150); + greet(); + refresh(); + look_out(150); + fromwho(); + refresh(); + look_out(150); + tree(); + look_out(150); + balls(); + look_out(150); + star(); + look_out(150); + strng1(); + strng2(); + strng3(); + strng4(); + strng5(); /* set up the windows for our blinking trees */ /* **************************************** */ /* treescrn3 */ - overlay(treescrn, treescrn3); + overlay(treescrn, treescrn3); - /*balls*/ - mvwaddch(treescrn3, 4, 18, ' '); - mvwaddch(treescrn3, 7, 6, ' '); - mvwaddch(treescrn3, 8, 19, ' '); - mvwaddch(treescrn3, 11, 22, ' '); + /*balls */ + mvwaddch(treescrn3, 4, 18, ' '); + mvwaddch(treescrn3, 7, 6, ' '); + mvwaddch(treescrn3, 8, 19, ' '); + mvwaddch(treescrn3, 11, 22, ' '); - /*star*/ - mvwaddch(treescrn3, 0, 12, '*'); + /*star */ + mvwaddch(treescrn3, 0, 12, '*'); - /*strng1*/ - mvwaddch(treescrn3, 3, 11, ' '); + /*strng1 */ + mvwaddch(treescrn3, 3, 11, ' '); - /*strng2*/ - mvwaddch(treescrn3, 5, 13, ' '); - mvwaddch(treescrn3, 6, 10, ' '); + /*strng2 */ + mvwaddch(treescrn3, 5, 13, ' '); + mvwaddch(treescrn3, 6, 10, ' '); - /*strng3*/ - mvwaddch(treescrn3, 7, 16, ' '); - mvwaddch(treescrn3, 7, 14, ' '); + /*strng3 */ + mvwaddch(treescrn3, 7, 16, ' '); + mvwaddch(treescrn3, 7, 14, ' '); - /*strng4*/ - mvwaddch(treescrn3, 10, 13, ' '); - mvwaddch(treescrn3, 10, 10, ' '); - mvwaddch(treescrn3, 11, 8, ' '); - - /*strng5*/ - mvwaddch(treescrn3, 11, 18, ' '); - mvwaddch(treescrn3, 12, 13, ' '); + /*strng4 */ + mvwaddch(treescrn3, 10, 13, ' '); + mvwaddch(treescrn3, 10, 10, ' '); + mvwaddch(treescrn3, 11, 8, ' '); + /*strng5 */ + mvwaddch(treescrn3, 11, 18, ' '); + mvwaddch(treescrn3, 12, 13, ' '); /* treescrn4 */ - overlay(treescrn, treescrn4); - - /*balls*/ - mvwaddch(treescrn4, 3, 9, ' '); - mvwaddch(treescrn4, 4, 16, ' '); - mvwaddch(treescrn4, 7, 6, ' '); - mvwaddch(treescrn4, 8, 19, ' '); - mvwaddch(treescrn4, 11, 2, ' '); - mvwaddch(treescrn4, 12, 23, ' '); + overlay(treescrn, treescrn4); - /*star*/ - wstandout(treescrn4); - mvwaddch(treescrn4, 0, 12, '*'); - wstandend(treescrn4); + /*balls */ + mvwaddch(treescrn4, 3, 9, ' '); + mvwaddch(treescrn4, 4, 16, ' '); + mvwaddch(treescrn4, 7, 6, ' '); + mvwaddch(treescrn4, 8, 19, ' '); + mvwaddch(treescrn4, 11, 2, ' '); + mvwaddch(treescrn4, 12, 23, ' '); - /*strng1*/ - mvwaddch(treescrn4, 3, 13, ' '); + /*star */ + wstandout(treescrn4); + mvwaddch(treescrn4, 0, 12, '*'); + wstandend(treescrn4); - /*strng2*/ + /*strng1 */ + mvwaddch(treescrn4, 3, 13, ' '); - /*strng3*/ - mvwaddch(treescrn4, 7, 15, ' '); - mvwaddch(treescrn4, 8, 11, ' '); + /*strng2 */ - /*strng4*/ - mvwaddch(treescrn4, 9, 16, ' '); - mvwaddch(treescrn4, 10, 12, ' '); - mvwaddch(treescrn4, 11, 8, ' '); + /*strng3 */ + mvwaddch(treescrn4, 7, 15, ' '); + mvwaddch(treescrn4, 8, 11, ' '); - /*strng5*/ - mvwaddch(treescrn4, 11, 18, ' '); - mvwaddch(treescrn4, 12, 14, ' '); + /*strng4 */ + mvwaddch(treescrn4, 9, 16, ' '); + mvwaddch(treescrn4, 10, 12, ' '); + mvwaddch(treescrn4, 11, 8, ' '); + /*strng5 */ + mvwaddch(treescrn4, 11, 18, ' '); + mvwaddch(treescrn4, 12, 14, ' '); /* treescrn5 */ - overlay(treescrn, treescrn5); + overlay(treescrn, treescrn5); - /*balls*/ - mvwaddch(treescrn5, 3, 15, ' '); - mvwaddch(treescrn5, 10, 20, ' '); - mvwaddch(treescrn5, 12, 1, ' '); + /*balls */ + mvwaddch(treescrn5, 3, 15, ' '); + mvwaddch(treescrn5, 10, 20, ' '); + mvwaddch(treescrn5, 12, 1, ' '); - /*star*/ - mvwaddch(treescrn5, 0, 12, '*'); + /*star */ + mvwaddch(treescrn5, 0, 12, '*'); - /*strng1*/ - mvwaddch(treescrn5, 3, 11, ' '); + /*strng1 */ + mvwaddch(treescrn5, 3, 11, ' '); - /*strng2*/ - mvwaddch(treescrn5, 5, 12, ' '); + /*strng2 */ + mvwaddch(treescrn5, 5, 12, ' '); - /*strng3*/ - mvwaddch(treescrn5, 7, 14, ' '); - mvwaddch(treescrn5, 8, 10, ' '); + /*strng3 */ + mvwaddch(treescrn5, 7, 14, ' '); + mvwaddch(treescrn5, 8, 10, ' '); - /*strng4*/ - mvwaddch(treescrn5, 9, 15, ' '); - mvwaddch(treescrn5, 10, 11, ' '); - mvwaddch(treescrn5, 11, 7, ' '); + /*strng4 */ + mvwaddch(treescrn5, 9, 15, ' '); + mvwaddch(treescrn5, 10, 11, ' '); + mvwaddch(treescrn5, 11, 7, ' '); - /*strng5*/ - mvwaddch(treescrn5, 11, 17, ' '); - mvwaddch(treescrn5, 12, 13, ' '); + /*strng5 */ + mvwaddch(treescrn5, 11, 17, ' '); + mvwaddch(treescrn5, 12, 13, ' '); /* treescrn6 */ - overlay(treescrn, treescrn6); + overlay(treescrn, treescrn6); - /*balls*/ - mvwaddch(treescrn6, 6, 7, ' '); - mvwaddch(treescrn6, 7, 18, ' '); - mvwaddch(treescrn6, 10, 4, ' '); - mvwaddch(treescrn6, 11, 23, ' '); + /*balls */ + mvwaddch(treescrn6, 6, 7, ' '); + mvwaddch(treescrn6, 7, 18, ' '); + mvwaddch(treescrn6, 10, 4, ' '); + mvwaddch(treescrn6, 11, 23, ' '); - /*star*/ - wstandout(treescrn6); - mvwaddch(treescrn6, 0, 12, '*'); - wstandend(treescrn6); + /*star */ + wstandout(treescrn6); + mvwaddch(treescrn6, 0, 12, '*'); + wstandend(treescrn6); - /*strng1*/ + /*strng1 */ - /*strng2*/ - mvwaddch(treescrn6, 5, 11, ' '); + /*strng2 */ + mvwaddch(treescrn6, 5, 11, ' '); - /*strng3*/ - mvwaddch(treescrn6, 7, 13, ' '); - mvwaddch(treescrn6, 8, 9, ' '); + /*strng3 */ + mvwaddch(treescrn6, 7, 13, ' '); + mvwaddch(treescrn6, 8, 9, ' '); - /*strng4*/ - mvwaddch(treescrn6, 9, 14, ' '); - mvwaddch(treescrn6, 10, 10, ' '); - mvwaddch(treescrn6, 11, 6, ' '); + /*strng4 */ + mvwaddch(treescrn6, 9, 14, ' '); + mvwaddch(treescrn6, 10, 10, ' '); + mvwaddch(treescrn6, 11, 6, ' '); - /*strng5*/ - mvwaddch(treescrn6, 11, 16, ' '); - mvwaddch(treescrn6, 12, 12, ' '); + /*strng5 */ + mvwaddch(treescrn6, 11, 16, ' '); + mvwaddch(treescrn6, 12, 12, ' '); /* treescrn7 */ - overlay(treescrn, treescrn7); - - /*balls*/ - mvwaddch(treescrn7, 3, 15, ' '); - mvwaddch(treescrn7, 6, 7, ' '); - mvwaddch(treescrn7, 7, 18, ' '); - mvwaddch(treescrn7, 10, 4, ' '); - mvwaddch(treescrn7, 11, 22, ' '); + overlay(treescrn, treescrn7); - /*star*/ - mvwaddch(treescrn7, 0, 12, '*'); + /*balls */ + mvwaddch(treescrn7, 3, 15, ' '); + mvwaddch(treescrn7, 6, 7, ' '); + mvwaddch(treescrn7, 7, 18, ' '); + mvwaddch(treescrn7, 10, 4, ' '); + mvwaddch(treescrn7, 11, 22, ' '); - /*strng1*/ - mvwaddch(treescrn7, 3, 12, ' '); + /*star */ + mvwaddch(treescrn7, 0, 12, '*'); - /*strng2*/ - mvwaddch(treescrn7, 5, 13, ' '); - mvwaddch(treescrn7, 6, 9, ' '); + /*strng1 */ + mvwaddch(treescrn7, 3, 12, ' '); - /*strng3*/ - mvwaddch(treescrn7, 7, 15, ' '); - mvwaddch(treescrn7, 8, 11, ' '); + /*strng2 */ + mvwaddch(treescrn7, 5, 13, ' '); + mvwaddch(treescrn7, 6, 9, ' '); - /*strng4*/ - mvwaddch(treescrn7, 9, 16, ' '); - mvwaddch(treescrn7, 10, 12, ' '); - mvwaddch(treescrn7, 11, 8, ' '); + /*strng3 */ + mvwaddch(treescrn7, 7, 15, ' '); + mvwaddch(treescrn7, 8, 11, ' '); - /*strng5*/ - mvwaddch(treescrn7, 11, 18, ' '); - mvwaddch(treescrn7, 12, 14, ' '); + /*strng4 */ + mvwaddch(treescrn7, 9, 16, ' '); + mvwaddch(treescrn7, 10, 12, ' '); + mvwaddch(treescrn7, 11, 8, ' '); + /*strng5 */ + mvwaddch(treescrn7, 11, 18, ' '); + mvwaddch(treescrn7, 12, 14, ' '); - look_out(150); - reindeer(); + look_out(150); + reindeer(); - touchwin(w_holiday); - wrefresh(w_holiday); - wrefresh(w_del_msg); + touchwin(w_holiday); + wrefresh(w_holiday); + wrefresh(w_del_msg); - look_out(500); - for(loopy = 0;loopy < 100;loopy++) { - blinkit(); - } + look_out(500); + for (loopy = 0; loopy < 100; loopy++) { + blinkit(); + } #ifdef NOLOOP - done(0); + done(0); #endif - } - /*NOTREACHED*/ + } + /*NOTREACHED */ } -static int boxit(void) +static int +boxit(void) { - int x = 0; + int x = 0; - while(x < 20) { - mvaddch(x, 7, '|'); - ++x; - } + while (x < 20) { + mvaddch(x, 7, '|'); + ++x; + } - x = 8; + x = 8; - while(x < 80) { - mvaddch(19, x, '_'); - ++x; - } + while (x < 80) { + mvaddch(19, x, '_'); + ++x; + } - x = 0; + x = 0; - while(x < 80) { - mvaddch(22, x, '_'); - ++x; - } + while (x < 80) { + mvaddch(22, x, '_'); + ++x; + } - return( 0 ); + return (0); } -static int seas(void) +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 ); + 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) +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 ); + 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) +static int +fromwho(void) { - mvaddstr(21, 13, FROMWHO); - return( 0 ); + mvaddstr(21, 13, FROMWHO); + return (0); } -static int tree(void) +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 ); + 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) +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 ); + 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) +static int +star(void) { - wattrset(treescrn2, A_BOLD | A_BLINK); - set_color(treescrn2, COLOR_YELLOW); + wattrset(treescrn2, A_BOLD | A_BLINK); + set_color(treescrn2, COLOR_YELLOW); - mvwaddch(treescrn2, 0, 12, (chtype)'*'); - wstandend(treescrn2); + mvwaddch(treescrn2, 0, 12, (chtype) '*'); + wstandend(treescrn2); - unset_color(treescrn2); - wrefresh(treescrn2); - wrefresh(w_del_msg); - return( 0 ); + unset_color(treescrn2); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); } - -static int strng1(void) +static int +strng1(void) { - wattrset(treescrn2, A_BOLD | A_BLINK); - set_color(treescrn2, COLOR_WHITE); + 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)'.'); + mvwaddch(treescrn2, 3, 13, (chtype) '\''); + mvwaddch(treescrn2, 3, 12, (chtype) ':'); + mvwaddch(treescrn2, 3, 11, (chtype) '.'); - wattroff(treescrn2, A_BOLD | A_BLINK); - unset_color(treescrn2); + wattroff(treescrn2, A_BOLD | A_BLINK); + unset_color(treescrn2); - wrefresh(treescrn2); - wrefresh(w_del_msg); - return( 0 ); + wrefresh(treescrn2); + wrefresh(w_del_msg); + return (0); } - -static int strng2(void) +static int +strng2(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 ); + 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) +static int +strng3(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 ); + 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) +static int +strng4(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 ); + 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) +static int +strng5(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 ); + 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 +blinkit(void) { -static int cycle; + static int cycle; - if(cycle > 4) { - cycle = 0; - } + if (cycle > 4) { + cycle = 0; + } + touchwin(treescrn8); - 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); + 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***************************************************/ + /*ALL ON************************************************** */ - overlay(treescrn, treescrn8); - wrefresh(treescrn8); - wrefresh(w_del_msg); + overlay(treescrn, treescrn8); + wrefresh(treescrn8); + wrefresh(w_del_msg); - ++cycle; - return( 0 ); + ++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); + mvwin(win, y, x); + wrefresh(win); + wrefresh(w_del_msg); + look_out(5); } -static int reindeer(void) +static int +reindeer(void) { - int looper; - y_pos = 0; - + int looper; + y_pos = 0; - for(x_pos = 70; x_pos > 62; x_pos--) { - if(x_pos < 62) { + 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)'.'); + } + 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; + y_pos = 2; - for(; x_pos > 50; x_pos--) { - for(looper = 0; looper < 4; looper++) { + for (; x_pos > 50; x_pos--) { + for (looper = 0; looper < 4; looper++) { - if(x_pos < 56) { - y_pos = 3; + 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); + 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); + mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '*'); + wrefresh(dotdeer0); + wrefresh(w_del_msg); + werase(dotdeer0); + wrefresh(dotdeer0); + wrefresh(w_del_msg); } - } } + } - x_pos = 58; + x_pos = 58; - for(y_pos = 2; y_pos < 5; y_pos++) { + for (y_pos = 2; y_pos < 5; y_pos++) { - touchwin(lildeer0); - wrefresh(lildeer0); - wrefresh(w_del_msg); + touchwin(lildeer0); + wrefresh(lildeer0); + wrefresh(w_del_msg); - for(looper = 0; looper < 4; looper++) { + 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); @@ -1057,19 +1069,18 @@ static int reindeer(void) wrefresh(w_del_msg); x_pos -= 2; - } } + } + x_pos = 35; - x_pos = 35; + for (y_pos = 5; y_pos < 10; y_pos++) { - for(y_pos = 5; y_pos < 10; y_pos++) { - - touchwin(middeer0); - wrefresh(middeer0); - wrefresh(w_del_msg); + touchwin(middeer0); + wrefresh(middeer0); + wrefresh(w_del_msg); - for(looper = 0; looper < 2; looper++) { + 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); @@ -1081,40 +1092,40 @@ static int reindeer(void) wrefresh(w_del_msg); x_pos -= 3; - } } + } - look_out(300); + look_out(300); - y_pos = 1; + 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); - } + 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; + --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); - } + 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); + deer_step(lookdeer0, y_pos, x_pos); - for(; y_pos < 10; y_pos++) { - for(looper = 0; looper < 2; looper++) { + 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); @@ -1122,27 +1133,28 @@ static int reindeer(void) 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); } + deer_step(bigdeer0, y_pos, x_pos); + } - --y_pos; + --y_pos; - deer_step(lookdeer3, y_pos, x_pos); - return( 0 ); + deer_step(lookdeer3, y_pos, x_pos); + return (0); } -static RETSIGTYPE done(int sig GCC_UNUSED) +static RETSIGTYPE +done(int sig GCC_UNUSED) { - signal(SIGINT,done); - signal(SIGTERM,done); + signal(SIGINT, done); + signal(SIGTERM, done); #if !defined DOS && !defined OS2 - signal(SIGHUP,done); - signal(SIGQUIT,done); + signal(SIGHUP, done); + signal(SIGQUIT, done); #endif - move(LINES-1,0); - refresh(); - endwin(); - curs_set(1); - exit(EXIT_SUCCESS); + move(LINES - 1, 0); + refresh(); + endwin(); + curs_set(1); + exit(EXIT_SUCCESS); } |