From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LQRhA-0007VL-E9 for mharc-grub-devel@gnu.org; Fri, 23 Jan 2009 14:28:00 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQRh7-0007Uw-P8 for grub-devel@gnu.org; Fri, 23 Jan 2009 14:27:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQRh5-0007Ug-MT for grub-devel@gnu.org; Fri, 23 Jan 2009 14:27:56 -0500 Received: from [199.232.76.173] (port=44984 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQRh5-0007Ud-KJ for grub-devel@gnu.org; Fri, 23 Jan 2009 14:27:55 -0500 Received: from mailout03.t-online.de ([194.25.134.81]:43951) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LQRh5-0004z1-90 for grub-devel@gnu.org; Fri, 23 Jan 2009 14:27:55 -0500 Received: from fwd11.aul.t-online.de by mailout03.sul.t-online.de with smtp id 1LQRh1-00057v-01; Fri, 23 Jan 2009 20:27:51 +0100 Received: from [10.3.2.2] (VUczbyZbohIsYB8cHMSL1K0E56maRrqQk7m0mNsAxDFrmL6xPFwdXp6l+miGDrPwCK@[217.235.230.153]) by fwd11.aul.t-online.de with esmtp id 1LQRgs-04qYSG0; Fri, 23 Jan 2009 20:27:42 +0100 Message-ID: <497A1A30.9@t-online.de> Date: Fri, 23 Jan 2009 20:27:44 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11 MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: multipart/mixed; boundary="------------010709030307080004030603" X-ID: VUczbyZbohIsYB8cHMSL1K0E56maRrqQk7m0mNsAxDFrmL6xPFwdXp6l+miGDrPwCK X-TOI-MSGID: 23b3280e-a81a-40e2-8230-e80b7e271549 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH] Allow more than one line in option help text X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jan 2009 19:27:58 -0000 This is a multi-part message in MIME format. --------------010709030307080004030603 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 * normal/arg.c (grub_arg_show_help): Add indentation if '\n' appears in option help text. --------------010709030307080004030603 Content-Type: text/x-diff; name="grub2-arg-longhelp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-arg-longhelp.patch" 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) { --------------010709030307080004030603--