X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fr1bindex.c;h=49ac0f578e310cc379ce862f77139dd319bf648f;hp=92e152dbc7303b4d05ce1012a14bf9f94be2a59a;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=6c42153ad9362cc676ea66563bf400d7511b3b68 diff --git a/sbr/r1bindex.c b/sbr/r1bindex.c index 92e152d..49ac0f5 100644 --- a/sbr/r1bindex.c +++ b/sbr/r1bindex.c @@ -1,16 +1,13 @@ - /* - * 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. - */ +** 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. +** +** 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 @@ -18,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); }