6 static int allwrite(op
,fd
,buf
,len
)
17 if (errno
== error_intr
) continue;
18 return -1; /* note that some data may have been written */
20 if (w
== 0) ; /* luser's fault */
35 return allwrite(s
->op
,s
->fd
,s
->x
,p
);
38 int substdio_bput(s
,buf
,len
)
45 while (len
> (n
= s
->n
- s
->p
)) {
46 byte_copy(s
->x
+ s
->p
,n
,buf
); s
->p
+= n
; buf
+= n
; len
-= n
;
47 if (substdio_flush(s
) == -1) return -1;
49 /* now len <= s->n - s->p */
50 byte_copy(s
->x
+ s
->p
,len
,buf
);
55 int substdio_put(s
,buf
,len
)
64 if (substdio_flush(s
) == -1) return -1;
66 if (n
< SUBSTDIO_OUTSIZE
) n
= SUBSTDIO_OUTSIZE
;
69 if (allwrite(s
->op
,s
->fd
,buf
,n
) == -1) return -1;
74 /* now len <= s->n - s->p */
75 byte_copy(s
->x
+ s
->p
,len
,buf
);
80 int substdio_putflush(s
,buf
,len
)
85 if (substdio_flush(s
) == -1) return -1;
86 return allwrite(s
->op
,s
->fd
,buf
,len
);
89 int substdio_bputs(s
,buf
)
93 return substdio_bput(s
,buf
,str_len(buf
));
96 int substdio_puts(s
,buf
)
100 return substdio_put(s
,buf
,str_len(buf
));
103 int substdio_putsflush(s
,buf
)
104 register substdio
*s
;
107 return substdio_putflush(s
,buf
,str_len(buf
));