Fixed make_bcc_file () to use contents of From: in draft, if draft_from masquerade...
[mmh] / 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  * $Id$
9  *
10  * This code is Copyright (c) 2002, by the authors of nmh.  See the
11  * COPYRIGHT file in the root directory of the nmh distribution for
12  * complete copyright information.
13  */
14
15 #include <h/mh.h>
16
17
18 char *
19 r1bindex(char *str, int chr)
20 {
21     char *cp;
22
23     /* find null at the end of the string */
24     for (cp = str; *cp; cp++)
25         continue;
26
27     /* backup to the rightmost character */
28     --cp;
29
30     /* now search for the rightmost occurrence of the character */
31     while (cp >= str && *cp != chr)
32         --cp;
33
34     /* now move one to the right */
35     return (++cp);
36 }