Enable cirrus continous integration task for freebsd
[elfdbg/.git] / compat.c
CommitLineData
418b72b3
SB
1#include <string.h>
2
550c0ec2 3#if defined(__linux__) || defined(__OpenBSD__)
418b72b3
SB
4char *
5strnstr(const char *s, const char *find, size_t slen)
6{
3efce6f1
SB
7 char c, sc;
8 size_t len;
418b72b3 9
3efce6f1
SB
10 if ((c = *find++) != '\0') {
11 len = strlen(find);
12 do {
13 do {
14 if (slen-- < 1 || (sc = *s++) == '\0')
15 return (NULL);
16 } while (sc != c);
17 if (len > slen)
18 return (NULL);
19 } while (strncmp(s, find, len) != 0);
20 s--;
21 }
22 return ((char *)s);
418b72b3 23}
550c0ec2 24#endif