Move display_info() function into bucomm.c
authorNick Clifton <nickc@redhat.com>
Mon, 24 Mar 2003 11:28:35 +0000 (11:28 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 24 Mar 2003 11:28:35 +0000 (11:28 +0000)
binutils/ChangeLog
binutils/Makefile.am
binutils/Makefile.in
binutils/bucomm.c
binutils/bucomm.h
binutils/objdump.c

index 7fce8769c7e061d7071fc4a9c7bd91bd9342e515..e1c79ed8a08cc1bbca71e2ad834bb58b0e5ad9e4 100644 (file)
@@ -1,3 +1,20 @@
+2003-03-24  Elias Athanasopoulos  <elathan@phys.uoa.gr>
+
+       * objdump.c (endian_string): Move to bucomm.c.
+       (display_info): Likewise.
+       (display_target_list): Likewise.
+       (display_info_table): Likewise.
+       (display_target_tables): Likewise.
+       (main): Assign the return value of display_info to exit_status.
+       * bucomm.c: Include bfdver.h and libbfd.h
+       (display_target_list): Call bfd_nonfatal instead of nonfatal and
+       return 0 on a non-fatal error, 1 on success.
+       (display_info_table): Likewise. 
+       * bucomm.h (display_info): Provide a prototype.
+       * Makefile.am (bucomm.o): Add dependencies on bfdver.h and
+       libbfd.h.
+       * Makefile.in: Regenerate.
+
 2003-03-22  Danny Smith  <dannysmith@users.sourceforge,net>
 
        * dlltool.c (gen_def_file): Put demangled name comments on
 2003-03-22  Danny Smith  <dannysmith@users.sourceforge,net>
 
        * dlltool.c (gen_def_file): Put demangled name comments on
index 2c1b51585c0ee84848ae4a5c74ce32a9eadcbbbb..1d5273852cf5c6642360658a9ac22df208211782 100644 (file)
@@ -381,7 +381,8 @@ binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/fopen-same.h
 bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \
   $(INCDIR)/fopen-same.h
 bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \
-  $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h
+  $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
+  ../bfd/bfdver.h $(BFDDIR)/libbfd.h
 budemang.o: budemang.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \
   budemang.h
 budemang.o: budemang.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \
   budemang.h
index 286d84215494fb27d908fe4ef4bd237be21a1193..d0cd26e87562324820cfb8ffb9c798a99db265ec 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 
 # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
@@ -442,7 +442,7 @@ configure.in deflex.c defparse.c nlmheader.c rclex.c rcparse.c
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = tar
+TAR = gtar
 GZIP_ENV = --best
 SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(dllwrap_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES) $(cxxfilt_SOURCES)
 OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(dllwrap_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS) $(cxxfilt_OBJECTS)
 GZIP_ENV = --best
 SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(dllwrap_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES) $(cxxfilt_SOURCES)
 OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(dllwrap_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS) $(cxxfilt_OBJECTS)
@@ -870,7 +870,7 @@ distclean-generic:
        -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
        -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
-       -test -z "arlex.cdeflex.crclex.carparse.harparse.cdefparse.hdefparse.cnlmheader.hnlmheader.crcparse.hrcparse.c" || rm -f arlex.c deflex.c rclex.c arparse.h arparse.c defparse.h defparse.c nlmheader.h nlmheader.c rcparse.h rcparse.c
+       -test -z "arlexldeflexlrclexlarparseharparsecdefparsehdefparsecnlmheaderhnlmheadercrcparsehrcparsec" || rm -f arlexl deflexl rclexl arparseh arparsec defparseh defparsec nlmheaderh nlmheaderc rcparseh rcparsec
 mostlyclean-am:  mostlyclean-hdr mostlyclean-binPROGRAMS \
                mostlyclean-noinstPROGRAMS mostlyclean-compile \
                mostlyclean-libtool mostlyclean-tags \
 mostlyclean-am:  mostlyclean-hdr mostlyclean-binPROGRAMS \
                mostlyclean-noinstPROGRAMS mostlyclean-compile \
                mostlyclean-libtool mostlyclean-tags \
@@ -1109,7 +1109,8 @@ binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/fopen-same.h
 bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \
   $(INCDIR)/fopen-same.h
 bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \
-  $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h
+  $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
+  ../bfd/bfdver.h $(BFDDIR)/libbfd.h
 budemang.o: budemang.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \
   budemang.h
 budemang.o: budemang.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
   $(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \
   budemang.h
index 9609aeece77c18ae595bb997866f93497dd5a5ce..237f934fe8ccb018bcb12827f2bdbcdcc2c47638 100644 (file)
@@ -1,5 +1,5 @@
 /* bucomm.c -- Bin Utils COMmon code.
 /* bucomm.c -- Bin Utils COMmon code.
-   Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002
+   Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
    loaded, but for now it's not necessary.  */
 
 #include "bfd.h"
    loaded, but for now it's not necessary.  */
 
 #include "bfd.h"
+#include "bfdver.h"
 #include "libiberty.h"
 #include "bucomm.h"
 #include "filenames.h"
 #include "libiberty.h"
 #include "bucomm.h"
 #include "filenames.h"
+#include "libbfd.h"
 
 #include <sys/stat.h>
 #include <time.h>              /* ctime, maybe time_t */
 
 #include <sys/stat.h>
 #include <time.h>              /* ctime, maybe time_t */
 typedef long time_t;
 #endif
 #endif
 typedef long time_t;
 #endif
 #endif
+
+static const char * endian_string PARAMS ((enum bfd_endian));
+static int display_target_list PARAMS ((void));
+static int display_info_table PARAMS ((int, int));
+static int display_target_tables PARAMS ((void));
 \f
 \f
-/* Error reporting */
+/* Error reporting */
 
 char *program_name;
 
 
 char *program_name;
 
@@ -161,6 +168,202 @@ list_supported_architectures (name, f)
   fprintf (f, "\n");
 }
 \f
   fprintf (f, "\n");
 }
 \f
+/* The length of the longest architecture name + 1.  */
+#define LONGEST_ARCH sizeof ("powerpc:common")
+
+static const char *
+endian_string (endian)
+     enum bfd_endian endian;
+{
+  switch (endian)
+    {
+    case BFD_ENDIAN_BIG: return "big endian";
+    case BFD_ENDIAN_LITTLE: return "little endian";
+    default: return "endianness unknown";
+    }
+}
+
+/* List the targets that BFD is configured to support, each followed
+   by its endianness and the architectures it supports.  */
+
+static int
+display_target_list ()
+{
+  char *dummy_name;
+  int t;
+  int ret = 1;
+
+  dummy_name = make_temp_file (NULL);
+  for (t = 0; bfd_target_vector[t]; t++)
+    {
+      const bfd_target *p = bfd_target_vector[t];
+      bfd *abfd = bfd_openw (dummy_name, p->name);
+      int a;
+
+      printf ("%s\n (header %s, data %s)\n", p->name,
+             endian_string (p->header_byteorder),
+             endian_string (p->byteorder));
+
+      if (abfd == NULL)
+       {
+          bfd_nonfatal (dummy_name);
+          ret = 0;
+         continue;
+       }
+
+      if (! bfd_set_format (abfd, bfd_object))
+       {
+         if (bfd_get_error () != bfd_error_invalid_operation)
+            {
+             bfd_nonfatal (p->name);
+              ret = 0;
+            }
+         bfd_close_all_done (abfd);
+         continue;
+       }
+
+      for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++)
+       if (bfd_set_arch_mach (abfd, (enum bfd_architecture) a, 0))
+         printf ("  %s\n",
+                 bfd_printable_arch_mach ((enum bfd_architecture) a, 0));
+      bfd_close_all_done (abfd);
+    }
+  unlink (dummy_name);
+  free (dummy_name);
+
+  return ret;
+}
+
+/* Print a table showing which architectures are supported for entries
+   FIRST through LAST-1 of bfd_target_vector (targets across,
+   architectures down).  */
+
+static int
+display_info_table (first, last)
+     int first;
+     int last;
+{
+  int t;
+  int a;
+  int ret = 1;
+  char *dummy_name;
+
+  /* Print heading of target names.  */
+  printf ("\n%*s", (int) LONGEST_ARCH, " ");
+  for (t = first; t < last && bfd_target_vector[t]; t++)
+    printf ("%s ", bfd_target_vector[t]->name);
+  putchar ('\n');
+
+  dummy_name = make_temp_file (NULL);
+  for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++)
+    if (strcmp (bfd_printable_arch_mach (a, 0), "UNKNOWN!") != 0)
+      {
+       printf ("%*s ", (int) LONGEST_ARCH - 1,
+               bfd_printable_arch_mach (a, 0));
+       for (t = first; t < last && bfd_target_vector[t]; t++)
+         {
+           const bfd_target *p = bfd_target_vector[t];
+           bfd_boolean ok = TRUE;
+           bfd *abfd = bfd_openw (dummy_name, p->name);
+
+           if (abfd == NULL)
+             {
+               bfd_nonfatal (p->name);
+                ret = 0;
+               ok = FALSE;
+             }
+
+           if (ok)
+             {
+               if (! bfd_set_format (abfd, bfd_object))
+                 {
+                   if (bfd_get_error () != bfd_error_invalid_operation)
+                      {
+                       bfd_nonfatal (p->name);
+                        ret = 0;
+                      }
+                   ok = FALSE;
+                 }
+             }
+
+           if (ok)
+             {
+               if (! bfd_set_arch_mach (abfd, a, 0))
+                 ok = FALSE;
+             }
+
+           if (ok)
+             printf ("%s ", p->name);
+           else
+             {
+               int l = strlen (p->name);
+               while (l--)
+                 putchar ('-');
+               putchar (' ');
+             }
+           if (abfd != NULL)
+             bfd_close_all_done (abfd);
+         }
+       putchar ('\n');
+      }
+  unlink (dummy_name);
+  free (dummy_name);
+
+  return ret;
+}
+
+/* Print tables of all the target-architecture combinations that
+   BFD has been configured to support.  */
+
+static int
+display_target_tables ()
+{
+  int t;
+  int columns;
+  int ret = 1;
+  char *colum;
+
+  columns = 0;
+  colum = getenv ("COLUMNS");
+  if (colum != NULL)
+    columns = atoi (colum);
+  if (columns == 0)
+    columns = 80;
+
+  t = 0;
+  while (bfd_target_vector[t] != NULL)
+    {
+      int oldt = t, wid;
+
+      wid = LONGEST_ARCH + strlen (bfd_target_vector[t]->name) + 1;
+      ++t;
+      while (wid < columns && bfd_target_vector[t] != NULL)
+       {
+         int newwid;
+
+         newwid = wid + strlen (bfd_target_vector[t]->name) + 1;
+         if (newwid >= columns)
+           break;
+         wid = newwid;
+         ++t;
+       }
+      if (! display_info_table (oldt, t))
+        ret = 0;
+    }
+
+  return ret;
+}
+
+int
+display_info ()
+{
+  printf (_("BFD header file version %s\n"), BFD_VERSION_STRING);
+  if (! display_target_list () || ! display_target_tables ())
+    return 1;
+  else
+    return 0;
+}
+\f
 /* Display the archive header for an element as if it were an ls -l listing:
 
    Mode       User\tGroup\tSize\tDate               Name */
 /* Display the archive header for an element as if it were an ls -l listing:
 
    Mode       User\tGroup\tSize\tDate               Name */
index 7a11ea8afc037a296d97d25fde03ebcbc0e3f5e9..2598d13386b31c272ff638771bae649829242392 100644 (file)
@@ -1,22 +1,22 @@
 /* bucomm.h -- binutils common include file.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 /* bucomm.h -- binutils common include file.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2002 Free Software Foundation, Inc.
+   2002, 2003 Free Software Foundation, Inc.
 
 
-This file is part of GNU Binutils.
+   This file is part of GNU Binutils.
 
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
 
-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.  */
+   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.  */
 \f
 #ifndef _BUCOMM_H
 #define _BUCOMM_H
 \f
 #ifndef _BUCOMM_H
 #define _BUCOMM_H
@@ -167,7 +167,7 @@ void set_default_bfd_target
   PARAMS ((void));
 
 void list_matching_formats
   PARAMS ((void));
 
 void list_matching_formats
-  PARAMS ((char **p));
+  PARAMS ((char **));
 
 void list_supported_targets
   PARAMS ((const char *, FILE *));
 
 void list_supported_targets
   PARAMS ((const char *, FILE *));
@@ -175,8 +175,11 @@ void list_supported_targets
 void list_supported_architectures
   PARAMS ((const char *, FILE *));
 
 void list_supported_architectures
   PARAMS ((const char *, FILE *));
 
+int display_info
+  PARAMS ((void));
+  
 void print_arelt_descr
 void print_arelt_descr
-  PARAMS ((FILE *file, bfd *abfd, bfd_boolean verbose));
+  PARAMS ((FILE *, bfd *, bfd_boolean));
 
 char *make_tempname
   PARAMS ((char *));
 
 char *make_tempname
   PARAMS ((char *));
@@ -188,7 +191,7 @@ extern char *program_name;
 
 /* filemode.c */
 void mode_string
 
 /* filemode.c */
 void mode_string
-  PARAMS ((unsigned long mode, char *buf));
+  PARAMS ((unsigned long, char *));
 
 /* version.c */
 extern void print_version
 
 /* version.c */
 extern void print_version
@@ -201,7 +204,7 @@ extern void set_times
 extern int smart_rename
   PARAMS ((const char *, const char *, int));
 
 extern int smart_rename
   PARAMS ((const char *, const char *, int));
 
