aboutsummaryrefslogtreecommitdiff
path: root/bfd
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
parent010c70e10fb422ae6151a8808215a122f461fce8 (diff)
downloadgdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.zip
gdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.tar.gz
gdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.tar.bz2
Eli Zaretskii's DOSish file name patches.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog19
-rw-r--r--bfd/aoutx.h6
-rw-r--r--bfd/archive.c35
-rw-r--r--bfd/cache.c10
-rw-r--r--bfd/sysdep.h19
5 files changed, 75 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9b51a5f..ad7ba44 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,24 @@
2000-05-26 Alan Modra <alan@linuxcare.com.au>
+ * sysdep.h (gettext, dgettext, dcgettext, textdomain,
+ bindtextdomain): Replace defines with those from intl/libgettext.h
+ to quieten gcc warnings.
+
+2000-05-26 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * aoutx.h (find_nearest_line): Use IS_ABSOLUTE_PATH.
+
+ * archive.c (normalize, bfd_bsd_truncate_arname,
+ bfd_gnu_truncate_arname) [HAVE_DOS_BASED_FILE_SYSTEM]: Support
+ file names with backslashes.
+
+ * cache.c (bfd_open_file) [__MSDOS__]: Don't unlink the file
+ before opening it.
+
+ * sysdep.h: Include filenames.h.
+
+2000-05-26 Alan Modra <alan@linuxcare.com.au>
+
* opncls.c (bfd_close_all_done): Mask file perms with 0777 not 0x777.
2000-05-26 Jakub Jelinek <jakub@redhat.com>
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 01dd9ee..4b0940d 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1,5 +1,5 @@
/* BFD semi-generic back-end for a.out binaries.
- 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.
@@ -2833,7 +2833,7 @@ NAME(aout,find_nearest_line)
}
if (main_file_name == NULL
- || main_file_name[0] == '/'
+ || IS_ABSOLUTE_PATH (main_file_name)
|| directory_name == NULL)
filelen = 0;
else
@@ -2857,7 +2857,7 @@ NAME(aout,find_nearest_line)
if (main_file_name != NULL)
{
- if (main_file_name[0] == '/' || directory_name == NULL)
+ if (IS_ABSOLUTE_PATH (main_file_name) || directory_name == NULL)
*filename_ptr = main_file_name;
else
{
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
diff --git a/bfd/cache.c b/bfd/cache.c
index ad3140e..91b6c61 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -1,5 +1,6 @@
/* BFD library -- caching of file descriptors.
- Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+ Copyright 1990, 91, 92, 93, 94, 95, 1996, 2000
+ Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -300,10 +301,17 @@ bfd_open_file (abfd)
So we unlink the output file if and only if it has
non-zero size. */
+#ifndef __MSDOS__
+ /* Don't do this for MSDOS: it doesn't care about overwriting
+ a running binary, but if this file is already open by
+ another BFD, we will be in deep trouble if we delete an
+ open file. In fact, objdump does just that if invoked with
+ the --info option. */
struct stat s;
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
unlink (abfd->filename);
+#endif
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WB);
abfd->opened_once = true;
}
diff --git a/bfd/sysdep.h b/bfd/sysdep.h
index 0a58983..77b5e50 100644
--- a/bfd/sysdep.h
+++ b/bfd/sysdep.h
@@ -1,5 +1,5 @@
/* sysdep.h -- handle host dependencies for the BFD library
- Copyright 1995, 96, 97, 98, 1999 Free Software Foundation, Inc.
+ Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -102,6 +102,8 @@ extern char *strrchr ();
#define SEEK_CUR 1
#endif
+#include "filenames.h"
+
#ifdef NEED_DECLARATION_STRSTR
extern char *strstr ();
#endif
@@ -131,14 +133,13 @@ extern char *getenv ();
#define N_(String) (String)
#endif
#else
-/* Stubs that do something close enough. */
-#define textdomain(String) (String)
-#define gettext(String) (String)
-#define dgettext(Domain,Message) (Message)
-#define dcgettext(Domain,Message,Type) (Message)
-#define bindtextdomain(Domain,Directory) (Domain)
-#define _(String) (String)
-#define N_(String) (String)
+# define gettext(Msgid) (Msgid)
+# define dgettext(Domainname, Msgid) (Msgid)
+# define dcgettext(Domainname, Msgid, Category) (Msgid)
+# define textdomain(Domainname) while (0) /* nothing */
+# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
+# define _(String) (String)
+# define N_(String) (String)
#endif
#endif /* ! defined (BFD_SYSDEP_H) */