Use strrchr() instead of rindex()

This is primarily for Android's libc, bionic, which does
not export a rindex() function.