aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-05-26 13:11:57 +0000
committerAlan Modra <amodra@gmail.com>2000-05-26 13:11:57 +0000
commit5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e (patch)
tree43c01869523de4ad682493e6674e5e8a9fed1804 /bfd/archive.c
parent010c70e10fb422ae6151a8808215a122f461fce8 (diff)
downloadgdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.zip
gdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.tar.gz
gdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.tar.bz2
Eli Zaretskii's DOSish file name patches.
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