OSDN Git Service

first commit
[winexe-harib/winexe-harib.git] / golibc / strrchr.c
1 //*****************************************************************************
2 // strrchr.c : string function
3 // 2002/02/04 by Gaku : this is rough sketch
4 //*****************************************************************************
5
6 #include <stdio.h>
7 #include <stddef.h>
8
9 //=============================================================================
10 // search the last occur of C in D
11 //=============================================================================
12 extern "C" char* strrchr (char *d, int c)
13 {
14         char *tmp = d;
15
16         while ('\0' != *d)
17                 d++;
18
19         while (tmp <= d) {
20                 if (c == *d)
21                         return d;
22                 d--;
23         }
24
25         return NULL;
26 }