blob: 0e22a8d84e9213bdecff565e6406a0da63c51a29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
/* ISC license. */
#include <sys/types.h>
#include <errno.h>
#include <skalibs/functypes.h>
#include <skalibs/allreadwrite.h>
size_t allreadwrite (iofunc_t_ref op, int fd, char *buf, size_t len)
{
size_t written = 0 ;
while (len)
{
register ssize_t w = (*op)(fd, buf, len) ;
if (w <= 0)
{
if (!w) errno = 0 ;
break ;
}
written += w ;
buf += w ;
len -= w ;
}
return written ;
}
|