skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

siovec_bytein.c (413B)


      1 /* ISC license. */
      2 
      3 #include <sys/uio.h>
      4 #include <skalibs/bytestr.h>
      5 #include <skalibs/siovec.h>
      6 
      7 size_t siovec_bytein (struct iovec const *v, unsigned int n, char const *sep, size_t seplen)
      8 {
      9   size_t w = 0 ;
     10   unsigned int i = 0 ;
     11   for (; i < n ; i++)
     12   {
     13     size_t pos = byte_in((char const *)v[i].iov_base, v[i].iov_len, sep, seplen) ;
     14     w += pos ;
     15     if (pos < v[i].iov_len) break ;
     16   }
     17   return w ;
     18 }