1 |
/* |
/* |
2 |
* GRUB -- GRand Unified Bootloader |
* GRUB -- GRand Unified Bootloader |
3 |
* Copyright (C) 2000, 2001 Free Software Foundation, Inc. |
* Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. |
4 |
* |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
17 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 |
*/ |
*/ |
19 |
|
|
20 |
#include "shared.h" |
#include <shared.h> |
21 |
|
#include <term.h> |
22 |
|
|
23 |
grub_jmp_buf restart_env; |
grub_jmp_buf restart_env; |
24 |
|
|
76 |
|
|
77 |
#endif /* ! PRESET_MENU_STRING && ! SUPPORT_DISKLESS */ |
#endif /* ! PRESET_MENU_STRING && ! SUPPORT_DISKLESS */ |
78 |
|
|
|
|
|
79 |
static char * |
static char * |
80 |
get_entry (char *list, int num, int nested) |
get_entry (char *list, int num, int nested) |
81 |
{ |
{ |
93 |
return list; |
return list; |
94 |
} |
} |
95 |
|
|
96 |
|
/* Print an entry in a line of the menu box. */ |
97 |
static void |
static void |
98 |
print_entries (int y, int size, int first, char *menu_entries) |
print_entry (int y, int highlight, char *entry) |
99 |
{ |
{ |
100 |
int i; |
int x; |
101 |
int disp_up = DISP_UP; |
|
102 |
int disp_down = DISP_DOWN; |
highlight = (highlight && current_term->highlight); |
103 |
|
|
104 |
|
if (highlight) |
105 |
|
current_term->highlight (1); |
106 |
|
|
107 |
#ifdef SUPPORT_SERIAL |
gotoxy (2, y); |
108 |
if (terminal & TERMINAL_SERIAL) |
grub_putchar (' '); |
109 |
|
for (x = 3; x < 75; x++) |
110 |
{ |
{ |
111 |
disp_up = ACS_UARROW; |
if (*entry && x < 71) |
112 |
disp_down = ACS_DARROW; |
grub_putchar (*entry++); |
113 |
|
else |
114 |
|
grub_putchar (' '); |
115 |
} |
} |
116 |
#endif /* SUPPORT_SERIAL */ |
gotoxy (74, y); |
117 |
|
|
118 |
|
if (highlight) |
119 |
|
current_term->highlight (0); |
120 |
|
} |
121 |
|
|
122 |
|
/* Print entries in the menu box. */ |
123 |
|
static void |
124 |
|
print_entries (int y, int size, int first, int entryno, char *menu_entries) |
125 |
|
{ |
126 |
|
int i; |
127 |
|
|
128 |
gotoxy (77, y + 1); |
gotoxy (77, y + 1); |
129 |
|
|
130 |
if (first) |
if (first) |
131 |
grub_putchar (disp_up); |
grub_putchar (DISP_UP); |
132 |
else |
else |
133 |
grub_putchar (' '); |
grub_putchar (' '); |
134 |
|
|
135 |
menu_entries = get_entry (menu_entries, first, 0); |
menu_entries = get_entry (menu_entries, first, 0); |
136 |
|
|
137 |
for (i = 1; i <= size; i++) |
for (i = 0; i < size; i++) |
138 |
{ |
{ |
139 |
int j = 0; |
print_entry (y + i + 1, entryno == i, menu_entries); |
|
|
|
|
gotoxy (3, y + i); |
|
140 |
|
|
141 |
while (*menu_entries) |
while (*menu_entries) |
142 |
{ |
menu_entries++; |
|
if (j < 71) |
|
|
{ |
|
|
grub_putchar (*menu_entries); |
|
|
j++; |
|
|
} |
|
|
|
|
|
menu_entries++; |
|
|
} |
|
143 |
|
|
144 |
if (*(menu_entries - 1)) |
if (*(menu_entries - 1)) |
145 |
menu_entries++; |
menu_entries++; |
|
|
|
|
for (; j < 71; j++) |
|
|
grub_putchar (' '); |
|
146 |
} |
} |
147 |
|
|
148 |
gotoxy (77, y + size); |
gotoxy (77, y + size); |
149 |
|
|
150 |
if (*menu_entries) |
if (*menu_entries) |
151 |
grub_putchar (disp_down); |
grub_putchar (DISP_DOWN); |
152 |
else |
else |
153 |
grub_putchar (' '); |
grub_putchar (' '); |
|
} |
|
154 |
|
|
155 |
|
gotoxy (74, y + entryno + 1); |
156 |
|
} |
157 |
|
|
158 |
static void |
static void |
159 |
print_entries_raw (int size, int first, char *menu_entries) |
print_entries_raw (int size, int first, char *menu_entries) |
186 |
print_border (int y, int size) |
print_border (int y, int size) |
187 |
{ |
{ |
188 |
int i; |
int i; |
189 |
int disp_ul = DISP_UL; |
|
|
int disp_ur = DISP_UR; |
|
|
int disp_ll = DISP_LL; |
|
|
int disp_lr = DISP_LR; |
|
|
int disp_horiz = DISP_HORIZ; |
|
|
int disp_vert = DISP_VERT; |
|
|
|
|
|
#ifdef SUPPORT_SERIAL |
|
|
if (terminal & TERMINAL_SERIAL) |
|
|
{ |
|
|
disp_ul = ACS_ULCORNER; |
|
|
disp_ur = ACS_URCORNER; |
|
|
disp_ll = ACS_LLCORNER; |
|
|
disp_lr = ACS_LRCORNER; |
|
|
disp_horiz = ACS_HLINE; |
|
|
disp_vert = ACS_VLINE; |
|
|
} |
|
|
#endif /* SUPPORT_SERIAL */ |
|
|
|
|
|
#ifndef GRUB_UTIL |
|
|
/* Color the menu. The menu is 75 * 14 characters. */ |
|
|
# ifdef SUPPORT_SERIAL |
|
|
if ((terminal & TERMINAL_CONSOLE) |
|
|
# ifdef SUPPORT_HERCULES |
|
|
|| (terminal & TERMINAL_HERCULES) |
|
|
# endif |
|
|
) |
|
|
# endif |
|
|
{ |
|
|
for (i = 0; i < 14; i++) |
|
|
{ |
|
|
int j; |
|
|
for (j = 0; j < 75; j++) |
|
|
{ |
|
|
gotoxy (j + 1, i + y); |
|
|
set_attrib (normal_color); |
|
|
} |
|
|
} |
|
|
} |
|
|
#endif |
|
|
|
|
190 |
gotoxy (1, y); |
gotoxy (1, y); |
191 |
|
|
192 |
grub_putchar (disp_ul); |
grub_putchar (DISP_UL); |
193 |
for (i = 0; i < 73; i++) |
for (i = 0; i < 73; i++) |
194 |
grub_putchar (disp_horiz); |
grub_putchar (DISP_HORIZ); |
195 |
grub_putchar (disp_ur); |
grub_putchar (DISP_UR); |
196 |
|
|
197 |
i = 1; |
i = 1; |
|
|
|
198 |
while (1) |
while (1) |
199 |
{ |
{ |
200 |
gotoxy (1, y + i); |
gotoxy (1, y + i); |
201 |
|
|
202 |
if (i > size) |
if (i > size) |
203 |
break; |
break; |
204 |
|
|
205 |
grub_putchar (disp_vert); |
grub_putchar (DISP_VERT); |
206 |
gotoxy (75, y + i); |
gotoxy (75, y + i); |
207 |
grub_putchar (disp_vert); |
grub_putchar (DISP_VERT); |
208 |
|
|
209 |
i++; |
i++; |
210 |
} |
} |
211 |
|
|
212 |
grub_putchar (disp_ll); |
grub_putchar (DISP_LL); |
213 |
for (i = 0; i < 73; i++) |
for (i = 0; i < 73; i++) |
214 |
grub_putchar (disp_horiz); |
grub_putchar (DISP_HORIZ); |
215 |
grub_putchar (disp_lr); |
grub_putchar (DISP_LR); |
|
} |
|
|
|
|
|
static void |
|
|
set_line (int y, int entryno, int attr, char *menu_entries) |
|
|
{ |
|
|
int x; |
|
|
|
|
|
#ifdef SUPPORT_SERIAL |
|
|
if (terminal & TERMINAL_SERIAL) |
|
|
{ |
|
|
menu_entries = get_entry (menu_entries, entryno, 0); |
|
|
gotoxy (2, y); |
|
|
grub_putchar (' '); |
|
|
for (x = 3; x < 75; x++) |
|
|
{ |
|
|
if (*menu_entries && x < 71) |
|
|
grub_putchar (*menu_entries++); |
|
|
else |
|
|
grub_putchar (' '); |
|
|
} |
|
|
} |
|
|
else |
|
|
#endif /* SUPPORT_SERIAL */ |
|
|
{ |
|
|
for (x = 2; x < 75; x++) |
|
|
{ |
|
|
gotoxy (x, y); |
|
|
set_attrib (attr); |
|
|
} |
|
|
} |
|
|
|
|
|
gotoxy (74, y); |
|
|
} |
|
|
|
|
|
/* Set the attribute of the line Y to normal state. */ |
|
|
static void |
|
|
set_line_normal (int y, int entryno, char *menu_entries) |
|
|
{ |
|
|
#ifdef GRUB_UTIL |
|
|
set_line (y, entryno, A_NORMAL, menu_entries); |
|
|
#else |
|
|
set_line (y, entryno, normal_color, menu_entries); |
|
|
#endif |
|
|
} |
|
|
|
|
|
/* Set the attribute of the line Y to highlight state. */ |
|
|
static void |
|
|
set_line_highlight (int y, int entryno, char *menu_entries) |
|
|
{ |
|
|
#ifdef SUPPORT_SERIAL |
|
|
if (terminal & TERMINAL_SERIAL) |
|
|
grub_printf ("\e[7m"); |
|
|
#endif /* SUPPORT_SERIAL */ |
|
|
|
|
|
#ifdef GRUB_UTIL |
|
|
set_line (y, entryno, A_REVERSE, menu_entries); |
|
|
#else |
|
|
set_line (y, entryno, highlight_color, menu_entries); |
|
|
#endif |
|
|
|
|
|
#ifdef SUPPORT_SERIAL |
|
|
if (terminal & TERMINAL_SERIAL) |
|
|
grub_printf ("\e[0m"); |
|
|
#endif /* SUPPORT_SERIAL */ |
|
216 |
} |
} |
217 |
|
|
218 |
static void |
static void |
221 |
{ |
{ |
222 |
int c, time1, time2 = -1, first_entry = 0; |
int c, time1, time2 = -1, first_entry = 0; |
223 |
char *cur_entry = 0; |
char *cur_entry = 0; |
|
int disp_up = DISP_UP; |
|
|
int disp_down = DISP_DOWN; |
|
224 |
|
|
225 |
/* |
/* |
226 |
* Main loop for menu UI. |
* Main loop for menu UI. |
228 |
|
|
229 |
restart: |
restart: |
230 |
/* Dumb terminal always use all entries for display |
/* Dumb terminal always use all entries for display |
231 |
invariant for TERMINAL_DUMB: first_entry == 0 */ |
invariant for TERM_DUMB: first_entry == 0 */ |
232 |
if (! (terminal & TERMINAL_DUMB)) |
if (! (current_term->flags & TERM_DUMB)) |
233 |
{ |
{ |
234 |
while (entryno > 11) |
while (entryno > 11) |
235 |
{ |
{ |
284 |
/* Only display the menu if the user wants to see it. */ |
/* Only display the menu if the user wants to see it. */ |
285 |
if (show_menu) |
if (show_menu) |
286 |
{ |
{ |
|
/* Disable the auto fill mode. */ |
|
|
auto_fill = 0; |
|
|
|
|
287 |
init_page (); |
init_page (); |
288 |
#ifndef GRUB_UTIL |
nocursor (); |
|
# ifdef SUPPORT_SERIAL |
|
|
if (terminal & TERMINAL_CONSOLE) |
|
|
# endif /* SUPPORT_SERIAL */ |
|
|
nocursor (); |
|
|
#endif /* ! GRUB_UTIL */ |
|
289 |
|
|
290 |
if (! (terminal & TERMINAL_DUMB)) |
if (! (current_term->flags & TERM_DUMB)) |
291 |
print_border (3, 12); |
print_border (3, 12); |
|
|
|
|
#ifdef GRUB_UTIL |
|
|
/* In the grub shell, always use ACS_*. */ |
|
|
disp_up = ACS_UARROW; |
|
|
disp_down = ACS_DARROW; |
|
|
#else /* ! GRUB_UTIL */ |
|
|
# ifdef SUPPORT_SERIAL |
|
|
if ((terminal & TERMINAL_CONSOLE) |
|
|
# ifdef SUPPORT_HERCULES |
|
|
|| (terminal & TERMINAL_HERCULES) |
|
|
# endif /* SUPPORT_HERCULES */ |
|
|
) |
|
|
{ |
|
|
disp_up = DISP_UP; |
|
|
disp_down = DISP_DOWN; |
|
|
} |
|
292 |
else |
else |
293 |
{ |
print_entries_raw (num_entries, first_entry, menu_entries); |
|
disp_up = ACS_UARROW; |
|
|
disp_down = ACS_DARROW; |
|
|
} |
|
|
# endif /* SUPPORT_SERIAL */ |
|
|
#endif /* ! GRUB_UTIL */ |
|
|
|
|
|
if (terminal & TERMINAL_DUMB) |
|
|
print_entries_raw (num_entries, first_entry, menu_entries); |
|
294 |
|
|
295 |
grub_printf ("\n\ |
grub_printf ("\n\ |
296 |
Use the %c and %c keys to select which entry is highlighted.\n", |
Use the %c and %c keys to select which entry is highlighted.\n", |
297 |
disp_up, disp_down); |
DISP_UP, DISP_DOWN); |
298 |
|
|
299 |
if (! auth && password) |
if (! auth && password) |
300 |
{ |
{ |
316 |
selected line, or escape to go back to the main menu."); |
selected line, or escape to go back to the main menu."); |
317 |
} |
} |
318 |
|
|
319 |
if (terminal & TERMINAL_DUMB) |
if (current_term->flags & TERM_DUMB) |
320 |
grub_printf ("\n\nThe selected entry is %d ", entryno); |
grub_printf ("\n\nThe selected entry is %d ", entryno); |
321 |
else |
else |
322 |
{ |
print_entries (3, 12, first_entry, entryno, menu_entries); |
|
print_entries (3, 12, first_entry, menu_entries); |
|
|
|
|
|
/* highlight initial line */ |
|
|
set_line_highlight (4 + entryno, first_entry + entryno, |
|
|
menu_entries); |
|
|
} |
|
323 |
} |
} |
324 |
|
|
325 |
/* XX using RT clock now, need to initialize value */ |
/* XX using RT clock now, need to initialize value */ |
339 |
} |
} |
340 |
|
|
341 |
/* else not booting yet! */ |
/* else not booting yet! */ |
342 |
time2 = time1; |
time2 = time1; |
343 |
|
|
344 |
if (terminal & TERMINAL_DUMB) |
if (current_term->flags & TERM_DUMB) |
345 |
grub_printf ("\r Entry %d will be booted automatically in %d seconds. ", |
grub_printf ("\r Entry %d will be booted automatically in %d seconds. ", |
346 |
entryno, grub_timeout); |
entryno, grub_timeout); |
347 |
else |
else |
348 |
{ |
{ |
349 |
gotoxy (3, 22); |
gotoxy (3, 22); |
350 |
printf ("The highlighted entry will be booted automatically in %d seconds. ", grub_timeout); |
grub_printf ("The highlighted entry will be booted automatically in %d seconds. ", |
351 |
|
grub_timeout); |
352 |
gotoxy (74, 4 + entryno); |
gotoxy (74, 4 + entryno); |
353 |
} |
} |
354 |
|
|
360 |
pressed. |
pressed. |
361 |
This avoids polling (relevant in the grub-shell and later on |
This avoids polling (relevant in the grub-shell and later on |
362 |
in grub if interrupt driven I/O is done). */ |
in grub if interrupt driven I/O is done). */ |
363 |
if ((checkkey () != -1) || (grub_timeout == -1)) |
if (checkkey () >= 0 || grub_timeout < 0) |
364 |
{ |
{ |
365 |
/* Key was pressed, show which entry is selected before GETKEY, |
/* Key was pressed, show which entry is selected before GETKEY, |
366 |
since we're comming in here also on GRUB_TIMEOUT == -1 and |
since we're comming in here also on GRUB_TIMEOUT == -1 and |
367 |
hang in GETKEY */ |
hang in GETKEY */ |
368 |
if (terminal & TERMINAL_DUMB) |
if (current_term->flags & TERM_DUMB) |
369 |
grub_printf ("\r Highlighted entry is %d: ", entryno); |
grub_printf ("\r Highlighted entry is %d: ", entryno); |
370 |
|
|
371 |
c = translate_keycode (getkey ()); |
c = ASCII_CHAR (getkey ()); |
372 |
|
|
373 |
if (grub_timeout >= 0) |
if (grub_timeout >= 0) |
374 |
{ |
{ |
375 |
if (terminal & TERMINAL_DUMB) |
if (current_term->flags & TERM_DUMB) |
376 |
grub_putchar ('\r'); |
grub_putchar ('\r'); |
377 |
else |
else |
378 |
gotoxy (3, 22); |
gotoxy (3, 22); |
379 |
printf (" "); |
printf (" "); |
380 |
grub_timeout = -1; |
grub_timeout = -1; |
381 |
fallback_entry = -1; |
fallback_entry = -1; |
382 |
if (! (terminal & TERMINAL_DUMB)) |
if (! (current_term->flags & TERM_DUMB)) |
383 |
gotoxy (74, 4 + entryno); |
gotoxy (74, 4 + entryno); |
384 |
} |
} |
385 |
|
|
387 |
'^' or 'v' so accept these keys. */ |
'^' or 'v' so accept these keys. */ |
388 |
if (c == 16 || c == '^') |
if (c == 16 || c == '^') |
389 |
{ |
{ |
390 |
if (terminal & TERMINAL_DUMB) |
if (current_term->flags & TERM_DUMB) |
391 |
{ |
{ |
392 |
if (entryno > 0) |
if (entryno > 0) |
393 |
entryno--; |
entryno--; |
396 |
{ |
{ |
397 |
if (entryno > 0) |
if (entryno > 0) |
398 |
{ |
{ |
399 |
set_line_normal (4 + entryno, first_entry + entryno, |
print_entry (4 + entryno, 0, |
400 |
menu_entries); |
get_entry (menu_entries, |
401 |
|
first_entry + entryno, |
402 |
|
0)); |
403 |
entryno--; |
entryno--; |
404 |
set_line_highlight (4 + entryno, first_entry + entryno, |
print_entry (4 + entryno, 1, |
405 |
menu_entries); |
get_entry (menu_entries, |
406 |
|
first_entry + entryno, |
407 |
|
0)); |
408 |
} |
} |
409 |
else if (first_entry > 0) |
else if (first_entry > 0) |
410 |
{ |
{ |
411 |
first_entry--; |
first_entry--; |
412 |
print_entries (3, 12, first_entry, menu_entries); |
print_entries (3, 12, first_entry, entryno, |
413 |
set_line_highlight (4, first_entry + entryno, |
menu_entries); |
|
menu_entries); |
|
414 |
} |
} |
415 |
} |
} |
416 |
} |
} |
417 |
if ((c == 14 || c == 'v') && first_entry + entryno + 1 < num_entries) |
else if ((c == 14 || c == 'v') |
418 |
|
&& first_entry + entryno + 1 < num_entries) |
419 |
{ |
{ |
420 |
if (terminal & TERMINAL_DUMB) |
if (current_term->flags & TERM_DUMB) |
421 |
entryno++; |
entryno++; |
422 |
else |
else |
423 |
if (entryno < 11) |
{ |
424 |
{ |
if (entryno < 11) |
425 |
set_line_normal (4 + entryno, first_entry + entryno, |
{ |
426 |
menu_entries); |
print_entry (4 + entryno, 0, |
427 |
entryno++; |
get_entry (menu_entries, |
428 |
set_line_highlight (4 + entryno, first_entry + entryno, |
first_entry + entryno, |
429 |
menu_entries); |
0)); |
430 |
|
entryno++; |
431 |
|
print_entry (4 + entryno, 1, |
432 |
|
get_entry (menu_entries, |
433 |
|
first_entry + entryno, |
434 |
|
0)); |
435 |
} |
} |
436 |
else if (num_entries > 12 + first_entry) |
else if (num_entries > 12 + first_entry) |
437 |
{ |
{ |
438 |
first_entry++; |
first_entry++; |
439 |
print_entries (3, 12, first_entry, menu_entries); |
print_entries (3, 12, first_entry, entryno, menu_entries); |
|
set_line_highlight (15, first_entry + entryno, menu_entries); |
|
440 |
} |
} |
441 |
|
} |
442 |
} |
} |
443 |
|
|
444 |
if (config_entries) |
if (config_entries) |
450 |
{ |
{ |
451 |
if ((c == 'd') || (c == 'o') || (c == 'O')) |
if ((c == 'd') || (c == 'o') || (c == 'O')) |
452 |
{ |
{ |
453 |
if (! (terminal & TERMINAL_DUMB)) |
if (! (current_term->flags & TERM_DUMB)) |
454 |
set_line_normal (4 + entryno, first_entry + entryno, |
print_entry (4 + entryno, 0, |
455 |
menu_entries); |
get_entry (menu_entries, |
456 |
|
first_entry + entryno, |
457 |
|
0)); |
458 |
|
|
459 |
/* insert after is almost exactly like insert before */ |
/* insert after is almost exactly like insert before */ |
460 |
if (c == 'o') |
if (c == 'o') |
461 |
{ |
{ |
462 |
/* But `o' differs from `O', since it may causes |
/* But `o' differs from `O', since it may causes |
463 |
the menu screen to scroll up. */ |
the menu screen to scroll up. */ |
464 |
if (entryno < 11 || (terminal & TERMINAL_DUMB)) |
if (entryno < 11 || (current_term->flags & TERM_DUMB)) |
465 |
entryno++; |
entryno++; |
466 |
else |
else |
467 |
first_entry++; |
first_entry++; |
475 |
|
|
476 |
if (c == 'O') |
if (c == 'O') |
477 |
{ |
{ |
478 |
memmove (cur_entry + 2, cur_entry, |
grub_memmove (cur_entry + 2, cur_entry, |
479 |
((int) heap) - ((int) cur_entry)); |
((int) heap) - ((int) cur_entry)); |
480 |
|
|
481 |
cur_entry[0] = ' '; |
cur_entry[0] = ' '; |
482 |
cur_entry[1] = 0; |
cur_entry[1] = 0; |
491 |
first_entry + entryno + 1, |
first_entry + entryno + 1, |
492 |
0); |
0); |
493 |
|
|
494 |
memmove (cur_entry, ptr, ((int) heap) - ((int) ptr)); |
grub_memmove (cur_entry, ptr, |
495 |
|
((int) heap) - ((int) ptr)); |
496 |
heap -= (((int) ptr) - ((int) cur_entry)); |
heap -= (((int) ptr) - ((int) cur_entry)); |
497 |
|
|
498 |
num_entries--; |
num_entries--; |
503 |
first_entry--; |
first_entry--; |
504 |
} |
} |
505 |
|
|
506 |
if (terminal & TERMINAL_DUMB) |
if (current_term->flags & TERM_DUMB) |
507 |
{ |
{ |
508 |
grub_printf ("\n\n"); |
grub_printf ("\n\n"); |
509 |
print_entries_raw (num_entries, first_entry, |
print_entries_raw (num_entries, first_entry, |
511 |
grub_printf ("\n"); |
grub_printf ("\n"); |
512 |
} |
} |
513 |
else |
else |
514 |
{ |
print_entries (3, 12, first_entry, entryno, menu_entries); |
|
print_entries (3, 12, first_entry, menu_entries); |
|
|
set_line_highlight (4 + entryno, first_entry + entryno, |
|
|
menu_entries); |
|
|
} |
|
515 |
} |
} |
516 |
|
|
517 |
cur_entry = menu_entries; |
cur_entry = menu_entries; |
529 |
char entered[32]; |
char entered[32]; |
530 |
char *pptr = password; |
char *pptr = password; |
531 |
|
|
532 |
if (terminal & TERMINAL_DUMB) |
if (current_term->flags & TERM_DUMB) |
533 |
grub_printf ("\r "); |
grub_printf ("\r "); |
534 |
else |
else |
535 |
gotoxy (1, 21); |
gotoxy (1, 21); |
536 |
|
|
537 |
/* Wipe out the previously entered password */ |
/* Wipe out the previously entered password */ |
538 |
memset (entered, 0, sizeof (entered)); |
grub_memset (entered, 0, sizeof (entered)); |
539 |
get_cmdline (" Password: ", entered, 31, '*', 0); |
get_cmdline (" Password: ", entered, 31, '*', 0); |
540 |
|
|
541 |
while (! isspace (*pptr) && *pptr) |
while (! isspace (*pptr) && *pptr) |
572 |
} |
} |
573 |
else |
else |
574 |
{ |
{ |
575 |
printf ("Failed!\n Press any key to continue..."); |
grub_printf ("Failed!\n Press any key to continue..."); |
576 |
getkey (); |
getkey (); |
577 |
goto restart; |
goto restart; |
578 |
} |
} |
642 |
} |
} |
643 |
|
|
644 |
/* align rest of commands properly */ |
/* align rest of commands properly */ |
645 |
memmove (cur_entry + j, cur_entry + i, |
grub_memmove (cur_entry + j, cur_entry + i, |
646 |
((int) heap) - (((int) cur_entry) + i)); |
(int) heap - ((int) cur_entry + i)); |
647 |
|
|
648 |
/* copy command to correct area */ |
/* copy command to correct area */ |
649 |
memmove (cur_entry, new_heap, j); |
grub_memmove (cur_entry, new_heap, j); |
650 |
|
|
651 |
heap += (j - i); |
heap += (j - i); |
652 |
} |
} |
669 |
} |
} |
670 |
} |
} |
671 |
} |
} |
672 |
|
|
673 |
/* Attempt to boot an entry. */ |
/* Attempt to boot an entry. */ |
674 |
|
|
675 |
boot_entry: |
boot_entry: |
|
/* Enable the auto fill mode. */ |
|
|
auto_fill = 1; |
|
676 |
|
|
677 |
cls (); |
cls (); |
678 |
|
|
679 |
while (1) |
while (1) |
680 |
{ |
{ |
681 |
if (config_entries) |
if (config_entries) |
782 |
auto void reset (void); |
auto void reset (void); |
783 |
void reset (void) |
void reset (void) |
784 |
{ |
{ |
785 |
auto_fill = 1; |
count_lines = -1; |
786 |
config_len = 0; |
config_len = 0; |
787 |
menu_len = 0; |
menu_len = 0; |
788 |
num_entries = 0; |
num_entries = 0; |