Re-indent using clang-format
[elfdbg/.git] / compat.c
CommitLineData
418b72b3
SB
1#include <string.h>
2
3char *
4strnstr(const char *s, const char *find, size_t slen)
5{
3efce6f1
SB
6 char c, sc;
7 size_t len;
418b72b3 8
3efce6f1
SB
9 if ((c = *find++) != '\0') {
10 len = strlen(find);
11 do {
12 do {
13 if (slen-- < 1 || (sc = *s++) == '\0')
14 return (NULL);
15 } while (sc != c);
16 if (len > slen)
17 return (NULL);
18 } while (strncmp(s, find, len) != 0);
19 s--;
20 }
21 return ((char *)s);
418b72b3 22}