* nlmconv.c (main), objcopy.c (copy_file): Print matching formats

if ambiguous match.
	* nm.c (display_file), size.c (display_bfd): Eliminate gotos.
	Print matching formats if there is an ambiguous match.  Use
	bfd_nonfatal instead of hardcoded error message if nothing matches.

	* arsup.c, ar.c, objdump.c: Use bfd_get_filename instead of
	abfd->filename.

	* nm.c (display_archive): New function, from code in display_file.
	(display_rel_file): Renamed from do_one_rel_file.

	* size.c: Indent.
	(display_archive): New function from code in display_file.
	(display_file): Check bfd_close error return.

	* strings.c (strings_object_file): Check bfd_check_format
	error return.

	* strings.c, objdump.c, size.c: Use bfd_nonfatal instead of bfd_perror.

	* bucomm.c: Delete references to exit_handler.  It wasn't set
	anywhere, and now that we're using the libiberty xmalloc, it
	wouldn't always get called before exiting.
	(list_matching_formats): Function moved from objdump.c.
	* bucomm.h: Declare it.

	* objdump.c (disassemble_data): Move some variable decls closer to
	their use.  Add some comments.  Replace a nested block with a
	return.
This commit is contained in:
David MacKenzie 1994-02-03 00:25:30 +00:00
parent b4bd2c92c5
commit cef35d4882
8 changed files with 1141 additions and 561 deletions

View file

@ -390,6 +390,7 @@ copy_file (input_filename, output_filename, input_target, output_target)
char *output_target;
{
bfd *ibfd;
char **matching;
/* To allow us to do "strip *" without dying on the first
non-object file, failures are nonfatal. */
@ -400,7 +401,16 @@ copy_file (input_filename, output_filename, input_target, output_target)
nonfatal (input_filename);
}
if (bfd_check_format (ibfd, bfd_object))
if (bfd_check_format (ibfd, bfd_archive))
{
bfd *obfd = bfd_openw (output_filename, output_target);
if (obfd == NULL)
{
nonfatal (output_filename);
}
copy_archive (ibfd, obfd, output_target);
}
else if (bfd_check_format_matches (ibfd, bfd_object, &matching))
{
bfd *obfd = bfd_openw (output_filename, output_target);
if (obfd == NULL)
@ -420,20 +430,15 @@ copy_file (input_filename, output_filename, input_target, output_target)
nonfatal (input_filename);
}
}
else if (bfd_check_format (ibfd, bfd_archive))
{
bfd *obfd = bfd_openw (output_filename, output_target);
if (obfd == NULL)
{
nonfatal (output_filename);
}
copy_archive (ibfd, obfd, output_target);
}
else
{
/* Get the right error message. */
bfd_check_format (ibfd, bfd_object);
nonfatal (input_filename);
bfd_nonfatal (input_filename);
if (bfd_error == file_ambiguously_recognized)
{
list_matching_formats (matching);
free (matching);
}
status = 1;
}
}