]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/demo_new_pair.c
ncurses 6.0 - patch 20170923
[ncurses.git] / test / demo_new_pair.c
index 1070c06ae2290ad91e5806b8eb0d2ad243cf5cb4..5f8e8e66a63ae8db4dfbac327b729f7d805666fe 100644 (file)
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_new_pair.c,v 1.13 2017/04/15 17:36:00 tom Exp $
+ * $Id: demo_new_pair.c,v 1.16 2017/09/04 11:47:44 tom Exp $
  *
  * Demonstrate the alloc_pair() function.
  */
@@ -229,8 +229,11 @@ main(int argc, char *argv[])
        fprintf(stderr, "cannot open terminal for output\n");
        ExitProgram(EXIT_FAILURE);
     }
-    if (newterm(NULL, output, stdin) == 0)
-       usage();
+    if (newterm(NULL, output, stdin) == 0) {
+       fprintf(stderr, "Cannot initialize terminal\n");
+       fclose(output);
+       ExitProgram(EXIT_FAILURE);
+    }
     (void) cbreak();           /* read chars without wait for \n */
     (void) noecho();           /* don't echo input */
     update_modes();
@@ -331,7 +334,7 @@ main(int argc, char *argv[])
        total_cells += 1 + (use_wide ? 1 : 0);
        ++current;
     }
-    endwin();
+    exit_curses();
     fclose(output);
 
     printf("%.1f cells/second\n",