aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 1e1c9fa..5709f26 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1,5 +1,5 @@
/* BFD back-end for archive files (libraries).
- Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+ Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
@@ -1183,6 +1183,17 @@ normalize (abfd, file)
{
const char *filename = strrchr (file, '/');
+
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+ {
+ /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
+ char *bslash = strrchr (file, '\\');
+ if (bslash > filename)
+ filename = bslash;
+ if (filename == NULL && file[0] != '\0' && file[1] == ':')
+ filename = file + 1;
+ }
+#endif
if (filename != (char *) NULL)
filename++;
else
@@ -1566,6 +1577,17 @@ bfd_bsd_truncate_arname (abfd, pathname, arhdr)
CONST char *filename = strrchr (pathname, '/');
int maxlen = ar_maxnamelen (abfd);
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+ {
+ /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
+ char *bslash = strrchr (pathname, '\\');
+ if (bslash > filename)
+ filename = bslash;
+ if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
+ filename = pathname + 1;
+ }
+#endif
+
if (filename == NULL)
filename = pathname;
else
@@ -1606,6 +1628,17 @@ bfd_gnu_truncate_arname (abfd, pathname, arhdr)
CONST char *filename = strrchr (pathname, '/');
int maxlen = ar_maxnamelen (abfd);
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+ {
+ /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
+ char *bslash = strrchr (pathname, '\\');
+ if (bslash > filename)
+ filename = bslash;
+ if (filename == NULL && pathname[0] != '\0' && pathname[1] == ':')
+ filename = pathname + 1;
+ }
+#endif
+
if (filename == NULL)
filename = pathname;
else