There should be something elegant in Linux API/POSIX to extract base file name from full path
Use basename (which has odd corner case semantics) or do it yourself by calling strrchr(pathname, '/') and treating the whole string as a basename if it does not contain a '/' character.
basename
strrchr(pathname, '/')
'/'