(CONFIG_CFLAGS): Add it.
* aclocal.m4 (SIM_AC_OPTION_ENVIRONMENT): Handle
--enable-sim-environment option.
* configure: Regenerated.
* sim-config.h (environment support): Rewrite.
* sim-config.c (current_environment): Define as enum, unconditionally.
(current_alignment): Define unconditionally.
(config_environment_to_a): Update.
(config_alignment_to_a): Fix type of argument. Define unconditionally.
(sim_config): Handle environment and alignment determination
unconditionally. Delete sanity checks of current_environment,
unnecessary.
(print_sim_config): Update.
* sim-options.c (STANDARD_OPTIONS enum): Add OPTION_ENVIRONMENT.
(standard_options): Add --environment.
(standard_option_handler): Likewise.
+Wed Dec 3 17:56:02 1997 Doug Evans <devans@canuck.cygnus.com>
+
+ * Make-common.in (SIM_ENVIRONMENT): New variable.
+ (CONFIG_CFLAGS): Add it.
+ * aclocal.m4 (SIM_AC_OPTION_ENVIRONMENT): Handle
+ --enable-sim-environment option.
+ * configure: Regenerated.
+ * sim-config.h (environment support): Rewrite.
+ * sim-config.c (current_environment): Define as enum, unconditionally.
+ (current_alignment): Define unconditionally.
+ (config_environment_to_a): Update.
+ (config_alignment_to_a): Fix type of argument. Define unconditionally.
+ (sim_config): Handle environment and alignment determination
+ unconditionally. Delete sanity checks of current_environment,
+ unnecessary.
+ (print_sim_config): Update.
+ * sim-options.c (STANDARD_OPTIONS enum): Add OPTION_ENVIRONMENT.
+ (standard_options): Add --environment.
+ (standard_option_handler): Likewise.
+
+Fri Nov 28 12:21:25 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-alu.h: Add notes on carry vs borrow for subtraction.
+ (ALU{,8,16,32,64}ADD): Redefine ADD macro as add overflowing.
+ (ALU{,8,16,32,64}ADDC): Define - add carrying.
+ (ALU{,8,16,32,64}SUB): Redefine SUB macro as subtract overflowing.
+ (ALU{,8,16,32,64}SUBB): Define - subtract borrowing.
+ (ALU{,8,16,32,64}SUBC): Define - tract carrying.
+ (ALU{,8,16,32,64}ADD_CA, ALU{,8,16,32,64}ADDC_C): Replace single
+ argument ADD_CA macro with two argument ADDC_C - add carrying with
+ carry in.
+ (ALU{,8,16,32,64}SUB_CA, ALU{,8,16,32,64}SUBC_X): Replace single
+ argument SUB_CA macro with two argument SUBC_X - subtract
+ carrying, extended.
+ (ALU{,8,16,32,64}SUBB_B): Define - subtract borrowing with
+ borrow-in.
+ (ALU{,8,16,32,64}NEGC, ALU{,8,16,32,64}NEGB): Define.
+
Sun Nov 30 17:40:57 1997 Michael Meissner <meissner@cygnus.com>
* sim-io.c (sim_io_{syscalls,getstring}): Delete. No longer used.
SIM_BITSIZE = @sim_bitsize@
SIM_DEFAULT_MODEL = @sim_default_model@
SIM_ENDIAN = @sim_endian@
+SIM_ENVIRONMENT = @sim_environment@
SIM_FLOAT = @sim_float@
SIM_HARDWARE = @sim_hardware@
SIM_HOSTENDIAN = @sim_hostendian@
$(SIM_ALIGNMENT) \
$(SIM_BITSIZE) \
$(SIM_ENDIAN) \
+ $(SIM_ENVIRONMENT) \
$(SIM_FLOAT) \
$(SIM_HARDWARE) \
$(SIM_HOSTENDIAN) \
LIB_OBJS = callback.o syscall.o targ-map.o $(SIM_OBJS)
-all: $(SIM_EXTRA_ALL) libsim.a run
+all: $(SIM_EXTRA_ALL) libsim.a run .gdbinit
libsim.a: $(LIB_OBJS)
rm -f libsim.a
$(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS)
run.o: $(srccom)/run.c config.h tconfig.h \
- $(srcroot)/include/callback.h
+ $(srcroot)/include/remote-sim.h $(srcroot)/include/callback.h
$(CC) -c $(srccom)/run.c $(ALL_CFLAGS)
# FIXME: Ideally, callback.o and friends live in a library outside of
$(CC) -c $(srccom)/sim-fpu.c $(ALL_CFLAGS)
sim-hload.o: $(srccom)/sim-hload.c $(sim-assert_h) \
+ $(srcroot)/include/remote-sim.h \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-hload.c $(ALL_CFLAGS)
-sim-hrw.o: $(srccom)/sim-hrw.c $(sim-assert_h) \
+sim-hrw.o: $(srccom)/sim-hrw.c $(sim-assert_h) $(sim_core_h) \
+ $(srcroot)/include/remote-sim.h \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srccom)/sim-hrw.c $(ALL_CFLAGS)
cat $(srccom)/$@ >> tmp-$@
$(srcdir)/../../move-if-change tmp-$@ $@
-sim-io.o: $(srccom)/sim-io.c $(sim_main_headers) $(sim-io_h)
+sim-io.o: $(srccom)/sim-io.c $(sim_main_headers) $(sim-io_h) \
+ $(srcroot)/include/remote-sim.h
$(CC) -c $(srccom)/sim-io.c $(ALL_CFLAGS)
sim-memopt.o: $(srccom)/sim-memopt.c $(sim_main_headers) \
$(sim-options_h) $(sim-io_h)
$(CC) -c $(srccom)/sim-options.c $(ALL_CFLAGS)
-sim-reason.o: $(srccom)/sim-reason.c $(sim_main_headers)
+sim-reason.o: $(srccom)/sim-reason.c $(sim_main_headers) \
+ $(srcroot)/include/remote-sim.h
$(CC) -c $(srccom)/sim-reason.c $(ALL_CFLAGS)
-sim-resume.o: $(srccom)/sim-resume.c $(sim_main_headers)
+sim-resume.o: $(srccom)/sim-resume.c $(sim_main_headers) \
+ $(srcroot)/include/remote-sim.h
$(CC) -c $(srccom)/sim-resume.c $(ALL_CFLAGS)
sim-run.o: $(srccom)/sim-run.c $(sim_main_headers)
$(CC) -c $(srccom)/sim-break.c $(ALL_CFLAGS)
nrun.o: $(srccom)/nrun.c config.h tconfig.h \
- $(srcroot)/include/callback.h $(sim_main_headers)
+ $(srcroot)/include/remote-sim.h $(srcroot)/include/callback.h \
+ $(sim_main_headers)
$(CC) -c $(srccom)/nrun.c $(ALL_CFLAGS)
# CGEN support.
int current_target_byte_order;
int current_stdio;
-#if defined (WITH_ENVIRONMENT)
-int current_environment;
-#endif
+/* The currently selected environment.
+ This isn't used unless the choice is runtime selectable.
+ The proper way to determine the currently selected environment
+ is with the CURRENT_ENVIRONMENT macro.
+ This is set to ALL_ENVIRONMENT to indicate none has been selected yet. */
+enum sim_environment current_environment = ALL_ENVIRONMENT;
-#if defined (WITH_ALIGNMENT)
enum sim_alignments current_alignment;
-#endif
#if defined (WITH_FLOATING_POINT)
int current_floating_point;
}
-#if defined (WITH_ENVIRONMENT)
static const char *
-config_environment_to_a (int environment)
+config_environment_to_a (enum sim_environment environment)
{
switch (environment)
{
+ case ALL_ENVIRONMENT:
+ return "ALL_ENVIRONMENT";
case USER_ENVIRONMENT:
return "USER_ENVIRONMENT";
case VIRTUAL_ENVIRONMENT:
return "VIRTUAL_ENVIRONMENT";
case OPERATING_ENVIRONMENT:
return "OPERATING_ENVIRONMENT";
- case 0:
- return "0";
}
return "UNKNOWN";
}
-#endif
static const char *
-config_alignment_to_a (int alignment)
+config_alignment_to_a (enum sim_alignments alignment)
{
switch (alignment)
{
}
-#if defined (WITH_ENVIRONMENT)
-
/* set the environment */
#if (WITH_DEVICES)
- if (current_environment == 0)
+ if (current_environment == ALL_ENVIRONMENT)
{
const char *env =
tree_find_string_property(root, "/openprom/options/env");
: (strcmp(env, "operating") == 0
|| strcmp(env, "oea") == 0)
? OPERATING_ENVIRONMENT
- : 0);
- }
-#endif
- if (current_environment == 0)
- current_environment = WITH_ENVIRONMENT;
-
- /* verify the environment */
- if (CURRENT_ENVIRONMENT == 0)
- {
- sim_io_eprintf (sd, "Target environment unspecified\n");
- return SIM_RC_FAIL;
- }
- if (CURRENT_ENVIRONMENT != current_environment)
- {
- sim_io_eprintf (sd, "Target (%s) and configured (%s) environment in conflict\n",
- config_environment_to_a (CURRENT_ENVIRONMENT),
- config_environment_to_a (current_environment));
- return SIM_RC_FAIL;
+ : ALL_ENVIRONMENT);
}
#endif
+ if (current_environment == ALL_ENVIRONMENT)
+ current_environment = DEFAULT_ENVIRONMENT;
-#if defined (WITH_ALIGNMENT)
-
/* set the alignment */
#if defined (WITH_DEVICES)
if (current_alignment == 0)
#endif
if (current_alignment == 0)
current_alignment = WITH_ALIGNMENT;
+ if (current_alignment == 0)
+ current_alignment = WITH_DEFAULT_ALIGNMENT;
/* verify the alignment */
if (CURRENT_ALIGNMENT == 0)
config_alignment_to_a (current_alignment));
return SIM_RC_FAIL;
}
-#endif
-
-#if defined (WITH_FLOAING_POINT)
+#if defined (WITH_FLOATING_POINT)
/* set the floating point */
if (current_floating_point == 0)
sim_io_printf (sd, "WITH_TARGET_WORD_MSB = %d\n",
WITH_TARGET_WORD_MSB);
-#if defined (WITH_XOR_ENDIAN)
- sim_io_printf (sd, "WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN);
-#endif
-
-#if defined (WITH_ENVIRONMENT)
sim_io_printf (sd, "WITH_ENVIRONMENT = %s\n",
config_environment_to_a (WITH_ENVIRONMENT));
-#endif
-#if defined (WITH_ALIGNMENT)
sim_io_printf (sd, "WITH_ALIGNMENT = %s\n",
config_alignment_to_a (WITH_ALIGNMENT));
+
+#if defined (WITH_DEFAULT_ALIGNMENT)
+ sim_io_printf (sd, "WITH_DEFAULT_ALIGNMENT = %s\n",
+ config_alignment_to_a (WITH_DEFAULT_ALIGNMENT));
+#endif
+
+#if defined (WITH_XOR_ENDIAN)
+ sim_io_printf (sd, "WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN);
#endif
#if defined (WITH_FLOATING_POINT)
sim_io_printf (sd, "WITH_RESERVED_BITS = %d\n", WITH_RESERVED_BITS);
#endif
+#if defined (WITH_PROFILE)
+ sim_io_printf (sd, "WITH_PROFILE = %d\n", WITH_PROFILE);
+#endif
+
}
expect to see (VEA includes things like coherency and the time
base) while OEA is what an operating system expects to see. By
setting these to specific values, the build process is able to
- eliminate non relevent environment code
+ eliminate non relevent environment code.
CURRENT_ENVIRONMENT specifies which of vea or oea is required for
- the current runtime. */
+ the current runtime.
+
+ ALL_ENVIRONMENT is used during configuration as a value for
+ WITH_ENVIRONMENT to indicate the choice is runtime selectable.
+ The default is then USER_ENVIRONMENT [since allowing the user to choose
+ the default at configure time seems like featuritis and since people using
+ OPERATING_ENVIRONMENT have more to worry about than selecting the default].
+ ALL_ENVIRONMENT is also used to set `current_environment' to the
+ "unknown" state. */
+
+enum sim_environment {
+ ALL_ENVIRONMENT,
+ USER_ENVIRONMENT,
+ VIRTUAL_ENVIRONMENT,
+ OPERATING_ENVIRONMENT
+};
-#if defined (WITH_ENVIRONMENT)
+/* If the simulator specified SIM_AC_OPTION_ENVIRONMENT, indicate so. */
+#ifdef WITH_ENVIRONMENT
+#define SIM_HAVE_ENVIRONMENT
+#endif
-#define USER_ENVIRONMENT 1
-#define VIRTUAL_ENVIRONMENT 2
-#define OPERATING_ENVIRONMENT 3
+/* If the simulator doesn't specify SIM_AC_OPTION_ENVIRONMENT in its
+ configure.in, the only supported environment is the user environment. */
+#ifndef WITH_ENVIRONMENT
+#define WITH_ENVIRONMENT USER_ENVIRONMENT
+#endif
-extern int current_environment;
-#define CURRENT_ENVIRONMENT (WITH_ENVIRONMENT \
+#define DEFAULT_ENVIRONMENT (WITH_ENVIRONMENT != ALL_ENVIRONMENT \
? WITH_ENVIRONMENT \
- : current_environment)
-
-#endif
+ : USER_ENVIRONMENT)
+extern enum sim_environment current_environment;
+#define CURRENT_ENVIRONMENT (WITH_ENVIRONMENT != ALL_ENVIRONMENT \
+ ? WITH_ENVIRONMENT \
+ : current_environment)
/* Callback & Modulo Memory.
extern enum sim_alignments current_alignment;
#if !defined (WITH_ALIGNMENT)
-#define WITH_ALIGNMENT NONSTRICT_ALIGNMENT
+#define WITH_ALIGNMENT 0
#endif
#if !defined (WITH_DEFAULT_ALIGNMENT)
#endif
#include <ctype.h>
#include "libiberty.h"
-#include "../libiberty/alloca-conf.h"
#include "sim-options.h"
#include "sim-io.h"
#include "sim-assert.h"
If you decide to conditionally compile them out as well, delete this
comment and add a comment saying that that is the rule. */
-#define OPTION_DEBUG_INSN (OPTION_START + 0)
-#define OPTION_DEBUG_FILE (OPTION_START + 1)
-#define OPTION_DO_COMMAND (OPTION_START + 2)
-#define OPTION_ARCHITECTURE (OPTION_START + 3)
-#define OPTION_TARGET (OPTION_START + 4)
-#define OPTION_ARCHITECTURE_INFO (OPTION_START + 5)
-#define OPTION_ALIGNMENT (OPTION_START + 6)
+typedef enum {
+ OPTION_DEBUG_INSN = OPTION_START,
+ OPTION_DEBUG_FILE,
+ OPTION_DO_COMMAND,
+ OPTION_ARCHITECTURE,
+ OPTION_TARGET,
+ OPTION_ARCHITECTURE_INFO,
+ OPTION_ENVIRONMENT,
+ OPTION_ALIGNMENT,
+ OPTION_VERBOSE,
+#if defined (SIM_HAVE_BIENDIAN)
+ OPTION_ENDIAN,
+#endif
+ OPTION_DEBUG,
+#ifdef SIM_HAVE_FLATMEM
+ OPTION_MEM_SIZE,
+#endif
+ OPTION_HELP,
+#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
+ OPTION_H8300,
+#endif
+} STANDARD_OPTIONS;
static const OPTION standard_options[] =
{
- { {"verbose", no_argument, NULL, 'v'},
+ { {"verbose", no_argument, NULL, OPTION_VERBOSE},
'v', NULL, "Verbose output",
standard_option_handler },
#if defined (SIM_HAVE_BIENDIAN) /* ??? && WITH_TARGET_BYTE_ORDER == 0 */
- { {"endian", required_argument, NULL, 'E'},
+ { {"endian", required_argument, NULL, OPTION_ENDIAN},
'E', "big|little", "Set endianness",
standard_option_handler },
#endif
+#ifdef SIM_HAVE_ENVIRONMENT
+ /* This option isn't supported unless all choices are supported in keeping
+ with the goal of not printing in --help output things the simulator can't
+ do [as opposed to things that just haven't been configured in]. */
+ { {"environment", required_argument, NULL, OPTION_ENVIRONMENT},
+ '\0', "user|virtual|operating", "Set running environment",
+ standard_option_handler },
+#endif
+
{ {"alignment", required_argument, NULL, OPTION_ALIGNMENT},
'\0', "strict|nonstrict|forced", "Set memory access alignment",
standard_option_handler },
- { {"debug", no_argument, NULL, 'D'},
+ { {"debug", no_argument, NULL, OPTION_DEBUG},
'D', NULL, "Print debugging messages",
standard_option_handler },
{ {"debug-insn", no_argument, NULL, OPTION_DEBUG_INSN},
standard_option_handler },
#ifdef SIM_H8300 /* FIXME: Should be movable to h8300 dir. */
- { {"h8300h", no_argument, NULL, 'h'},
+ { {"h8300h", no_argument, NULL, OPTION_H8300},
'h', NULL, "Indicate the CPU is h8/300h or h8/300s",
standard_option_handler },
#endif
#ifdef SIM_HAVE_FLATMEM
- { {"mem-size", required_argument, NULL, 'm'},
+ { {"mem-size", required_argument, NULL, OPTION_MEM_SIZE},
'm', "MEMORY SIZE", "Specify memory size",
standard_option_handler },
#endif
'\0', "COMMAND", ""/*undocumented*/,
standard_option_handler },
- { {"help", no_argument, NULL, 'H'},
+ { {"help", no_argument, NULL, OPTION_HELP},
'H', NULL, "Print help information",
standard_option_handler },
{
int i,n;
- switch (opt)
+ switch ((STANDARD_OPTIONS) opt)
{
- case 'v' :
+ case OPTION_VERBOSE:
STATE_VERBOSE_P (sd) = 1;
break;
#ifdef SIM_HAVE_BIENDIAN
- case 'E' :
+ case OPTION_ENDIAN:
if (strcmp (arg, "big") == 0)
{
if (WITH_TARGET_BYTE_ORDER == LITTLE_ENDIAN)
break;
#endif
+ case OPTION_ENVIRONMENT:
+ if (strcmp (arg, "user") == 0)
+ current_environment = USER_ENVIRONMENT;
+ else if (strcmp (arg, "virtual") == 0)
+ current_environment = VIRTUAL_ENVIRONMENT;
+ else if (strcmp (arg, "operating") == 0)
+ current_environment = OPERATING_ENVIRONMENT;
+ else
+ {
+ sim_io_eprintf (sd, "Invalid environment specification `%s'\n", arg);
+ return SIM_RC_FAIL;
+ }
+ if (WITH_ENVIRONMENT != ALL_ENVIRONMENT
+ && WITH_ENVIRONMENT != current_environment)
+ {
+ char *type;
+ switch (WITH_ENVIRONMENT)
+ {
+ case USER_ENVIRONMENT: type = "user"; break;
+ case VIRTUAL_ENVIRONMENT: type = "virtual"; break;
+ case OPERATING_ENVIRONMENT: type = "operating"; break;
+ }
+ sim_io_eprintf (sd, "Simulator compiled for the %s environment only.\n",
+ type);
+ return SIM_RC_FAIL;
+ }
+ break;
+
case OPTION_ALIGNMENT:
if (strcmp (arg, "strict") == 0)
{
sim_io_eprintf (sd, "Simulator compiled for strict alignment only.\n");
break;
case NONSTRICT_ALIGNMENT:
- sim_io_eprintf (sd, "Simulator compiled for nonsitrct alignment only.\n");
+ sim_io_eprintf (sd, "Simulator compiled for nonstrict alignment only.\n");
break;
case FORCED_ALIGNMENT:
sim_io_eprintf (sd, "Simulator compiled for forced alignment only.\n");
}
return SIM_RC_FAIL;
- case 'D' :
+ case OPTION_DEBUG:
if (! WITH_DEBUG)
sim_io_eprintf (sd, "Debugging not compiled in, `-D' ignored\n");
else
break;
#ifdef SIM_H8300 /* FIXME: Can be moved to h8300 dir. */
- case 'h' :
+ case OPTION_H8300:
set_h8300h (1);
break;
#endif
#ifdef SIM_HAVE_FLATMEM
- case 'm':
+ case OPTION_MEM_SIZE:
{
unsigned long ul = strtol (arg, NULL, 0);
/* 16384: some minimal amount */
break;
}
- case 'H':
+ case OPTION_HELP:
sim_print_help (sd, is_command);
if (STATE_OPEN_KIND (sd) == SIM_OPEN_STANDALONE)
exit (0);
/* The `val' option struct entry is dynamically assigned for options that
only come in the long form. ORIG_VAL is used to get the original value
back. */
- unsigned char *orig_val;
+ int *orig_val;
struct option *lp, *long_options;
const struct option_list *ol;
const OPTION *opt;
/* Count the number of options. */
num_opts = 0;
for (ol = STATE_OPTIONS (sd); ol != NULL; ol = ol->next)
- for (opt = ol->options; opt->opt.name != NULL; ++opt)
+ for (opt = ol->options; OPTION_VALID_P (opt); ++opt)
++num_opts;
/* Initialize duplicate argument checker. */
(void) dup_arg_p (NULL);
/* Build the option table for getopt. */
- long_options = (struct option *) alloca ((num_opts + 1) * sizeof (struct option));
+ long_options = NZALLOC (struct option, num_opts + 1);
lp = long_options;
- short_options = (char *) alloca (num_opts * 3 + 1);
+ short_options = NZALLOC (char, num_opts * 3 + 1);
p = short_options;
-#if 0 /* ??? necessary anymore? */
- /* Set '+' as first char so argument permutation isn't done. This is done
- to workaround a problem with invoking getopt_long in run.c.: optind gets
- decremented when the program name is reached. */
+ handlers = NZALLOC (OPTION_HANDLER *, OPTION_START + num_opts);
+ orig_val = NZALLOC (int, OPTION_START + num_opts);
+ /* Set '+' as first char so argument permutation isn't done. This
+ is done to stop getopt_long returning options that appear after
+ the target program. Such options should be passed unchanged into
+ the program image. */
*p++ = '+';
-#endif
- handlers = (OPTION_HANDLER **) alloca (256 * sizeof (OPTION_HANDLER *));
- memset (handlers, 0, 256 * sizeof (OPTION_HANDLER *));
- orig_val = (unsigned char *) alloca (256);
for (i = OPTION_START, ol = STATE_OPTIONS (sd); ol != NULL; ol = ol->next)
- for (opt = ol->options; opt->opt.name != NULL; ++opt)
+ for (opt = ol->options; OPTION_VALID_P (opt); ++opt)
{
if (dup_arg_p (opt->opt.name))
continue;
*p++ = ':';
else if (opt->opt.has_arg == optional_argument)
{ *p++ = ':'; *p++ = ':'; }
+ handlers[(unsigned char) opt->shortopt] = opt->handler;
+ if (opt->opt.val != 0)
+ orig_val[(unsigned char) opt->shortopt] = opt->opt.val;
+ else
+ orig_val[(unsigned char) opt->shortopt] = opt->shortopt;
+ }
+ if (opt->opt.name != NULL)
+ {
+ *lp = opt->opt;
+ /* Dynamically assign `val' numbers for long options. */
+ lp->val = i++;
+ handlers[lp->val] = opt->handler;
+ orig_val[lp->val] = opt->opt.val;
+ ++lp;
}
- *lp = opt->opt;
- /* Dynamically assign `val' numbers for long options that don't have
- a short option equivalent. */
- if (OPTION_LONG_ONLY_P (opt->opt.val))
- lp->val = i++;
- handlers[(unsigned char) lp->val] = opt->handler;
- orig_val[(unsigned char) lp->val] = opt->opt.val;
- ++lp;
}
*p = 0;
lp->name = NULL;
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)
+ for (opt = ol->options; OPTION_VALID_P (opt); ++opt)
{
const int indent = 30;
int comma, len;
comma = 0;
len = 2;
+ /* list any short options (aliases) for the current OPT */
if (!is_command)
{
o = opt;
}
++o;
}
- while (o->opt.name != NULL && o->doc == NULL);
+ while (OPTION_VALID_P (o) && o->doc == NULL);
}
+ /* list any long options (aliases) for the current OPT */
o = opt;
do
{
}
++o;
}
- while (o->opt.name != NULL && o->doc == NULL);
+ while (OPTION_VALID_P (o) && o->doc == NULL);
if (len >= indent)
{
else
sim_io_printf (sd, "%*s", indent - len, "");
+ /* print the description, word wrap long lines */
{
const char *chp = opt->doc;
unsigned doc_width = 80 - indent;
int matching_argi = -1;
if (argv [0] != NULL)
for (ol = STATE_OPTIONS (sd); ol != NULL; ol = ol->next)
- for (opt = ol->options; opt->opt.name != NULL; ++opt)
+ for (opt = ol->options; OPTION_VALID_P (opt); ++opt)
{
int argi = 0;
const char *name = opt->opt.name;
+ if (name == NULL)
+ continue;
while (strncmp (name, argv [argi], strlen (argv [argi])) == 0)
{
name = &name [strlen (argv[argi])];