+ if (SP_PARM != 0 && SP_PARM->_ofd >= 0) {
+ if (SP_PARM->out_inuse) {
+ char *buf = SP_PARM->out_buffer;
+ size_t amount = SP->out_inuse;
+
+ SP->out_inuse = 0;
+ 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 {
+ fflush(stdout);
+ }