-/* libiberty */
+/* libiberty */
 PTR xmalloc
   PARAMS ((size_t));
 
 PTR xmalloc
   PARAMS ((size_t));
 
index 26299cff66b8454788a656d114b7f43ccfd3ad33..b641fde80383095261b7ea7a71d60646c7257305 100644 (file)
@@ -123,21 +123,21 @@ static void usage
 static void nonfatal
   PARAMS ((const char *));
 static void display_file
 static void nonfatal
   PARAMS ((const char *));
 static void display_file
-  PARAMS ((char *filename, char *target));
+  PARAMS ((char *, char *));
 static void dump_section_header
   PARAMS ((bfd *, asection *, PTR));
 static void dump_headers
   PARAMS ((bfd *));
 static void dump_data
 static void dump_section_header
   PARAMS ((bfd *, asection *, PTR));
 static void dump_headers
   PARAMS ((bfd *));
 static void dump_data
-  PARAMS ((bfd *abfd));
+  PARAMS ((bfd *));
 static void dump_relocs
 static void dump_relocs
-  PARAMS ((bfd *abfd));
+  PARAMS ((bfd *));
 static void dump_dynamic_relocs
 static void dump_dynamic_relocs
-  PARAMS ((bfd * abfd));
+  PARAMS ((bfd *));
 static void dump_reloc_set
   PARAMS ((bfd *, asection *, arelent **, long));
 static void dump_symbols
 static void dump_reloc_set
   PARAMS ((bfd *, asection *, arelent **, long));
 static void dump_symbols
-  PARAMS ((bfd *abfd, bfd_boolean dynamic));
+  PARAMS ((bfd *, bfd_boolean));
 static void dump_bfd_header
   PARAMS ((bfd *));
 static void dump_bfd_private_header
 static void dump_bfd_header
   PARAMS ((bfd *));
 static void dump_bfd_private_header
@@ -145,15 +145,7 @@ static void dump_bfd_private_header
 static void dump_bfd
   PARAMS ((bfd *));
 static void display_bfd
 static void dump_bfd
   PARAMS ((bfd *));
 static void display_bfd
-  PARAMS ((bfd *abfd));
-static void display_target_list
-  PARAMS ((void));
-static void display_info_table
-  PARAMS ((int, int));
-static void display_target_tables
-  PARAMS ((void));
-static void display_info
-  PARAMS ((void));
+  PARAMS ((bfd *));
 static void objdump_print_value
   PARAMS ((bfd_vma, struct disassemble_info *, bfd_boolean));
 static void objdump_print_symname
 static void objdump_print_value
   PARAMS ((bfd_vma, struct disassemble_info *, bfd_boolean));
 static void objdump_print_symname
@@ -176,8 +168,6 @@ static void disassemble_bytes
           bfd_byte *, bfd_vma, bfd_vma, arelent ***, arelent **));
 static void disassemble_data
   PARAMS ((bfd *));
           bfd_byte *, bfd_vma, bfd_vma, arelent ***, arelent **));
 static void disassemble_data
   PARAMS ((bfd *));
-static const char *endian_string
-  PARAMS ((enum bfd_endian));
 static asymbol ** slurp_symtab
   PARAMS ((bfd *));
 static asymbol ** slurp_dynamic_symtab
 static asymbol ** slurp_symtab
   PARAMS ((bfd *));
 static asymbol ** slurp_dynamic_symtab
@@ -2571,183 +2561,6 @@ dump_reloc_set (abfd, sec, relpp, relcount)
     }
 }
 \f
     }
 }
 \f
