Theme Editor: Implemented %xd tag with subimages
[kugel-rb.git] / firmware / libc / strrchr.c
blob0489edd499d0b0f35d228878a5a165fee0e4ef2d
1 /*
2 FUNCTION
3 <<strrchr>>---reverse search for character in string
5 INDEX
6 strrchr
8 ANSI_SYNOPSIS
9 #include <string.h>
10 char * strrchr(const char *<[string]>, int <[c]>);
12 TRAD_SYNOPSIS
13 #include <string.h>
14 char * strrchr(<[string]>, <[c]>);
15 char *<[string]>;
16 int *<[c]>;
18 DESCRIPTION
19 This function finds the last occurence of <[c]> (converted to
20 a char) in the string pointed to by <[string]> (including the
21 terminating null character).
23 RETURNS
24 Returns a pointer to the located character, or a null pointer
25 if <[c]> does not occur in <[string]>.
27 PORTABILITY
28 <<strrchr>> is ANSI C.
30 <<strrchr>> requires no supporting OS subroutines.
32 QUICKREF
33 strrchr ansi pure
36 #include <string.h>
37 #include "_ansi.h" /* for _DEFUN */
39 char *
40 _DEFUN (strrchr, (s, i),
41 _CONST char *s _AND
42 int i)
44 _CONST char *last = NULL;
46 if (i)
48 while ((s=strchr(s, i)))
50 last = s;
51 s++;
54 else
56 last = strchr(s, i);
59 return (char *) last;