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