-/* The length of the longest architecture name + 1.  */
-#define LONGEST_ARCH sizeof("powerpc:common")
-
-static const char *
-endian_string (endian)
-     enum bfd_endian endian;
-{
-  if (endian == BFD_ENDIAN_BIG)
-    return "big endian";
-  else if (endian == BFD_ENDIAN_LITTLE)
-    return "little endian";
-  else
-    return "endianness unknown";
-}
-
-/* List the targets that BFD is configured to support, each followed
-   by its endianness and the architectures it supports.  */
-
-static void
-display_target_list ()
-{
-  extern const bfd_target *const *bfd_target_vector;
-  char *dummy_name;
-  int t;
-
-  dummy_name = make_temp_file (NULL);
-  for (t = 0; bfd_target_vector[t]; t++)
-    {
-      const bfd_target *p = bfd_target_vector[t];
-      bfd *abfd = bfd_openw (dummy_name, p->name);
-      int a;
-
-      printf ("%s\n (header %s, data %s)\n", p->name,
-             endian_string (p->header_byteorder),
-             endian_string (p->byteorder));
-
-      if (abfd == NULL)
-       {
-         nonfatal (dummy_name);
-         continue;
-       }
-
-      if (! bfd_set_format (abfd, bfd_object))
-       {
-         if (bfd_get_error () != bfd_error_invalid_operation)
-           nonfatal (p->name);
-         bfd_close_all_done (abfd);
-         continue;
-       }
-
-      for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++)
-       if (bfd_set_arch_mach (abfd, (enum bfd_architecture) a, 0))
-         printf ("  %s\n",
-                 bfd_printable_arch_mach ((enum bfd_architecture) a, 0));
-      bfd_close_all_done (abfd);
-    }
-  unlink (dummy_name);
-  free (dummy_name);
-}
-
-/* Print a table showing which architectures are supported for entries
-   FIRST through LAST-1 of bfd_target_vector (targets across,
-   architectures down).  */
-
-static void
-display_info_table (first, last)
-     int first;
-     int last;
-{
-  extern const bfd_target *const *bfd_target_vector;
-  int t, a;
-  char *dummy_name;
-
-  /* Print heading of target names.  */
-  printf ("\n%*s", (int) LONGEST_ARCH, " ");
-  for (t = first; t < last && bfd_target_vector[t]; t++)
-    printf ("%s ", bfd_target_vector[t]->name);
-  putchar ('\n');
-
-  dummy_name = make_temp_file (NULL);
-  for (a = (int) bfd_arch_obscure + 1; a < (int) bfd_arch_last; a++)
-    if (strcmp (bfd_printable_arch_mach (a, 0), "UNKNOWN!") != 0)
-      {
-       printf ("%*s ", (int) LONGEST_ARCH - 1,
-               bfd_printable_arch_mach (a, 0));
-       for (t = first; t < last && bfd_target_vector[t]; t++)
-         {
-           const bfd_target *p = bfd_target_vector[t];
-           bfd_boolean ok = TRUE;
-           bfd *abfd = bfd_openw (dummy_name, p->name);
-
-           if (abfd == NULL)
-             {
-               nonfatal (p->name);
-               ok = FALSE;
-             }
-
-           if (ok)
-             {
-               if (! bfd_set_format (abfd, bfd_object))
-                 {
-                   if (bfd_get_error () != bfd_error_invalid_operation)
-                     nonfatal (p->name);
-                   ok = FALSE;
-                 }
-             }
-
-           if (ok)
-             {
-               if (! bfd_set_arch_mach (abfd, a, 0))
-                 ok = FALSE;
-             }
-
-           if (ok)
-             printf ("%s ", p->name);
-           else
-             {
-               int l = strlen (p->name);
-               while (l--)
-                 putchar ('-');
-               putchar (' ');
-             }
-           if (abfd != NULL)
-             bfd_close_all_done (abfd);
-         }
-       putchar ('\n');
-      }
-  unlink (dummy_name);
-  free (dummy_name);
-}
-
-/* Print tables of all the target-architecture combinations that
-   BFD has been configured to support.  */
-
-static void
-display_target_tables ()
-{
-  int t, columns;
-  extern const bfd_target *const *bfd_target_vector;
-  char *colum;
-
-  columns = 0;
-  colum = getenv ("COLUMNS");
-  if (colum != NULL)
-    columns = atoi (colum);
-  if (columns == 0)
-    columns = 80;
-
-  t = 0;
-  while (bfd_target_vector[t] != NULL)
-    {
-      int oldt = t, wid;
-
-      wid = LONGEST_ARCH + strlen (bfd_target_vector[t]->name) + 1;
-      ++t;
-      while (wid < columns && bfd_target_vector[t] != NULL)
-       {
-         int newwid;
-
-         newwid = wid + strlen (bfd_target_vector[t]->name) + 1;
-         if (newwid >= columns)
-           break;
-         wid = newwid;
-         ++t;
-       }
-      display_info_table (oldt, t);
-    }
-}
-
-static void
-display_info ()
-{
-  printf (_("BFD header file version %s\n"), BFD_VERSION_STRING);
-  display_target_list ();
-  display_target_tables ();
-}
-
 int main PARAMS ((int, char **));
 
 int
 int main PARAMS ((int, char **));
 
 int
@@ -2943,7 +2756,7 @@ main (argc, argv)
     usage (stderr, 2);
 
   if (formats_info)
     usage (stderr, 2);
 
   if (formats_info)
-    display_info ();
+    exit_status = display_info ();
   else
     {
       if (optind == argc)
   else
     {
       if (optind == argc)
This page took 0.037684 seconds and 4 git commands to generate.