2 * r1bindex.c -- Given a string and a character, return a pointer
3 * -- to the right of the rightmost occurrence of the
4 * -- character. If the character doesn't occur, the
5 * -- pointer will be at the beginning of the string.
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
16 r1bindex(char *str, int chr)
20 /* find null at the end of the string */
21 for (cp = str; *cp; cp++)
24 /* backup to the rightmost character */
27 /* now search for the rightmost occurrence of the character */
28 while (cp >= str && *cp != chr)
31 /* now move one to the right */