PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
strrchr.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 *strrchr(const char *s, int c)
15{
16 const char *v2;
17 const char *i;
18 char *result;
19
20 v2 = s;
21 if (!s)
22 {
23 return 0;
24 }
25 while (*s++) {}
26 for (i = s - 1; ; i -= 1)
27 {
28 result = (char *)i;
29 if (*i == (char)c)
30 {
31 break;
32 }
33 if (v2 >= i)
34 {
35 return 0;
36 }
37 }
38 return result;
39}