+ 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"));
+ fflush(stdout);