diff options
author | Andrew Cagney <cagney@redhat.com> | 1997-09-10 22:47:12 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 1997-09-10 22:47:12 +0000 |
commit | cad7297e805c8c4ed5c45196f0c8c0ee1b7b0bfa (patch) | |
tree | 4092626d810685e0ae5038e32d19ada0a89562ee /sim/common/sim-options.c | |
parent | 43898c918f3ed9bd3391c5f63ed1e29beb778c4c (diff) | |
download | gdb-cad7297e805c8c4ed5c45196f0c8c0ee1b7b0bfa.zip gdb-cad7297e805c8c4ed5c45196f0c8c0ee1b7b0bfa.tar.gz gdb-cad7297e805c8c4ed5c45196f0c8c0ee1b7b0bfa.tar.bz2 |
o Wordwrap usage messages from sim-options
o Clarify how to use alias options
o use in sim-watch (better usage message)
o Don't pass something on the stack into the
watch-point interrupt hander.
Diffstat (limited to 'sim/common/sim-options.c')
-rw-r--r-- | sim/common/sim-options.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index 17c1402..96e1dba 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -464,6 +464,7 @@ sim_print_help (sd, is_command) for (ol = STATE_OPTIONS (sd); ol != NULL; ol = ol->next) for (opt = ol->options; opt->opt.name != NULL; ++opt) { + const int indent = 30; int comma, len; const OPTION *o; @@ -546,16 +547,30 @@ sim_print_help (sd, is_command) } while (o->opt.name != NULL && o->doc == NULL); - if (len >= 30) + if (len >= indent) { - sim_io_printf (sd, "\n"); - len = 0; + sim_io_printf (sd, "\n%*s", indent, ""); } + else + sim_io_printf (sd, "%*s", indent - len, ""); - for (; len < 30; len++) - sim_io_printf (sd, " "); - - sim_io_printf (sd, "%s\n", opt->doc); + { + const char *chp = opt->doc; + int doc_width = 80 - indent; + while (strlen (chp) >= doc_width) /* some slack */ + { + const char *end = chp + doc_width - 1; + while (end > chp && !isspace (*end)) + end --; + if (end == chp) + end = chp + doc_width - 1; + sim_io_printf (sd, "%.*s\n%*s", end - chp, chp, indent, ""); + chp = end; + while (isspace (*chp) && *chp != '\0') + chp++; + } + sim_io_printf (sd, "%s\n", chp); + } } sim_io_printf (sd, "\n"); |