- if (SP != 0
- && SP->_cleanup) {
- char tmp = ch;
- /*
- * POSIX says write() is safe in a signal handler, but the
- * buffered I/O is not.
- */
- write(fileno(NC_OUTPUT), &tmp, 1);
- } else {
- putc(ch, NC_OUTPUT);
- }
- return OK;
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0)
+{
+ (void) fflush(NC_OUTPUT(SP_PARM));
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+_nc_flush(void)
+{
+ NCURSES_SP_NAME(_nc_flush) (CURRENT_SCREEN);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch)
+{
+ int rc = OK;
+
+ COUNT_OUTCHARS(1);
+
+ if (HasTInfoTerminal(SP_PARM)
+ && SP_PARM != 0
+ && SP_PARM->_cleanup) {
+ char tmp = (char) ch;
+ /*
+ * POSIX says write() is safe in a signal handler, but the
+ * buffered I/O is not.
+ */
+ if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1) == -1)
+ rc = ERR;
+ } else {
+ if (putc(ch, NC_OUTPUT(SP_PARM)) == EOF)
+ rc = ERR;
+ }
+ return rc;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+_nc_outch(int ch)
+{
+ return NCURSES_SP_NAME(_nc_outch) (CURRENT_SCREEN, ch);
+}
+#endif
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(putp) (NCURSES_SP_DCLx const char *string)
+{
+ return NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
+ string, 1, NCURSES_SP_NAME(_nc_outch));
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx
+ const char *name GCC_UNUSED,
+ const char *string)
+{
+ int rc = ERR;
+
+ if (string != 0) {
+ TPUTS_TRACE(name);
+ rc = NCURSES_SP_NAME(putp) (NCURSES_SP_ARGx string);
+ }
+ return rc;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+putp(const char *string)
+{
+ return NCURSES_SP_NAME(putp) (CURRENT_SCREEN, string);