=== modified file 'ChangeLog'
--- ChangeLog 2009-12-26 23:43:21 +0000
+++ ChangeLog 2009-12-27 19:30:55 +0000
@@ -1,5 +1,10 @@
2009-12-27 Carles Pina i Estany
+ * commands/help.c: Inclue `grub/mm.h'.
+ (grub_cmd_help): Prepends cmd->name before cmd->summary.
+
+2009-12-27 Carles Pina i Estany
+
* normal/cmdline.c (grub_cmdline_get): Print a space after prompt.
* normal/main.c (grub_normal_read_line): Remove a space from the
default prompt.
=== modified file 'commands/help.c'
--- commands/help.c 2009-12-25 23:50:59 +0000
+++ commands/help.c 2009-12-27 19:28:44 +0000
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
static grub_err_t
grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
@@ -40,15 +41,22 @@ grub_cmd_help (grub_extcmd_t ext __attri
{
char description[GRUB_TERM_WIDTH / 2];
const char* summary_translated = _(cmd->summary);
- int desclen = grub_strlen (summary_translated);
+ int desclen = grub_strlen (cmd->name) + grub_strlen (" ") +
+ grub_strlen (summary_translated) + 1;
+
+ char* help_line = grub_malloc (desclen);
+ grub_sprintf (help_line, "%s %s", cmd->name, summary_translated);
+ help_line[desclen-1] = ' ';
/* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
with the description followed by spaces. */
grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
- grub_memcpy (description, summary_translated,
+ grub_memcpy (description, help_line,
(desclen < GRUB_TERM_WIDTH / 2 - 1
? desclen : GRUB_TERM_WIDTH / 2 - 1));
+
+ grub_free (help_line);
grub_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " ");
}