(main): Print error message if argument is invalid.
(usage): Improve text.
This commit is contained in:
parent
4dfb4ffcd1
commit
741fd619cb
1 changed files with 35 additions and 31 deletions
|
@ -67,22 +67,28 @@ main (ac, av)
|
|||
default:
|
||||
usage();
|
||||
}
|
||||
ac -= optind;
|
||||
av += optind;
|
||||
|
||||
if (ac != 1)
|
||||
if (ac - optind != 1)
|
||||
usage();
|
||||
|
||||
name = *av;
|
||||
name = av[ac - 1];
|
||||
|
||||
if (verbose)
|
||||
printf ("run %s\n", name);
|
||||
|
||||
abfd = bfd_openr (name, "coff-h8300");
|
||||
if (abfd)
|
||||
if (! abfd)
|
||||
{
|
||||
if (bfd_check_format(abfd, bfd_object))
|
||||
fprintf (stderr, "%s: unable to open %s\n", av[0], name);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (! bfd_check_format(abfd, bfd_object))
|
||||
{
|
||||
fprintf (stderr, "%s: %s is not a valid executable\n", av[0], name);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (abfd->arch_info->mach == bfd_mach_h8300h)
|
||||
set_h8300h (1);
|
||||
|
||||
|
@ -105,10 +111,8 @@ main (ac, av)
|
|||
abort ();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/* gdb callback used by simulator */
|
||||
|
||||
void
|
||||
printf_filtered (va_alist)
|
||||
|
@ -126,6 +130,6 @@ printf_filtered (va_alist)
|
|||
void
|
||||
usage()
|
||||
{
|
||||
fprintf (stderr, "usage: run [-tv] program\n");
|
||||
fprintf (stderr, "usage: run [-h] [-t] [-v] [-c csize] program\n");
|
||||
exit (1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue