Fixed ZDE build - missing header file
[ZeXOS.git] / libc / string / strstr.c
blobffb4df67ab48ddfd2b12083988dd5b6cc1335c67
1 /*
2 * ZeX/OS
3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <string.h>
22 char *strstr (char const *s1, char const *s2)
24 int l1, l2;
26 l2 = strlen (s2);
28 if (!l2)
29 return (char *) s1;
31 l1 = strlen (s1);
33 while (l1 >= l2) {
34 l1 --;
36 if (!memcmp (s1, s2, l2))
37 return (char *) s1;
39 s1 ++;
42 return (char *) 0;