summaryrefslogtreecommitdiff
path: root/src/libstddjb/siovec_bytein.c
blob: bcf6e59adc0b292176dd68ec6cb922e255562ddb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* ISC license. */

#include <sys/types.h>
#include <sys/uio.h>
#include <skalibs/bytestr.h>
#include <skalibs/siovec.h>

size_t siovec_bytein (struct iovec const *v, unsigned int n, char const *sep, size_t seplen)
{
  size_t w = 0 ;
  unsigned int i = 0 ;
  for (; i < n ; i++)
  {
    size_t pos = byte_in((char const *)v[i].iov_base, v[i].iov_len, sep, seplen) ;
    w += pos ;
    if (pos < v[i].iov_len) break ;
  }
  return w ;
}