X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_tputs.c;h=9d859527f4439c5bbf44dabc19fd8a139e38f9ce;hp=b123cceef243eece1fe0aaefe3fa29bf1284f9a2;hb=59108c98bda25ae50b3a319e2bcb7f4b9a174024;hpb=dc6f2587b13a5294926467a2375922b3c30d302b diff --git a/ncurses/tinfo/lib_tputs.c b/ncurses/tinfo/lib_tputs.c index b123ccee..9d859527 100644 --- a/ncurses/tinfo/lib_tputs.c +++ b/ncurses/tinfo/lib_tputs.c @@ -51,7 +51,7 @@ #include /* ospeed */ #include -MODULE_ID("$Id: lib_tputs.c,v 1.77 2009/06/07 13:59:11 tom Exp $") +MODULE_ID("$Id: lib_tputs.c,v 1.78 2009/10/10 16:01:42 tom Exp $") NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ @@ -129,21 +129,25 @@ _nc_flush(void) 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 = ch; + char tmp = (char) ch; /* * POSIX says write() is safe in a signal handler, but the * buffered I/O is not. */ - write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1); + if (write(fileno(NC_OUTPUT(SP_PARM)), &tmp, 1) == -1) + rc = ERR; } else { - putc(ch, NC_OUTPUT(SP_PARM)); + if (putc(ch, NC_OUTPUT(SP_PARM)) == EOF) + rc = ERR; } - return OK; + return rc; } #if NCURSES_SP_FUNCS