PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
strstr.c
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
11#define SYSCLIB_DISABLE_BUILTINS
12#include <sysclib.h>
13
14char *strstr(const char *haystack, const char *needle)
15{
16 const char *i;
17 int v4;
18 const char *v5;
19
20 if (!*needle)
21 {
22 return (char *)haystack;
23 }
24LABEL_10:
25 v5 = haystack;
26 if (*haystack)
27 {
28 for (i = needle; *i; i += 1)
29 {
30 v4 = *v5;
31 if (!*v5)
32 {
33 return 0;
34 }
35 v5 += 1;
36 if (v4 != *i)
37 {
38 haystack += 1;
39 goto LABEL_10;
40 }
41 }
42 return (char *)haystack;
43 }
44 return 0;
45}