Skip to contentSkip to conversation

Quieten normal mode startup unless a prompt is going to be displayed

PATCH In review Colin Watson 2 participants 2 messages Sep 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Quieten normal mode startup unless a prompt is going to be displayed

Normal mode startup currently displays some text that really only makes sense if it's about to display a shell prompt. If it ends up displaying the menu, then that'll set up the screen for itself anyway; but in that case it really makes no sense to display a help message about BASH-like line editing being supported.

2009-09-03 Colin Watson <[email protected]>

Display normal mode shell introductory message only when it makes sense to do so.

* normal/main.c (grub_normal_reader_init): Rename to ... (grub_normal_display_intro): ... this. (grub_normal_read_line): Display introductory message if it has not yet been displayed.
(grub_normal_reader): Don't set init method.

main.c +8 -2
Index: normal/main.c
===================================================================
@@ -503,7 +503,7 @@
 }
 
 static grub_err_t
-grub_normal_reader_init (void)
+grub_normal_display_intro (void)
 {
   grub_normal_init_page ();
   grub_setcursor (1);
@@ -524,7 +524,14 @@
 {
   grub_parser_t parser = grub_parser_get_current ();
   char prompt[8 + grub_strlen (parser->name)];
+  static int displayed_intro;
 
+  if (! displayed_intro)
+    {
+      grub_normal_display_intro ();
+      displayed_intro = 1;
+    }
+
   grub_sprintf (prompt, "%s:%s> ", parser->name, (cont) ? "" : "grub");
 
   while (1)
@@ -547,7 +554,6 @@
 static struct grub_reader grub_normal_reader =
   {
     .name = "normal",
-    .init = grub_normal_reader_init,
     .read_line = grub_normal_read_line
   };
 
Signature · 1 line
Colin Watson                                       [[email protected]]
#1 lore raw
Quoted 29 lines · Colin Watson

Index: normal/main.c
===================================================================

main.c +8 -1
@@ -503,7 +503,7 @@
 }
 
 static grub_err_t
-grub_normal_reader_init (void)
+grub_normal_display_intro (void)
 {
   grub_normal_init_page ();
   grub_setcursor (1);
@@ -524,7 +524,14 @@
 {
   grub_parser_t parser = grub_parser_get_current ();
   char prompt[8 + grub_strlen (parser->name)];
+  static int displayed_intro;
 
+  if (! displayed_intro)
+    {
+      grub_normal_display_intro ();
+      displayed_intro = 1;
+    }
+
   grub_sprintf (prompt, "%s:%s> ", parser->name, (cont) ? "" : "grub");
 
   while (1)

main.c line 558

Quoted 6 lines
main.c +0 -1
@@ -547,7 +554,6 @@
 static struct grub_reader grub_normal_reader =
   {
     .name = "normal",
-    .init = grub_normal_reader_init,
     .read_line = grub_normal_read_line
   };

grub_normal_read_line() seems like an odd place to handle this. It looks like a workaround for a bug we already had (about welcome message being printed twice).

This was discussed in a thread with subject "regression in hiddenmenu" (last June). Later, Bean proposed a patch (see "[PATCH] hidemenu fix").

I would appreciate if you can have a look at both things.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."