~ubuntu-branches/debian/sid/grub2/sid-200907171829

« back to all changes in this revision

Viewing changes to normal/menu_text.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Millan
  • Date: 2008-09-06 14:56:38 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20080906145638-bebxruprp7sacwon
Tags: 1.96+20080724-10
* patches/03_disable_floppies.diff: Free .drive struct member when skipping
  floppy drives.  (Closes: #496040)
* patches/902_boot_blocklist_hack.diff: Support separate /boot when using
  blocklists.  (Closes: #496820, #489287, #494589)
* patches/00_ntfs_insensitive.diff: They say NTFS is an insensitive fool.
  It must be true! (use case insensitive match in NTFS) (Closes: #497889)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* menu_text.c - Basic text menu implementation.  */
2
 
/*
3
 
 *  GRUB  --  GRand Unified Bootloader
4
 
 *  Copyright (C) 2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
5
 
 *
6
 
 *  GRUB is free software: you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation, either version 3 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  GRUB is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
18
 
 */
19
 
 
20
 
#include <grub/normal.h>
21
 
#include <grub/term.h>
22
 
#include <grub/misc.h>
23
 
#include <grub/loader.h>
24
 
#include <grub/mm.h>
25
 
#include <grub/time.h>
26
 
#include <grub/env.h>
27
 
#include <grub/menu_viewer.h>
28
 
 
29
 
/* Time to delay after displaying an error message about a default/fallback
30
 
   entry failing to boot.  */
31
 
#define DEFAULT_ENTRY_ERROR_DELAY_MS  2500
32
 
 
33
 
static grub_uint8_t grub_color_menu_normal;
34
 
static grub_uint8_t grub_color_menu_highlight;
35
 
 
36
 
/* Wait until the user pushes any key so that the user
37
 
   can see what happened.  */
38
 
void
39
 
grub_wait_after_message (void)
40
 
{
41
 
  grub_printf ("\nPress any key to continue...");
42
 
  (void) grub_getkey ();
43
 
  grub_putchar ('\n');
44
 
}
45
 
 
46
 
static void
47
 
draw_border (void)
48
 
{
49
 
  unsigned i;
50
 
 
51
 
  grub_setcolorstate (GRUB_TERM_COLOR_NORMAL);
52
 
 
53
 
  grub_gotoxy (GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y);
54
 
  grub_putcode (GRUB_TERM_DISP_UL);
55
 
  for (i = 0; i < (unsigned) GRUB_TERM_BORDER_WIDTH - 2; i++)
56
 
    grub_putcode (GRUB_TERM_DISP_HLINE);
57
 
  grub_putcode (GRUB_TERM_DISP_UR);
58
 
 
59
 
  for (i = 0; i < (unsigned) GRUB_TERM_NUM_ENTRIES; i++)
60
 
    {
61
 
      grub_gotoxy (GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y + i + 1);
62
 
      grub_putcode (GRUB_TERM_DISP_VLINE);
63
 
      grub_gotoxy (GRUB_TERM_MARGIN + GRUB_TERM_BORDER_WIDTH - 1,
64
 
                   GRUB_TERM_TOP_BORDER_Y + i + 1);
65
 
      grub_putcode (GRUB_TERM_DISP_VLINE);
66
 
    }
67
 
 
68
 
  grub_gotoxy (GRUB_TERM_MARGIN,
69
 
               GRUB_TERM_TOP_BORDER_Y + GRUB_TERM_NUM_ENTRIES + 1);
70
 
  grub_putcode (GRUB_TERM_DISP_LL);
71
 
  for (i = 0; i < (unsigned) GRUB_TERM_BORDER_WIDTH - 2; i++)
72
 
    grub_putcode (GRUB_TERM_DISP_HLINE);
73
 
  grub_putcode (GRUB_TERM_DISP_LR);
74
 
 
75
 
  grub_setcolorstate (GRUB_TERM_COLOR_NORMAL);
76
 
 
77
 
  grub_gotoxy (GRUB_TERM_MARGIN,
78
 
               (GRUB_TERM_TOP_BORDER_Y + GRUB_TERM_NUM_ENTRIES
79
 
                + GRUB_TERM_MARGIN + 1));
80
 
}
81
 
 
82
 
static void
83
 
print_message (int nested, int edit)
84
 
{
85
 
  grub_setcolorstate (GRUB_TERM_COLOR_NORMAL);
86
 
 
87
 
  if (edit)
88
 
    {
89
 
      grub_printf ("\n\
90
 
      Minimum Emacs-like screen editing is supported. TAB lists\n\
91
 
      completions. Press Ctrl-x to boot, Ctrl-c for a command-line\n\
92
 
      or ESC to return menu.");
93
 
    }
94
 
  else
95
 
    {
96
 
      grub_printf ("\n\
97
 
      Use the %C and %C keys to select which entry is highlighted.\n",
98
 
                   (grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN);
99
 
      grub_printf ("\
100
 
      Press enter to boot the selected OS, \'e\' to edit the\n\
101
 
      commands before booting or \'c\' for a command-line.");
102
 
      if (nested)
103
 
        grub_printf ("\n\
104
 
      ESC to return previous menu.");
105
 
    }
106
 
}
107
 
 
108
 
static void
109
 
print_entry (int y, int highlight, grub_menu_entry_t entry)
110
 
{
111
 
  int x;
112
 
  const char *title;
113
 
  grub_size_t title_len;
114
 
  grub_ssize_t len;
115
 
  grub_uint32_t *unicode_title;
116
 
  grub_ssize_t i;
117
 
  grub_uint8_t old_color_normal, old_color_highlight;
118
 
 
119
 
  title = entry ? entry->title : "";
120
 
  title_len = grub_strlen (title);
121
 
  unicode_title = grub_malloc (title_len * sizeof (*unicode_title));
122
 
  if (! unicode_title)
123
 
    /* XXX How to show this error?  */
124
 
    return;
125
 
 
126
 
  len = grub_utf8_to_ucs4 (unicode_title, title_len,
127
 
                           (grub_uint8_t *) title, -1, 0);
128
 
  if (len < 0)
129
 
    {
130
 
      /* It is an invalid sequence.  */
131
 
      grub_free (unicode_title);
132
 
      return;
133
 
    }
134
 
 
135
 
  grub_getcolor (&old_color_normal, &old_color_highlight);
136
 
  grub_setcolor (grub_color_menu_normal, grub_color_menu_highlight);
137
 
  grub_setcolorstate (highlight
138
 
                      ? GRUB_TERM_COLOR_HIGHLIGHT
139
 
                      : GRUB_TERM_COLOR_NORMAL);
140
 
 
141
 
  grub_gotoxy (GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN, y);
142
 
 
143
 
  for (x = GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_MARGIN + 1, i = 0;
144
 
       x < GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH - GRUB_TERM_MARGIN;
145
 
       i++)
146
 
    {
147
 
      if (i < len
148
 
          && x <= (GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH
149
 
                   - GRUB_TERM_MARGIN - 1))
150
 
        {
151
 
          grub_ssize_t width;
152
 
 
153
 
          width = grub_getcharwidth (unicode_title[i]);
154
 
 
155
 
          if (x + width > (GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH
156
 
                           - GRUB_TERM_MARGIN - 1))
157
 
            grub_putcode (GRUB_TERM_DISP_RIGHT);
158
 
          else
159
 
            grub_putcode (unicode_title[i]);
160
 
 
161
 
          x += width;
162
 
        }
163
 
      else
164
 
        {
165
 
          grub_putchar (' ');
166
 
          x++;
167
 
        }
168
 
    }
169
 
  grub_setcolorstate (GRUB_TERM_COLOR_NORMAL);
170
 
  grub_putchar (' ');
171
 
 
172
 
  grub_gotoxy (GRUB_TERM_CURSOR_X, y);
173
 
 
174
 
  grub_setcolor (old_color_normal, old_color_highlight);
175
 
  grub_setcolorstate (GRUB_TERM_COLOR_NORMAL);
176
 
  grub_free (unicode_title);
177
 
}
178
 
 
179
 
static void
180
 
print_entries (grub_menu_t menu, int first, int offset)
181
 
{
182
 
  grub_menu_entry_t e;
183
 
  int i;
184
 
 
185
 
  grub_gotoxy (GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH,
186
 
               GRUB_TERM_FIRST_ENTRY_Y);
187
 
 
188
 
  if (first)
189
 
    grub_putcode (GRUB_TERM_DISP_UP);
190
 
  else
191
 
    grub_putchar (' ');
192
 
 
193
 
  e = grub_menu_get_entry (menu, first);
194
 
 
195
 
  for (i = 0; i < GRUB_TERM_NUM_ENTRIES; i++)
196
 
    {
197
 
      print_entry (GRUB_TERM_FIRST_ENTRY_Y + i, offset == i, e);
198
 
      if (e)
199
 
        e = e->next;
200
 
    }
201
 
 
202
 
  grub_gotoxy (GRUB_TERM_LEFT_BORDER_X + GRUB_TERM_BORDER_WIDTH,
203
 
               GRUB_TERM_TOP_BORDER_Y + GRUB_TERM_NUM_ENTRIES);
204
 
 
205
 
  if (e)
206
 
    grub_putcode (GRUB_TERM_DISP_DOWN);
207
 
  else
208
 
    grub_putchar (' ');
209
 
 
210
 
  grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
211
 
}
212
 
 
213
 
/* Initialize the screen.  If NESTED is non-zero, assume that this menu
214
 
   is run from another menu or a command-line. If EDIT is non-zero, show
215
 
   a message for the menu entry editor.  */
216
 
void
217
 
grub_menu_init_page (int nested, int edit)
218
 
{
219
 
  grub_uint8_t old_color_normal, old_color_highlight;
220
 
 
221
 
  grub_getcolor (&old_color_normal, &old_color_highlight);
222
 
 
223
 
  /* By default, use the same colors for the menu.  */
224
 
  grub_color_menu_normal = old_color_normal;
225
 
  grub_color_menu_highlight = old_color_highlight;
226
 
 
227
 
  /* Then give user a chance to replace them.  */
228
 
  grub_parse_color_name_pair (&grub_color_menu_normal, grub_env_get ("menu_color_normal"));
229
 
  grub_parse_color_name_pair (&grub_color_menu_highlight, grub_env_get ("menu_color_highlight"));
230
 
 
231
 
  grub_normal_init_page ();
232
 
  grub_setcolor (grub_color_menu_normal, grub_color_menu_highlight);
233
 
  draw_border ();
234
 
  grub_setcolor (old_color_normal, old_color_highlight);
235
 
  print_message (nested, edit);
236
 
}
237
 
 
238
 
/* Get the entry number from the variable NAME.  */
239
 
static int
240
 
get_entry_number (const char *name)
241
 
{
242
 
  char *val;
243
 
  int entry;
244
 
 
245
 
  val = grub_env_get (name);
246
 
  if (! val)
247
 
    return -1;
248
 
 
249
 
  grub_error_push ();
250
 
 
251
 
  entry = (int) grub_strtoul (val, 0, 0);
252
 
 
253
 
  if (grub_errno != GRUB_ERR_NONE)
254
 
    {
255
 
      grub_errno = GRUB_ERR_NONE;
256
 
      entry = -1;
257
 
    }
258
 
 
259
 
  grub_error_pop ();
260
 
 
261
 
  return entry;
262
 
}
263
 
 
264
 
static void
265
 
print_timeout (int timeout, int offset, int second_stage)
266
 
{
267
 
  /* NOTE: Do not remove the trailing space characters.
268
 
     They are required to clear the line.  */
269
 
  char *msg = "   The highlighted entry will be booted automatically in %ds.    ";
270
 
  char *msg_end = grub_strchr (msg, '%');
271
 
 
272
 
  grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3);
273
 
  grub_printf (second_stage ? msg_end : msg, timeout);
274
 
  grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
275
 
  grub_refresh ();
276
 
};
277
 
 
278
 
/* Show the menu and handle menu entry selection.  Returns the menu entry
279
 
   index that should be executed or -1 if no entry should be executed (e.g.,
280
 
   Esc pressed to exit a sub-menu or switching menu viewers).
281
 
   If the return value is not -1, then *AUTO_BOOT is nonzero iff the menu
282
 
   entry to be executed is a result of an automatic default selection because
283
 
   of the timeout.  */
284
 
static int
285
 
run_menu (grub_menu_t menu, int nested, int *auto_boot)
286
 
{
287
 
  int first, offset;
288
 
  grub_uint64_t saved_time;
289
 
  int default_entry;
290
 
  int timeout;
291
 
 
292
 
  first = 0;
293
 
 
294
 
  default_entry = get_entry_number ("default");
295
 
 
296
 
  /* If DEFAULT_ENTRY is not within the menu entries, fall back to
297
 
     the first entry.  */
298
 
  if (default_entry < 0 || default_entry >= menu->size)
299
 
    default_entry = 0;
300
 
 
301
 
  /* If timeout is 0, drawing is pointless (and ugly).  */
302
 
  if (grub_menu_get_timeout () == 0)
303
 
    {
304
 
      *auto_boot = 1;
305
 
      return default_entry;
306
 
    }
307
 
 
308
 
  offset = default_entry;
309
 
  if (offset > GRUB_TERM_NUM_ENTRIES - 1)
310
 
    {
311
 
      first = offset - (GRUB_TERM_NUM_ENTRIES - 1);
312
 
      offset = GRUB_TERM_NUM_ENTRIES - 1;
313
 
    }
314
 
 
315
 
  /* Initialize the time.  */
316
 
  saved_time = grub_get_time_ms ();
317
 
 
318
 
 refresh:
319
 
  grub_setcursor (0);
320
 
  grub_menu_init_page (nested, 0);
321
 
  print_entries (menu, first, offset);
322
 
  grub_refresh ();
323
 
 
324
 
  timeout = grub_menu_get_timeout ();
325
 
 
326
 
  if (timeout > 0)
327
 
    print_timeout (timeout, offset, 0);
328
 
 
329
 
  while (1)
330
 
    {
331
 
      int c;
332
 
      timeout = grub_menu_get_timeout ();
333
 
 
334
 
      if (timeout > 0)
335
 
        {
336
 
          grub_uint64_t current_time;
337
 
 
338
 
          current_time = grub_get_time_ms ();
339
 
          if (current_time - saved_time >= 1000)
340
 
            {
341
 
              timeout--;
342
 
              grub_menu_set_timeout (timeout);
343
 
              saved_time = current_time;
344
 
              print_timeout (timeout, offset, 1);
345
 
            }
346
 
        }
347
 
 
348
 
      if (timeout == 0)
349
 
        {
350
 
          grub_env_unset ("timeout");
351
 
          *auto_boot = 1;
352
 
          return default_entry;
353
 
        }
354
 
 
355
 
      if (grub_checkkey () >= 0 || timeout < 0)
356
 
        {
357
 
          c = GRUB_TERM_ASCII_CHAR (grub_getkey ());
358
 
 
359
 
          if (timeout >= 0)
360
 
            {
361
 
              grub_gotoxy (0, GRUB_TERM_HEIGHT - 3);
362
 
              grub_printf ("\
363
 
                                                                        ");
364
 
              grub_env_unset ("timeout");
365
 
              grub_env_unset ("fallback");
366
 
              grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
367
 
            }
368
 
 
369
 
          switch (c)
370
 
            {
371
 
            case GRUB_TERM_HOME:
372
 
              first = 0;
373
 
              offset = 0;
374
 
              print_entries (menu, first, offset);
375
 
              break;
376
 
 
377
 
            case GRUB_TERM_END:
378
 
              offset = menu->size - 1;
379
 
              if (offset > GRUB_TERM_NUM_ENTRIES - 1)
380
 
                {
381
 
                  first = offset - (GRUB_TERM_NUM_ENTRIES - 1);
382
 
                  offset = GRUB_TERM_NUM_ENTRIES - 1;
383
 
                }
384
 
                print_entries (menu, first, offset);
385
 
              break;
386
 
 
387
 
            case GRUB_TERM_UP:
388
 
            case '^':
389
 
              if (offset > 0)
390
 
                {
391
 
                  print_entry (GRUB_TERM_FIRST_ENTRY_Y + offset, 0,
392
 
                               grub_menu_get_entry (menu, first + offset));
393
 
                  offset--;
394
 
                  print_entry (GRUB_TERM_FIRST_ENTRY_Y + offset, 1,
395
 
                               grub_menu_get_entry (menu, first + offset));
396
 
                }
397
 
              else if (first > 0)
398
 
                {
399
 
                  first--;
400
 
                  print_entries (menu, first, offset);
401
 
                }
402
 
              break;
403
 
 
404
 
            case GRUB_TERM_DOWN:
405
 
            case 'v':
406
 
              if (menu->size > first + offset + 1)
407
 
                {
408
 
                  if (offset < GRUB_TERM_NUM_ENTRIES - 1)
409
 
                    {
410
 
                      print_entry (GRUB_TERM_FIRST_ENTRY_Y + offset, 0,
411
 
                                   grub_menu_get_entry (menu, first + offset));
412
 
                      offset++;
413
 
                      print_entry (GRUB_TERM_FIRST_ENTRY_Y + offset, 1,
414
 
                                   grub_menu_get_entry (menu, first + offset));
415
 
                    }
416
 
                  else
417
 
                    {
418
 
                      first++;
419
 
                      print_entries (menu, first, offset);
420
 
                    }
421
 
                }
422
 
              break;
423
 
 
424
 
            case GRUB_TERM_PPAGE:
425
 
              if (first == 0)
426
 
                {
427
 
                  offset = 0;
428
 
                }
429
 
              else
430
 
                {
431
 
                  first -= GRUB_TERM_NUM_ENTRIES;
432
 
 
433
 
                  if (first < 0)
434
 
                    {
435
 
                      offset += first;
436
 
                      first = 0;
437
 
                    }
438
 
                }
439
 
              print_entries (menu, first, offset);
440
 
              break;
441
 
 
442
 
            case GRUB_TERM_NPAGE:
443
 
              if (offset == 0)
444
 
                {
445
 
                  offset += GRUB_TERM_NUM_ENTRIES - 1;
446
 
                  if (first + offset >= menu->size)
447
 
                    {
448
 
                      offset = menu->size - first - 1;
449
 
                    }
450
 
                }
451
 
              else
452
 
                {
453
 
                  first += GRUB_TERM_NUM_ENTRIES;
454
 
 
455
 
                  if (first + offset >= menu->size)
456
 
                    {
457
 
                      first -= GRUB_TERM_NUM_ENTRIES;
458
 
                      offset += GRUB_TERM_NUM_ENTRIES;
459
 
 
460
 
                      if (offset > menu->size - 1 ||
461
 
                          offset > GRUB_TERM_NUM_ENTRIES - 1)
462
 
                        {
463
 
                          offset = menu->size - first - 1;
464
 
                        }
465
 
                      if (offset > GRUB_TERM_NUM_ENTRIES)
466
 
                        {
467
 
                          first += offset - GRUB_TERM_NUM_ENTRIES + 1;
468
 
                          offset = GRUB_TERM_NUM_ENTRIES - 1;
469
 
                        }
470
 
                    }
471
 
                }
472
 
              print_entries (menu, first, offset);
473
 
              break;
474
 
 
475
 
            case '\n':
476
 
            case '\r':
477
 
            case 6:
478
 
              grub_setcursor (1);
479
 
              *auto_boot = 0;
480
 
              return first + offset;
481
 
 
482
 
            case '\e':
483
 
              if (nested)
484
 
                {
485
 
                  grub_setcursor (1);
486
 
                  return -1;
487
 
                }
488
 
              break;
489
 
 
490
 
            case 'c':
491
 
              grub_cmdline_run (1);
492
 
              goto refresh;
493
 
 
494
 
            case 'e':
495
 
                {
496
 
                  grub_menu_entry_t e = grub_menu_get_entry (menu, first + offset);
497
 
                  if (e)
498
 
                    grub_menu_entry_run (e);
499
 
                }
500
 
              goto refresh;
501
 
 
502
 
            default:
503
 
              break;
504
 
            }
505
 
 
506
 
          grub_refresh ();
507
 
        }
508
 
    }
509
 
 
510
 
  /* Never reach here.  */
511
 
  return -1;
512
 
}
513
 
 
514
 
/* Callback invoked immediately before a menu entry is executed.  */
515
 
static void
516
 
notify_booting (grub_menu_entry_t entry,
517
 
                void *userdata __attribute__((unused)))
518
 
{
519
 
  grub_printf ("  Booting \'%s\'\n\n", entry->title);
520
 
}
521
 
 
522
 
/* Callback invoked when a default menu entry executed because of a timeout
523
 
   has failed and an attempt will be made to execute the next fallback
524
 
   entry, ENTRY.  */
525
 
static void
526
 
notify_fallback (grub_menu_entry_t entry,
527
 
                 void *userdata __attribute__((unused)))
528
 
{
529
 
  grub_printf ("\n  Falling back to \'%s\'\n\n", entry->title);
530
 
  grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS);
531
 
}
532
 
 
533
 
/* Callback invoked when a menu entry has failed and there is no remaining
534
 
   fallback entry to attempt.  */
535
 
static void
536
 
notify_execution_failure (void *userdata __attribute__((unused)))
537
 
{
538
 
  if (grub_errno != GRUB_ERR_NONE)
539
 
    {
540
 
      grub_print_error ();
541
 
      grub_errno = GRUB_ERR_NONE;
542
 
    }
543
 
  grub_printf ("\n  Failed to boot default entries.\n");
544
 
  grub_wait_after_message ();
545
 
}
546
 
 
547
 
/* Callbacks used by the text menu to provide user feedback when menu entries
548
 
   are executed.  */
549
 
static struct grub_menu_execute_callback execution_callback =
550
 
{
551
 
  .notify_booting = notify_booting,
552
 
  .notify_fallback = notify_fallback,
553
 
  .notify_failure = notify_execution_failure
554
 
};
555
 
 
556
 
static grub_err_t
557
 
show_text_menu (grub_menu_t menu, int nested)
558
 
{
559
 
  while (1)
560
 
    {
561
 
      int boot_entry;
562
 
      grub_menu_entry_t e;
563
 
      int auto_boot;
564
 
 
565
 
      boot_entry = run_menu (menu, nested, &auto_boot);
566
 
      if (boot_entry < 0)
567
 
        break;
568
 
 
569
 
      e = grub_menu_get_entry (menu, boot_entry);
570
 
      if (! e)
571
 
        continue; /* Menu is empty.  */
572
 
 
573
 
      grub_cls ();
574
 
      grub_setcursor (1);
575
 
 
576
 
      if (auto_boot)
577
 
        {
578
 
          grub_menu_execute_with_fallback (menu, e, &execution_callback, 0);
579
 
        }
580
 
      else
581
 
        {
582
 
          grub_errno = GRUB_ERR_NONE;
583
 
          grub_menu_execute_entry (e);
584
 
          if (grub_errno != GRUB_ERR_NONE)
585
 
            {
586
 
              grub_print_error ();
587
 
              grub_errno = GRUB_ERR_NONE;
588
 
              grub_wait_after_message ();
589
 
            }
590
 
        }
591
 
    }
592
 
 
593
 
  return GRUB_ERR_NONE;
594
 
}
595
 
 
596
 
struct grub_menu_viewer grub_normal_text_menu_viewer =
597
 
{
598
 
  .name = "text",
599
 
  .show_menu = show_text_menu
600
 
};