+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+delay_output(int ms)
+{
+ return NCURSES_SP_NAME(delay_output) (CURRENT_SCREEN, ms);
+}
+#endif
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0)
+{
+ T((T_CALLED("_nc_flush(%p)"), (void *) SP_PARM));
+ if (SP_PARM != 0 && SP_PARM->_ofd >= 0) {
+ TR(TRACE_CHARPUT, ("ofd:%d inuse:%lu buffer:%p",
+ SP_PARM->_ofd,
+ (unsigned long) SP_PARM->out_inuse,
+ SP_PARM->out_buffer));
+ if (SP_PARM->out_inuse) {
+ char *buf = SP_PARM->out_buffer;
+ size_t amount = SP_PARM->out_inuse;
+
+ TR(TRACE_CHARPUT, ("flushing %ld/%ld bytes",
+ (unsigned long) amount, _nc_outchars));
+ while (amount) {
+ ssize_t res = write(SP_PARM->_ofd, buf, amount);
+ if (res > 0) {
+ /* if the write was incomplete, try again */
+ amount -= (size_t) res;
+ buf += res;
+ } else if (errno == EAGAIN) {
+ continue;
+ } else if (errno == EINTR) {
+ continue;
+ } else {
+ break; /* an error we can not recover from */
+ }
+ }
+ } else if (SP_PARM->out_buffer == 0) {
+ TR(TRACE_CHARPUT, ("flushing stdout/stderr"));
+ fflush(stdout);
+ fflush(stderr);
+ }
+ } else {
+ TR(TRACE_CHARPUT, ("flushing stdout/stderr"));
+ fflush(stdout);
+ fflush(stderr);
+ }
+ if (SP_PARM != 0)
+ SP_PARM->out_inuse = 0;
+ returnVoid;
+}
+
+#if NCURSES_SP_FUNCS