This small patch allows '\n' in option help texts, for example:
static const struct grub_arg_option options[] = { {"very-complex", 'c', 0, "sorry, but this very complex option requires more\n" "than one line to explain properly.", 0, 0}, ... }; grub> complex -h ... -c, --very-complex sorry, but this very complex option requires more . than one line to explain properly. I need it for a new module :-) Christian 2009-01-23 Christian Franke <fra...@computer.org> * normal/arg.c (grub_arg_show_help): Add indentation if '\n' appears in option help text.
diff --git a/normal/arg.c b/normal/arg.c index 602f7ea..42cf44e 100644 --- a/normal/arg.c +++ b/normal/arg.c @@ -156,10 +156,21 @@ grub_arg_show_help (grub_command_t cmd) } } - while (spacing-- > 0) - grub_putchar (' '); + const char * doc = opt->doc; + for (;;) + { + while (spacing-- > 0) + grub_putchar (' '); + + const char * nl = grub_strchr (doc, '\n'); + if (! nl) + break; - grub_printf ("%s\n", opt->doc); + while (doc <= nl) + grub_putchar (*doc++); + spacing = 4 + 20; + } + grub_printf ("%s\n", doc); switch (opt->shortarg) {
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel