cast strrchr--need to define _GNU_SOURCE