2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / builtins / lib / strrchr.c
blob30a567a99933903a77e570e804ed8a623a0b90e9
1 extern int inside_main;
3 char *
4 strrchr (const char *s, int c)
6 __SIZE_TYPE__ i;
8 #ifdef __OPTIMIZE__
9 if (inside_main)
10 abort ();
11 #endif
13 i = 0;
14 while (s[i] != 0)
15 i++;
18 if (s[i] == c)
19 return (char *) s + i;
20 while (i-- != 0);
22 return 0;
25 char *
26 rindex (const char *s, int c)
28 return strrchr (s, c);