]> diplodocus.org Git - nmh/blob - sbr/r1bindex.c
Alter mh-chart(7)'s NAME to be lowercase.
[nmh] / sbr / r1bindex.c
1
2 /*
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.
7 *
8 * This code is Copyright (c) 2002, by the authors of nmh. See the
9 * COPYRIGHT file in the root directory of the nmh distribution for
10 * complete copyright information.
11 */
12
13 #include <h/mh.h>
14
15 char *
16 r1bindex(char *str, int chr)
17 {
18 char *r;
19
20 if (!chr)
21 return str; /* Match old behaviour, don't know if it's used. */
22
23 r = strrchr(str, chr);
24 if (r)
25 return r + 1;
26
27 return str;
28 }