- int t;
- int ret = 1;
- char *dummy_name;
- enum bfd_architecture a;
-
- /* 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 = bfd_arch_obscure + 1; a < 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);