Use strrchr() instead of rindex()

This is primarily for Android's libc, bionic, which does
not export a rindex() function.

Looks like this is the recommended way nowadays, too: http://pubs.opengroup.org/onlinepubs/007904975/functions/rindex.html