/* arsup.c - Archive support for MRI compatibility
- Copyright 1992, 1994, 1995, 1996, 1997, 2000, 2002, 2003
- Free Software Foundation, Inc.
+ Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2007 Free Software Foundation, Inc.
This file is part of GNU Binutils.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* Contributed by Steve Chamberlain
This file looks after requests from arparse.y, to provide the MRI
style librarian command syntax + 1 word LIST. */
+#include "sysdep.h"
#include "bfd.h"
-#include "arsup.h"
#include "libiberty.h"
-#include "bucomm.h"
#include "filenames.h"
+#include "bucomm.h"
+#include "arsup.h"
static void map_over_list
(bfd *, void (*function) (bfd *, bfd *), struct list *);
extern int verbose;
+static bfd *obfd;
+static char *real_name;
+static FILE *outfile;
+
static void
map_over_list (bfd *arch, void (*function) (bfd *, bfd *), struct list *list)
{
}
-FILE *outfile;
static void
ar_directory_doer (bfd *abfd, bfd *ignore ATTRIBUTE_UNUSED)
}
-bfd *obfd;
-char *real_name;
-
void
ar_open (char *name, int t)
{
if (arch != NULL)
map_over_list (arch, ar_addlib_doer, list);
- /* Don't close the bfd, since it will make the elements disasppear. */
+ /* Don't close the bfd, since it will make the elements disappear. */
}
}
bfd_close (obfd);
- rename (ofilename, real_name);
+ smart_rename (ofilename, real_name, 0);
obfd = 0;
free (ofilename);
}
{
if (obfd)
{
- fclose ((FILE *)(obfd->iostream));
+ bfd_cache_close (obfd);
unlink (bfd_get_filename (obfd));
}
}