+ TR(TRACE_CHARPUT, ("flushing %ld bytes", (unsigned long) amount));
+ 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 */
+ }
+ }