]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/demo_altkeys.c
ncurses 6.1 - patch 20181229
[ncurses.git] / test / demo_altkeys.c
index 3dcb780b57346a08dccea580db5fee8b2ae80ef2..0f4e898a7a6c38baca71e14a77d6dfcaaa8d0761 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2005-2010,2016 Free Software Foundation, Inc.              *
+ * Copyright (c) 2005-2017,2018 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            *
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_altkeys.c,v 1.10 2016/09/04 20:17:42 tom Exp $
+ * $Id: demo_altkeys.c,v 1.12 2018/12/29 17:52:53 tom Exp $
  *
  * Demonstrate the define_key() function.
  * Thomas Dickey - 2005/10/22
  */
 
+#define NEED_TIME_H
 #include <test.priv.h>
 
 #if defined(NCURSES_VERSION) && NCURSES_EXT_FUNCS
 
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
 #define MY_LOGFILE "demo_altkeys.log"
 #define MY_KEYS (KEY_MAX + 1)
 
@@ -91,7 +81,10 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
 
     unlink(MY_LOGFILE);
 
-    newterm(0, stdout, stdin);
+    if (newterm(0, stdout, stdin) == 0) {
+       fprintf(stderr, "Cannot initialize terminal\n");
+       ExitProgram(EXIT_FAILURE);
+    }
     (void) cbreak();           /* take input chars one at a time, no wait for \n */
     (void) noecho();           /* don't echo input */