aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/string/rindex.c
blob: 0c7f153cffd28bf27a96afbaef42ba248e05e00c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
FUNCTION
	<<rindex>>---reverse search for character in string

INDEX
	rindex

SYNOPSIS
	#include <string.h>
	char * rindex(const char *<[string]>, int <[c]>);

DESCRIPTION
	This function finds the last occurence of <[c]> (converted to
	a char) in the string pointed to by <[string]> (including the
	terminating null character).

	This function is identical to <<strrchr>>.

RETURNS
	Returns a pointer to the located character, or a null pointer
	if <[c]> does not occur in <[string]>.

PORTABILITY
<<rindex>> requires no supporting OS subroutines.

QUICKREF
	rindex - pure
*/

#include <string.h>
#include <strings.h>

char *
_DEFUN (rindex, (s, c),
	const char *s,
	int c)
{
  return strrchr (s, c);
}