+ if (ch == ERR) {
+ check_sigwinch:
+#if USE_SIZECHANGE
+ if (_nc_handle_sigwinch(sp)) {
+ _nc_update_screensize(sp);
+ /* resizeterm can push KEY_RESIZE */
+ if (cooked_key_in_fifo()) {
+ *result = fifo_pull(sp);
+ /*
+ * Get the ERR from queue -- it is from WINCH,
+ * so we should take it out, the "error" is handled.
+ */
+ if (fifo_peek(sp) == -1)
+ fifo_pull(sp);
+ returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
+ }
+ }
+#endif
+ returnCode(ERR);
+ }
+
+ /*
+ * If echo() is in effect, display the printable version of the
+ * key on the screen. Carriage return and backspace are treated
+ * specially by Solaris curses:
+ *
+ * If carriage return is defined as a function key in the
+ * terminfo, e.g., kent, then Solaris may return either ^J (or ^M
+ * if nonl() is set) or KEY_ENTER depending on the echo() mode.
+ * We echo before translating carriage return based on nonl(),
+ * since the visual result simply moves the cursor to column 0.
+ *
+ * Backspace is a different matter. Solaris curses does not
+ * translate it to KEY_BACKSPACE if kbs=^H. This does not depend
+ * on the stty modes, but appears to be a hardcoded special case.
+ * This is a difference from ncurses, which uses the terminfo entry.
+ * However, we provide the same visual result as Solaris, moving the
+ * cursor to the left.
+ */
+ if (sp->_echo && !(win->_flags & _ISPAD)) {
+ chtype backup = (chtype) ((ch == KEY_BACKSPACE) ? '\b' : ch);
+ if (backup < KEY_MIN)
+ wechochar(win, backup);
+ }
+
+ /*
+ * Simulate ICRNL mode
+ */
+ if ((ch == '\r') && sp->_nl)
+ ch = '\n';
+
+ /* Strip 8th-bit if so desired. We do this only for characters that
+ * are in the range 128-255, to provide compatibility with terminals
+ * that display only 7-bit characters. Note that 'ch' may be a
+ * function key at this point, so we mustn't strip _those_.
+ */
+ if (!use_meta)