1
by brian
clean slate |
1 |
/* Copyright (C) 2000 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
14 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
15 |
||
16 |
/* File : strrchr.c
|
|
17 |
Author : Richard A. O'Keefe.
|
|
18 |
Updated: 10 April 1984
|
|
19 |
Defines: strrchr(), rindex()
|
|
20 |
||
21 |
strrchr(s, c) returns a pointer to the last place in s where c
|
|
22 |
occurs, or NullS if c does not occur in s. This function is called
|
|
23 |
rindex in V7 and 4.?bsd systems; while not ideal the name is clearer
|
|
24 |
than strrchr, so rindex remains in strings.h as a macro. NB:
|
|
25 |
strrchr looks for single characters, not for sets or strings. The
|
|
26 |
parameter 'c' is declared 'int' so it will go in a register; if your
|
|
27 |
C compiler is happy with register char change it to that.
|
|
28 |
*/
|
|
29 |
||
30 |
#include "strings.h" |
|
31 |
||
32 |
char *strrchr(register const char *s, register pchar c) |
|
33 |
{
|
|
34 |
reg3 char *t; |
|
35 |
||
36 |
t = NullS; |
|
37 |
do if (*s == (char) c) t = (char*) s; while (*s++); |
|
38 |
return (char*) t; |
|
39 |
}
|