+/*
+ * Replace a window covering the whole screen, i.e., newscr or curscr.
+ */
+static WINDOW *
+replace_window(WINDOW *target, FILE *source)
+{
+ WINDOW *result = getwin(source);
+#if NCURSES_EXT_FUNCS
+ if (result != NULL) {
+ if (getmaxx(result) != getmaxx(target)
+ || getmaxy(result) != getmaxy(target)) {
+ int code = wresize(result,
+ 1 + getmaxy(target),
+ 1 + getmaxx(target));
+ if (code != OK) {
+ delwin(result);
+ result = NULL;
+ }
+ }
+ }
+#endif
+ return result;
+}
+