2 ** mhbasename.c -- Given a path name, return a pointer to the character
3 ** -- after the last slash. If none present, return the the
4 ** -- beginning of the path.
6 ** This code is Copyright (c) 2002, by the authors of nmh. See the
7 ** COPYRIGHT file in the root directory of the nmh distribution for
8 ** complete copyright information.
15 ** Note: In contrast to POSIX basename(), we don't handle trailing
16 ** slashes special. If path has a trailing slash, we return a pointer
17 ** to a null byte (i.e. to an empty string). Also different: We don't
18 ** modify the original string neither do we return a pointer to static
22 mhbasename(char *path)
29 cp = strrchr(path, '/');
30 return (!cp) ? path : ++cp;