]> diplodocus.org Git - nmh/blob - docs/historical/mh-jun-1982/subs/r1bindex.c
Create new mh-format function %(ordinal)
[nmh] / docs / historical / mh-jun-1982 / subs / r1bindex.c
1 #ifdef COMMENT
2 Proprietary Rand Corporation, 1981.
3 Further distribution of this software
4 subject to the terms of the Rand
5 license agreement.
6 #endif
7
8 /*
9 * r1bindex(str, chr) stands for Right plus 1 or Beginning index of
10 * chr in str. I.e. return ptr 1 past LAST occurrence of chr in
11 * str, OR beginning of the string if str doesn't contain chr.
12 */
13
14 char *
15 r1bindex(str, chr)
16 register char *str;
17 register int chr;
18 {
19 register char *cp;
20
21 for(cp = str; *cp; cp++)
22 continue;
23 --cp;
24 while(cp >= str && *cp != chr)
25 --cp;
26 return ++cp;
27 }