]>
diplodocus.org Git - nmh/blob - sbr/r1bindex.c
3 * r1bindex.c -- Given a string and a character, return a pointer
4 * -- to the right of the rightmost occurrence of the
5 * -- character. If the character doesn't occur, the
6 * -- pointer will be at the beginning of the string.
15 r1bindex(char *str
, int chr
)
19 /* find null at the end of the string */
20 for (cp
= str
; *cp
; cp
++)
23 /* backup to the rightmost character */
26 /* now search for the rightmost occurrence of the character */
27 while (cp
>= str
&& *cp
!= chr
)
30 /* now move one to the right */