]> pd.if.org Git - pdclib/blob - functions/string/strrchr.c
Minor doc extension.
[pdclib] / functions / string / strrchr.c
1 // ----------------------------------------------------------------------------
2 // $Id$
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
7
8 #include <__NULL.h>
9
10 char * strrchr( const char * src, int c )
11 {
12     const char * p = src;
13     while ( *p != '\0' )
14     {
15         ++p;
16     }
17     while ( p >= src )
18     {
19         if ( *p == (char) c )
20         {
21             return (char *) p;
22         }
23         --p;
24     }
25     return NULL;
26 }