]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/echochar.c
ncurses 6.1 - patch 20180127
[ncurses.git] / test / echochar.c
index 75916ba76f29f57b64d48248ae213e65eaa2a5e5..19ba9acd07e34a20f710d5dd034945af506810ff 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: echochar.c,v 1.13 2017/04/15 13:38:37 tom Exp $
+ * $Id: echochar.c,v 1.18 2017/10/18 23:04:52 tom Exp $
  *
  * Demonstrate the echochar function (compare to dots.c).
  * Thomas Dickey - 2006/11/4
@@ -36,8 +36,6 @@
 
 #include <time.h>
 
-#define valid(s) ((s != 0) && s != (char *)-1)
-
 static bool interrupted = FALSE;
 static long total_chars = 0;
 static time_t started;
@@ -45,9 +43,9 @@ static time_t started;
 static void
 cleanup(void)
 {
-    endwin();
+    exit_curses();
 
-    printf("\n\n%ld total chars, rate %.2f/sec\n",
+    printf("\n\n%ld total cells, rate %.2f/sec\n",
           total_chars,
           ((double) (total_chars) / (double) (time((time_t *) 0) - started)));
 }
@@ -98,13 +96,12 @@ main(int argc GCC_UNUSED,
            opt_r = TRUE;
            break;
        default:
-           fprintf(stderr, "usage: echochar [-r]\n");
+           fprintf(stderr, "Usage: echochar [-r]\n");
            ExitProgram(EXIT_FAILURE);
        }
     }
 
-    CATCHALL(onsig);
-    initscr();
+    InitAndCatch(initscr(), onsig);
 
     use_colors = has_colors();
     if (use_colors) {