ncurses 6.1 - patch 20191102
[ncurses.git] / test / savescreen.c
index 610b86d041bd1dd07730b7d63fd03099c80ecdbb..408020a6a958f2673794140f3486ff5d86cbc866 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 2007-2017,2018 Free Software Foundation, Inc.              *
+ * Copyright (c) 2007-2018,2019 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
  * authorization.                                                           *
  ****************************************************************************/
 /*
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: savescreen.c,v 1.52 2018/02/03 23:18:50 tom Exp $
+ * $Id: savescreen.c,v 1.55 2019/01/20 15:59:28 tom Exp $
  *
  * Demonstrate save/restore functions from the curses library.
  * Thomas Dickey - 2007/7/14
  */
 
  *
  * Demonstrate save/restore functions from the curses library.
  * Thomas Dickey - 2007/7/14
  */
 
+#define NEED_TIME_H
 #include <test.priv.h>
 #include <popup_msg.h>
 #include <parse_rgb.h>
 #include <test.priv.h>
 #include <popup_msg.h>
 #include <parse_rgb.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#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
-
 #if defined(__hpux)
 #define MyMarker 'X'
 #else
 #if defined(__hpux)
 #define MyMarker 'X'
 #else
@@ -69,10 +59,12 @@ static wchar_t
 BaseChar(cchar_t data)
 {
     wchar_t my_wchar[CCHARW_MAX];
 BaseChar(cchar_t data)
 {
     wchar_t my_wchar[CCHARW_MAX];
+    wchar_t result = 0;
     attr_t my_attr;
     short my_pair;
     attr_t my_attr;
     short my_pair;
-    getcchar(&data, my_wchar, &my_attr, &my_pair, NULL);
-    return my_wchar[0];
+    if (getcchar(&data, my_wchar, &my_attr, &my_pair, NULL) == OK)
+       result = my_wchar[0];
+    return result;
 }
 #endif
 
 }
 #endif
 
@@ -395,7 +387,7 @@ main(int argc, char *argv[])
                        while (col++ < cols) {
                            int color = (((r * (g_max + 1)) + g) * (b_max + 1)
                                         + b + MAX_ANSI);
                        while (col++ < cols) {
                            int color = (((r * (g_max + 1)) + g) * (b_max + 1)
                                         + b + MAX_ANSI);
-#if HAVE_INIT_EXTENDED_COLOR
+#if USE_EXTENDED_COLOR
                            init_extended_pair(pair, color, color);
 #else
                            init_pair(pair, color, color);
                            init_extended_pair(pair, color, color);
 #else
                            init_pair(pair, color, color);