NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch) { int rc = OK; COUNT_OUTCHARS(1); if (HasTInfoTerminal(SP_PARM) && SP_PARM != 0) { if (SP_PARM->out_buffer != 0) { if (SP_PARM->out_inuse + 1 >= SP_PARM->out_limit) NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); SP_PARM->out_buffer[SP_PARM->out_inuse++] = (char) ch; } else { 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, (size_t) 1) == -1) rc = ERR; } } else { char tmp = (char) ch; if (write(fileno(stdout), &tmp, (size_t) 1) == -1) rc = ERR; } return rc; }
NCURSES_SP_NAME(nonl) (NCURSES_SP_DCL0) { T((T_CALLED("nonl(%p)"), (void *) SP_PARM)); if (0 == SP_PARM) returnCode(ERR); SP_PARM->_nl = FALSE; #ifdef __EMX__ _nc_flush(); _fsetmode(NC_OUTPUT(SP_PARM), "b"); #endif returnCode(OK); }
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; }
NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0) { (void) fflush(NC_OUTPUT(SP_PARM)); }