X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fr1bindex.c;h=93ec950c0c4a88bbf2bf1ae068c5ab61cf7ac461;hp=92818f9a5f68455a975ad09197447298e436973d;hb=a485ed478abbd599d8c9aab48934e7a26733ecb1;hpb=f480c03187724e54e5391ee61b810827da319a6c 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); }