sim: nrun: use lbasename

This commit is contained in:
Mike Frysinger 2016-01-03 01:44:44 -05:00
parent 0cb8d8513c
commit aba6f46b23
2 changed files with 9 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2016-01-03 Mike Frysinger <vapier@gentoo.org>
* nrun.c (myname): Mark const.
(main): Mark name const. Replace myname parsing loop with a
call to lbasename.
2016-01-03 Mike Frysinger <vapier@gentoo.org> 2016-01-03 Mike Frysinger <vapier@gentoo.org>
(CONFIG_CFLAGS): Delte $(SIM_HOSTENDIAN). (CONFIG_CFLAGS): Delte $(SIM_HOSTENDIAN).

View file

@ -47,7 +47,7 @@ static void usage (void);
extern host_callback default_callback; extern host_callback default_callback;
static char *myname; static const char *myname;
static SIM_DESC sd; static SIM_DESC sd;
@ -64,7 +64,7 @@ cntrl_c (int sig)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
char *name; const char *name;
char **prog_argv = NULL; char **prog_argv = NULL;
struct bfd *prog_bfd; struct bfd *prog_bfd;
enum sim_stop reason; enum sim_stop reason;
@ -72,9 +72,7 @@ main (int argc, char **argv)
int single_step = 0; int single_step = 0;
RETSIGTYPE (*prev_sigint) (); RETSIGTYPE (*prev_sigint) ();
myname = argv[0] + strlen (argv[0]); myname = lbasename (argv[0]);
while (myname > argv[0] && myname[-1] != '/')
--myname;
/* INTERNAL: When MYNAME is `step', single step the simulator /* INTERNAL: When MYNAME is `step', single step the simulator
instead of allowing it to run free. The sole purpose of this instead of allowing it to run free. The sole purpose of this