/* size.c -- report size of various sections of an executable file.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ 2002 Free Software Foundation, Inc.
This file is part of GNU Binutils.
out of luck; there's no --compatibility or --pedantic option. */
#include "bfd.h"
-#include "getopt.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "getopt.h"
#ifndef BSD_DEFAULT
#define BSD_DEFAULT 1
{
fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
fprintf (stream, _(" Displays the sizes of sections inside binary files\n"));
- fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
+ fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
fprintf (stream, _(" The options are:\n\
-A|-B --format={sysv|berkeley} Select output style (default is %s)\n\
- -o|-d|-h --radix={8|10|16} Display numbers in octal, decimal or hex\n\
+ -o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex\n\
-t --totals Display the total sizes (Berkeley only)\n\
--target=<bfdname> Set the binary file format\n\
-h --help Display this information\n\
bfd *file;
{
bfd *arfile = (bfd *) NULL;
+ bfd *last_arfile = (bfd *) NULL;
for (;;)
{
}
display_bfd (arfile);
- /* Don't close the archive elements; we need them for next_archive. */
+
+ if (last_arfile != NULL)
+ bfd_close (last_arfile);
+ last_arfile = arfile;
}
+
+ if (last_arfile != NULL)
+ bfd_close (last_arfile);
}
static void
return;
}
- if (bfd_check_format (file, bfd_archive) == true)
+ if (bfd_check_format (file, bfd_archive))
display_archive (file);
else
display_bfd (file);
- if (bfd_close (file) == false)
+ if (!bfd_close (file))
{
bfd_nonfatal (filename);
return_code = 1;
bsssize += size;
}
-static void
+static void
print_berkeley_format (abfd)
bfd *abfd;
{