stage2.c revision 1fac5a6088d9f8a16d0a302d57227a80031f002d
4e5b757fbcf21077677360be274461dcd9064106kupfer * GRUB -- GRand Unified Bootloader
4e5b757fbcf21077677360be274461dcd9064106kupfer * Copyright (C) 2000,2001,2002,2004 Free Software Foundation, Inc.
4e5b757fbcf21077677360be274461dcd9064106kupfer * This program is free software; you can redistribute it and/or modify
4e5b757fbcf21077677360be274461dcd9064106kupfer * it under the terms of the GNU General Public License as published by
4e5b757fbcf21077677360be274461dcd9064106kupfer * the Free Software Foundation; either version 2 of the License, or
4e5b757fbcf21077677360be274461dcd9064106kupfer * (at your option) any later version.
4e5b757fbcf21077677360be274461dcd9064106kupfer * This program is distributed in the hope that it will be useful,
4e5b757fbcf21077677360be274461dcd9064106kupfer * but WITHOUT ANY WARRANTY; without even the implied warranty of
4e5b757fbcf21077677360be274461dcd9064106kupfer * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4e5b757fbcf21077677360be274461dcd9064106kupfer * GNU General Public License for more details.
4e5b757fbcf21077677360be274461dcd9064106kupfer * You should have received a copy of the GNU General Public License
4e5b757fbcf21077677360be274461dcd9064106kupfer * along with this program; if not, write to the Free Software
4e5b757fbcf21077677360be274461dcd9064106kupfer * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4e5b757fbcf21077677360be274461dcd9064106kupfer#if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS)
static int preset_menu_offset;
open_preset_menu (void)
#ifdef GRUB_UTIL
if (! use_preset_menu)
preset_menu_offset = 0;
return preset_menu != 0;
return len;
close_preset_menu (void)
preset_menu = 0;
#define open_preset_menu() 0
#define close_preset_menu()
for (i = 0; i < num; i++)
while (*(list++));
return list;
if (first)
for (i = 0; i < size; i++)
while (*menu_entries)
menu_entries++;
menu_entries++;
if (*menu_entries)
for (i = 0; i < LINE_LENGTH; i++)
for (i = 0; i < LINE_LENGTH; i++)
if (i > size)
char *cur_entry = 0;
first_entry++;
entryno--;
if (grub_timeout < 0)
if (! show_menu)
if (grub_timeout >=0
if (grub_timeout <= 0)
goto boot_entry;
grub_timeout--;
if (show_menu)
init_page ();
setcursor (0);
if (config_entries)
if (grub_timeout <= 0)
grub_timeout--;
if (grub_timeout >= 0)
if (entryno > 0)
entryno--;
if (entryno > 0)
entryno--;
else if (first_entry > 0)
first_entry--;
entryno++;
entryno++;
first_entry++;
if (first_entry < 0)
first_entry = 0;
if (entryno < 0)
entryno = 0;
if (first_entry < 0)
first_entry = 0;
if (config_entries)
entryno++;
first_entry++;
num_entries++;
else if (num_entries > 0)
num_entries--;
entryno--;
first_entry--;
pptr++;
*pptr++ = 0;
pptr++;
if (*pptr != 0)
auth = 0;
goto restart;
getkey ();
goto restart;
int new_num_entries = 0, i = 0;
char *new_heap;
if (config_entries)
*(new_heap++) = 0;
if (config_entries)
cls ();
while (new_heap[j++])
heap += (j - i);
goto restart;
goto restart;
#ifdef GRUB_UTIL
stop ();
cls ();
if (config_entries)
if (! cur_entry)
if (fallback_entryno >= 0)
first_entry = 0;
goto restart;
if (read_from_file)
if (literal)
if (pos > 0)
pos--;
literal = 0;
if (comment)
comment = 0;
else if (! pos)
return pos;
cmain (void)
auto void reset (void);
void reset (void)
config_len = 0;
menu_len = 0;
num_entries = 0;
init_config ();
*kill_buf = 0;
reset ();
#ifdef GRUB_UTIL
if (use_config_file)
saved_entryno = 0;
default_file[i] = 0;
char *p = buf;
int len;
if (len > 0)
grub_close ();
char *cmdline;
if (! is_opened)
if (! is_opened)
reset ();
! is_preset))
errnum = 0;
if (! builtin)
char *ptr;
num_entries++;
else if (! state)
errnum = 0;
state++;
num_entries++;
menu_len);
if (fallback_entryno >= 0)
for (i = 0; i < MAX_FALLBACK_ENTRIES; i++)
if (fallback_entries[i] < 0)
if (fallback_entries[0] < 0)
if (fallback_entryno >= 0)
default_entry = 0;
if (is_preset)
grub_close ();
while (is_preset);
if (! num_entries)