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

#include <sys/types.h>
#include <string.h>
#include <skalibs/bytestr.h>

size_t byte_in (char const *s, size_t n, char const *sep, size_t len)
{
  char const *t = s ;
  while (n--)
  {
    if (memchr(sep, *t, len)) break ;
    ++t ;
  }
  return t - s ;
}