aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/nrun.c8
2 files changed, 9 insertions, 5 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index d931834..2e444d1 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@
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>
+
(CONFIG_CFLAGS): Delte $(SIM_HOSTENDIAN).
* acinclude.m4 (SIM_AC_COMMON): Call AC_C_BIGENDIAN.
(SIM_AC_OPTION_HOSTENDIAN): Delete.
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 2e47715..94ba35d 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -47,7 +47,7 @@ static void usage (void);
extern host_callback default_callback;
-static char *myname;
+static const char *myname;
static SIM_DESC sd;
@@ -64,7 +64,7 @@ cntrl_c (int sig)
int
main (int argc, char **argv)
{
- char *name;
+ const char *name;
char **prog_argv = NULL;
struct bfd *prog_bfd;
enum sim_stop reason;
@@ -72,9 +72,7 @@ main (int argc, char **argv)
int single_step = 0;
RETSIGTYPE (*prev_sigint) ();
- myname = argv[0] + strlen (argv[0]);
- while (myname > argv[0] && myname[-1] != '/')
- --myname;
+ myname = lbasename (argv[0]);
/* INTERNAL: When MYNAME is `step', single step the simulator
instead of allowing it to run free. The sole purpose of this