Please check the manual page basename(3).