diff options
author | DJ Delorie <dj@redhat.com> | 2010-04-24 01:03:21 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2010-04-24 01:03:21 +0000 |
commit | 2cd2156f48361fa342ce1ad18cead5cae6ce4af5 (patch) | |
tree | b8420cdb82b96deb0b0dd9c0544c34da6c3d0280 /libiberty/lbasename.c | |
parent | 65730243397a2680bfb31b18d32c366f450a78d1 (diff) | |
download | gdb-2cd2156f48361fa342ce1ad18cead5cae6ce4af5.zip gdb-2cd2156f48361fa342ce1ad18cead5cae6ce4af5.tar.gz gdb-2cd2156f48361fa342ce1ad18cead5cae6ce4af5.tar.bz2 |
merge from gcc
Diffstat (limited to 'libiberty/lbasename.c')
-rw-r--r-- | libiberty/lbasename.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/libiberty/lbasename.c b/libiberty/lbasename.c index 56fcd62..ed1dd1f 100644 --- a/libiberty/lbasename.c +++ b/libiberty/lbasename.c @@ -46,19 +46,39 @@ and a path ending in @code{/} returns the empty string after it. #include "filenames.h" const char * -lbasename (const char *name) +unix_lbasename (const char *name) +{ + const char *base; + + for (base = name; *name; name++) + if (IS_UNIX_DIR_SEPARATOR (*name)) + base = name + 1; + + return base; +} + +const char * +dos_lbasename (const char *name) { const char *base; -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over a possible disk name. */ if (ISALPHA (name[0]) && name[1] == ':') name += 2; -#endif for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) + if (IS_DOS_DIR_SEPARATOR (*name)) base = name + 1; return base; } + +const char * +lbasename (const char *name) +{ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + return dos_lbasename (name); +#else + return unix_lbasename (name); +#endif +} |