Welcome to little lamb

Code » limb » release » tree

[release] / src / liblimb / bytestr.h / byte_str.c

/* This file is part of limb                           https://lila.oss/limb
 * Copyright (C) 2023 Olivier Brunel                          jjk@jjacky.com */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <skalibs/posixplz.h>
#include <limb/bytestr.h>

size_t
byte_str(const char *haystack, size_t hlen, const char *needle, size_t nlen)
{
    char *s = memmem(haystack, hlen, needle, nlen);
    return (s) ? (size_t) (s - haystack) : hlen;
}