X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fdots.c;h=d70ab3e09c77b8dd0ad7a5320cce9afa4c37ff35;hp=a5ddcaad58884dd668b8b5455e96ca5630ad1302;hb=55ccd2b959766810cf7db8d1c4462f338ce0afc8;hpb=b1f61d9f3aa244512045a6b02e759825d7049d34 diff --git a/test/dots.c b/test/dots.c index a5ddcaad..d70ab3e0 100644 --- a/test/dots.c +++ b/test/dots.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1999-2002,2004 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,16 +29,13 @@ /* * Author: Thomas E. Dickey 1999 * - * $Id: dots.c,v 1.4 2000/02/13 01:05:13 tom Exp $ + * $Id: dots.c,v 1.11 2005/05/28 21:38:45 tom Exp $ * * A simple demo of the terminfo interface. */ #include -#include /* for tparm() */ - #include -#include #define valid(s) ((s != 0) && s != (char *)-1) @@ -81,7 +78,7 @@ onsig(int n GCC_UNUSED) { interrupted = TRUE; cleanup(); - exit(EXIT_FAILURE); + ExitProgram(EXIT_FAILURE); } static float @@ -93,8 +90,8 @@ ranf(void) int main( - int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) + int argc GCC_UNUSED, + char *argv[]GCC_UNUSED) { int x, y, z, j, p; float r; @@ -104,7 +101,7 @@ main( if (signal(j, SIG_IGN) != SIG_IGN) signal(j, onsig); - srand(time(0)); + srand((unsigned) time(0)); setupterm((char *) 0, 1, (int *) 0); outs(clear_screen); outs(cursor_invisible); @@ -123,19 +120,23 @@ main( y = (int) (r * ranf()) + 2; p = (ranf() > 0.9) ? '*' : ' '; - tputs(tparm(cursor_address, y, x), 1, outc); + tputs(tparm3(cursor_address, y, x), 1, outc); if (max_colors > 0) { - z = (int)(ranf() * max_colors); + z = (int) (ranf() * max_colors); if (ranf() > 0.01) { - tputs(tparm(set_a_foreground, z), 1, outc); + tputs(tparm2(set_a_foreground, z), 1, outc); } else { - tputs(tparm(set_a_background, z), 1, outc); + tputs(tparm2(set_a_background, z), 1, outc); + napms(1); } } else if (valid(exit_attribute_mode) - && valid(enter_reverse_mode)) { - if (ranf() <= 0.01) - outs((ranf() > 0.6) ? enter_reverse_mode : - exit_attribute_mode); + && valid(enter_reverse_mode)) { + if (ranf() <= 0.01) { + outs((ranf() > 0.6) + ? enter_reverse_mode + : exit_attribute_mode); + napms(1); + } } outc(p); fflush(stdout);