skagetln_nofill.c (486B)
1 /* ISC license. */ 2 3 #include <sys/uio.h> 4 #include <skalibs/buffer.h> 5 #include <skalibs/siovec.h> 6 #include <skalibs/stralloc.h> 7 #include <skalibs/skamisc.h> 8 9 int skagetln_nofill (buffer *b, stralloc *sa, char sep) 10 { 11 struct iovec v[2] ; 12 size_t pos ; 13 int r ; 14 buffer_rpeek(b, v) ; 15 pos = siovec_bytechr(v, 2, sep) ; 16 r = pos < buffer_len(b) ; pos += r ; 17 if (!stralloc_readyplus(sa, pos)) return -1 ; 18 buffer_getnofill(b, sa->s + sa->len, pos) ; sa->len += pos ; 19 return r ; 20 }