blob: 08d82a6740a0ead470b84f29335bc43a7e6d25df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/* ISC license. */
#include <errno.h>
#include <skalibs/buffer.h>
int buffer_putall (buffer *b, char const *s, size_t len, size_t *written)
{
if (*written > len) return (errno = EINVAL, 0) ;
for (;;)
{
*written += buffer_putnoflush(b, s + *written, len - *written) ;
if (*written >= len) return 1 ;
buffer_flush(b) ;
if (buffer_isfull(b)) return 0 ;
}
}
|