X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;ds=sidebyside;f=sbr%2Fr1bindex.c;h=93ec950c0c4a88bbf2bf1ae068c5ab61cf7ac461;hb=a485ed478abbd599d8c9aab48934e7a26733ecb1;hp=92818f9a5f68455a975ad09197447298e436973d;hpb=5dd6771b28c257af405d7248639ed0e3bcdce38b;p=mmh diff --git a/sbr/r1bindex.c b/sbr/r1bindex.c index 92818f9..93ec950 100644 --- a/sbr/r1bindex.c +++ b/sbr/r1bindex.c @@ -1,4 +1,3 @@ - /* * r1bindex.c -- Given a string and a character, return a pointer * -- to the right of the rightmost occurrence of the @@ -16,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); }