X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Fr1bindex.c;h=93ec950c0c4a88bbf2bf1ae068c5ab61cf7ac461;hb=18017df38ebb626f6eed6f339641fd1298c326e7;hp=087ed78d73a571875bd83e55ee3ab514073e0c6b;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b;p=mmh diff --git a/sbr/r1bindex.c b/sbr/r1bindex.c index 087ed78..93ec950 100644 --- a/sbr/r1bindex.c +++ b/sbr/r1bindex.c @@ -1,11 +1,12 @@ - /* * r1bindex.c -- Given a string and a character, return a pointer * -- to the right of the rightmost occurrence of the * -- character. If the character doesn't occur, the * -- pointer will be at the beginning of the string. * - * $Id$ + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include @@ -14,19 +15,19 @@ char * r1bindex(char *str, int chr) { - char *cp; - - /* find null at the end of the string */ - for (cp = str; *cp; cp++) - continue; + char *cp; - /* backup to the rightmost character */ - --cp; + /* find null at the end of the string */ + for (cp = str; *cp; cp++) + continue; - /* now search for the rightmost occurrence of the character */ - while (cp >= str && *cp != chr) + /* backup to the rightmost character */ --cp; - /* now move one to the right */ - return (++cp); + /* now search for the rightmost occurrence of the character */ + while (cp >= str && *cp != chr) + --cp; + + /* now move one to the right */ + return (++cp); }