use strchr and strrchr in place of index/rindex

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>