2022-04-15 11:00:55 +02:00
|
|
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
|
|
#include "unconst.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
char* strstr(const char* s, const char* find)
|
|
|
|
{
|
|
|
|
char c, sc;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
if ((c = *find++) != 0) {
|
|
|
|
len = strlen(find);
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
if ((sc = *s++) == 0)
|
|
|
|
return 0;
|
|
|
|
} while (sc != c);
|
|
|
|
} while (strncmp(s, find, len) != 0);
|
|
|
|
s--;
|
|
|
|
}
|
|
|
|
return unconst(s, char*);
|
|
|
|
}
|