Implement rindex.c