blob: f65b73e968c9ce40af0e4f2b95c3eb57b3505868 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/* ISC license. */
#include <sys/types.h>
#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 ;
}
}
|