]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/dots.c
ncurses 5.5
[ncurses.git] / test / dots.c
index 2e0190fc61bb26751b72074dba7260d980e4a93e..d70ab3e09c77b8dd0ad7a5320cce9afa4c37ff35 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1999-2001,2002 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            *
 /*
  * Author: Thomas E. Dickey <dickey@clark.net> 1999
  *
- * $Id: dots.c,v 1.8 2002/04/06 21:33:42 tom Exp $
+ * $Id: dots.c,v 1.11 2005/05/28 21:38:45 tom Exp $
  *
  * A simple demo of the terminfo interface.
  */
-#include <time.h>
-
 #include <test.priv.h>
 
+#include <time.h>
+
 #define valid(s) ((s != 0) && s != (char *)-1)
 
 static bool interrupted = FALSE;
@@ -101,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);
@@ -127,12 +127,16 @@ main(
                tputs(tparm2(set_a_foreground, z), 1, outc);
            } else {
                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);
+           if (ranf() <= 0.01) {
+               outs((ranf() > 0.6)
+                    ? enter_reverse_mode
+                    : exit_attribute_mode);
+               napms(1);
+           }
        }
        outc(p);
        fflush(stdout);