2002-05-30 21:03:17 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
2010-02-22 21:24:09 +00:00
|
|
|
<<strrchr>>---reverse search for character in string
|
2002-05-30 21:03:17 +00:00
|
|
|
|
|
|
|
INDEX
|
2010-02-22 21:24:09 +00:00
|
|
|
strrchr
|
2002-05-30 21:03:17 +00:00
|
|
|
|
|
|
|
ANSI_SYNOPSIS
|
2010-02-22 21:24:09 +00:00
|
|
|
#include <string.h>
|
|
|
|
char * strrchr(const char *<[string]>, int <[c]>);
|
2002-05-30 21:03:17 +00:00
|
|
|
|
|
|
|
TRAD_SYNOPSIS
|
2010-02-22 21:24:09 +00:00
|
|
|
#include <string.h>
|
|
|
|
char * strrchr(<[string]>, <[c]>);
|
|
|
|
char *<[string]>;
|
|
|
|
int *<[c]>;
|
2002-05-30 21:03:17 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
2010-02-22 21:24:09 +00:00
|
|
|
This function finds the last occurence of <[c]> (converted to
|
|
|
|
a char) in the string pointed to by <[string]> (including the
|
|
|
|
terminating null character).
|
2002-05-30 21:03:17 +00:00
|
|
|
|
|
|
|
RETURNS
|
2010-02-22 21:24:09 +00:00
|
|
|
Returns a pointer to the located character, or a null pointer
|
|
|
|
if <[c]> does not occur in <[string]>.
|
2002-05-30 21:03:17 +00:00
|
|
|
|
|
|
|
PORTABILITY
|
|
|
|
<<strrchr>> is ANSI C.
|
|
|
|
|
|
|
|
<<strrchr>> requires no supporting OS subroutines.
|
|
|
|
|
|
|
|
QUICKREF
|
2010-02-22 21:24:09 +00:00
|
|
|
strrchr ansi pure
|
2002-05-30 21:03:17 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
char *
|
|
|
|
_DEFUN (strrchr, (s, i),
|
2010-02-22 21:24:09 +00:00
|
|
|
_CONST char *s _AND
|
|
|
|
int i)
|
2002-05-30 21:03:17 +00:00
|
|
|
{
|
|
|
|
_CONST char *last = NULL;
|
|
|
|
|
|
|
|
if (i)
|
|
|
|
{
|
|
|
|
while ((s=strchr(s, i)))
|
2010-02-22 21:24:09 +00:00
|
|
|
{
|
|
|
|
last = s;
|
|
|
|
s++;
|
|
|
|
}
|
2002-05-30 21:03:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
last = strchr(s, i);
|
|
|
|
}
|
2010-02-22 21:24:09 +00:00
|
|
|
|
2002-05-30 21:03:17 +00:00
|
|
|
return (char *) last;
|
|
|
|
}
|