(getuidbyname): Declare parameter to be const.
[coreutils.git] / lib / basename.c
blob4087e3dc0fdad8c6e5c0edcbc60c8945677296f7
1 /* basename.c -- return the last element in a path */
3 #if HAVE_CONFIG_H
4 # include <config.h>
5 #endif
7 #ifndef FILESYSTEM_PREFIX_LEN
8 # define FILESYSTEM_PREFIX_LEN(f) 0
9 #endif
11 #ifndef ISSLASH
12 # define ISSLASH(c) ((c) == '/')
13 #endif
15 /* In general, we can't use the builtin `basename' function if available,
16 since it has different meanings in different environments.
17 In some environments the builtin `basename' modifies its argument. */
19 char *
20 base_name (name)
21 char const *name;
23 char const *base = name += FILESYSTEM_PREFIX_LEN (name);
25 for (; *name; name++)
26 if (ISSLASH (*name))
27 base = name + 1;
29 return (char *) base;