* alpha-tdep.c (alpha_register_virtual_type): Use alpha-specific
[binutils-gdb.git] / binutils / size.c
index 3da75207b44072bd0f809306085f025af89715bf..5e4c9ed6ba34ed75e5fe96767ff4f24d3405b686 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
 
@@ -84,10 +84,10 @@ usage (stream, status)
 {
   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\
@@ -316,6 +316,7 @@ display_archive (file)
      bfd *file;
 {
   bfd *arfile = (bfd *) NULL;
+  bfd *last_arfile = (bfd *) NULL;
 
   for (;;)
     {
@@ -333,8 +334,14 @@ display_archive (file)
        }
 
       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
@@ -350,12 +357,12 @@ display_file (filename)
       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;
@@ -441,7 +448,7 @@ berkeley_sum (abfd, sec, ignore)
     bsssize += size;
 }
 
-static void 
+static void
 print_berkeley_format (abfd)
      bfd *abfd;
 {