]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/popup_msg.c
ncurses 6.2 - patch 20200718
[ncurses.git] / test / popup_msg.c
index 0b151febfc5a904c73e8cb4464ec622ec67d822c..5c0e5bad09898bfcea4c76b641dc74ff86d8eb64 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2017 Free Software Foundation, Inc.                        *
+ * Copyright 2018,2020 Thomas E. Dickey                                     *
+ * Copyright 2017 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            *
@@ -26,7 +27,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: popup_msg.c,v 1.7 2017/04/15 19:16:41 tom Exp $
+ * $Id: popup_msg.c,v 1.10 2020/02/02 23:34:34 tom Exp $
  *
  * Show a multi-line message in a window which may extend beyond the screen.
  *
@@ -37,6 +38,8 @@
 
 #include <popup_msg.h>
 
+#if HAVE_NEWPAD
+
 static WINDOW *old_window;
 
 static void
@@ -84,8 +87,10 @@ popup_msg(WINDOW *parent, const char *const *msg)
 
     if ((help = newwin(high, wide, y0, x0)) == 0)
        return;
-    if ((data = newpad(length + 1, width)) == 0)
+    if ((data = newpad(length + 1, width)) == 0) {
+       delwin(help);
        return;
+    }
 
     begin_popup();
 
@@ -167,3 +172,13 @@ popup_msg2(WINDOW *parent, char **msg)
 {
     popup_msg(parent, (const char *const *) msg);
 }
+
+#else
+void
+popup_msg(WINDOW *parent, const char *const *msg)
+{
+    (void) parent;
+    (void) msg;
+    beep();
+}
+#endif