Some laptops return other values for working toucpads. Allow test_aux_port to
[dragonfly.git] / contrib / patch / basename.c
1 /* basename.c -- return the last element in a path */
2
3 #if HAVE_CONFIG_H
4 # include <config.h>
5 #endif
6
7 #include <backupfile.h>
8
9 #ifndef FILESYSTEM_PREFIX_LEN
10 #define FILESYSTEM_PREFIX_LEN(f) 0
11 #endif
12
13 #ifndef ISSLASH
14 #define ISSLASH(c) ((c) == '/')
15 #endif
16
17 /* In general, we can't use the builtin `basename' function if available,
18    since it has different meanings in different environments.
19    In some environments the builtin `basename' modifies its argument.  */
20
21 char *
22 base_name (name)
23      char const *name;
24 {
25   char const *base = name += FILESYSTEM_PREFIX_LEN (name);
26
27   for (; *name; name++)
28     if (ISSLASH (*name))
29       base = name + 1;
30
31   return (char *) base;
32 }