From d07dddd2b24abd93f92412a6764129f29c1acc0e Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Wed, 27 Aug 1997 00:35:34 +0000 Subject: Save a copy of argv, not just a pointer. --- sim/common/sim-options.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'sim/common/sim-options.c') diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 7a8dbe7..8ed5f63 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -375,7 +375,7 @@ sim_parse_args (sd, argv) if (optc == -1) { if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE) - STATE_PROG_ARGV (sd) = argv + optind; + STATE_PROG_ARGV (sd) = sim_copy_argv (argv + optind); break; } if (optc == '?') @@ -405,7 +405,11 @@ sim_print_help (sd, is_command) /* Initialize duplicate argument checker. */ (void) dup_arg_p (NULL); - sim_io_printf (sd, "Options:\n"); + if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE) + sim_io_printf (sd, "Options:\n"); + else + sim_io_printf (sd, "Commands:\n"); + for (ol = STATE_OPTIONS (sd); ol != NULL; ol = ol->next) for (opt = ol->options; opt->opt.name != NULL; ++opt) { @@ -503,6 +507,11 @@ sim_print_help (sd, is_command) sim_io_printf (sd, "%s\n", opt->doc); } + sim_io_printf (sd, "\n"); + sim_io_printf (sd, "Note: Depending on the simulator configuration some %ss\n", + STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE ? "option" : "command"); + sim_io_printf (sd, " may not be applicable\n"); + if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE) { sim_io_printf (sd, "\n"); -- cgit v1.1