[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash pre-alpha
From: |
Serbinenko Vladimir |
Subject: |
Re: Bash pre-alpha |
Date: |
Sat, 29 Jan 2005 15:08:25 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20041206) |
I'm sorry but I had some diff issues I confused run_menu and
run_menu_entry. Here is a patch to correct this error and update i386.mk
----------------------------------------------------------
diff -b -B -r -u -E -N -x '*~' -x '*.d' -x output.0 -x kernel_syms.lst
-x symlist.c -x requests -x traces.0 --expand-tabs
./grub2pr/conf/i386-pc.mk ./grub2/conf/i386-pc.mk
--- ./grub2pr/conf/i386-pc.mk 2005-01-29 14:55:54.000000000 +0100
+++ ./grub2/conf/i386-pc.mk 2005-01-29 14:56:31.000000000 +0100
@@ -504,12 +504,12 @@
partmap/pc.c partmap/apple.c \
commands/terminal.c commands/boot.c commands/cmp.c
commands/cat.c \
util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c fs/ufs.c fs/minix.c
fs/hfs.c fs/jfs.c fs/iso9660.c \
- normal/cmdline.c normal/command.c normal/main.c normal/menu.c
normal/arg.c \
+ normal/cmdline.c normal/command.c normal/script.c normal/main.c
normal/menu.c normal/arg.c \
util/console.c util/grub-emu.c util/misc.c
util/i386/pc/getroot.c disk/loopback.c
-CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o
grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o
grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o
grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o
grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o
grub_emu-partmap_apple.o grub_emu-commands_terminal.o
grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o
grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o
grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o
grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o
grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o
grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o
grub_emu-disk_loopback.o
-MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d
grub_emu-fs_fshelp.d grub_emu-kern_disk.d grub_emu-kern_dl.d
grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d
grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d
grub_emu-kern_term.d grub_emu-kern_partition.d grub_emu-kern_env.d
grub_emu-commands_ls.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d
grub_emu-partmap_apple.d grub_emu-commands_terminal.d
grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d
grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d
grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d
grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d
grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d
grub_emu-normal_arg.d grub_emu-util_console.d grub_emu-util_grub_emu.d
grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d
grub_emu-disk_loopback.d
+CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o
grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o
grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o
grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o
grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o
grub_emu-partmap_apple.o grub_emu-commands_terminal.o
grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o
grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o
grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o
grub_emu-normal_command.o grub_emu-normal_script.o
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o
grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o
grub_emu-util_i386_pc_getroot.o grub_emu-disk_loopback.o
+MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d
grub_emu-fs_fshelp.d grub_emu-kern_disk.d grub_emu-kern_dl.d
grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d
grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d
grub_emu-kern_term.d grub_emu-kern_partition.d grub_emu-kern_env.d
grub_emu-commands_ls.d grub_emu-partmap_amiga.d grub_emu-partmap_pc.d
grub_emu-partmap_apple.d grub_emu-commands_terminal.d
grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d
grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d
grub_emu-fs_ufs.d grub_emu-fs_minix.d grub_emu-fs_hfs.d
grub_emu-fs_jfs.d grub_emu-fs_iso9660.d grub_emu-normal_cmdline.d
grub_emu-normal_command.d grub_emu-normal_script.d
grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d
grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d
grub_emu-util_i386_pc_getroot.d grub_emu-disk_loopback.d
-grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o
grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o
grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o
grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o
grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o
grub_emu-partmap_apple.o grub_emu-commands_terminal.o
grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o
grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o
grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o
grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o
grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o
grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o
grub_emu-disk_loopback.o
+grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o
grub_emu-fs_fshelp.o grub_emu-kern_disk.o grub_emu-kern_dl.o
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o
grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o
grub_emu-kern_term.o grub_emu-kern_partition.o grub_emu-kern_env.o
grub_emu-commands_ls.o grub_emu-partmap_amiga.o grub_emu-partmap_pc.o
grub_emu-partmap_apple.o grub_emu-commands_terminal.o
grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o
grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o
grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_hfs.o
grub_emu-fs_jfs.o grub_emu-fs_iso9660.o grub_emu-normal_cmdline.o
grub_emu-normal_command.o grub_emu-normal_script.o
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o
grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o
grub_emu-util_i386_pc_getroot.o grub_emu-disk_loopback.o
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
grub_emu-kern_main.o: kern/main.c
@@ -768,6 +768,14 @@
-include grub_emu-normal_command.d
+grub_emu-normal_script.o: normal/script.c
+ $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS)
$(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-normal_script.d: normal/script.c
+ set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal
$(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M
$< | sed 's,script\.o[ :]*,grub_emu-normal_script.o $@ : ,g' >
$@; [ -s $@ ] || rm -f $@
+
+-include grub_emu-normal_script.d
+
grub_emu-normal_main.o: normal/main.c
$(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS)
$(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
@@ -1291,10 +1299,10 @@
linux_mod_CFLAGS = $(COMMON_CFLAGS)
# For normal.mod.
-normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/main.c \
+normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/script.c
normal/main.c \
normal/menu.c normal/arg.c normal/i386/setjmp.S
-CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o
normal_mod-normal_cmdline.o normal_mod-normal_command.o
normal_mod-normal_main.o normal_mod-normal_menu.o
normal_mod-normal_arg.o normal_mod-normal_i386_setjmp.o def-normal.lst
und-normal.lst
-MOSTLYCLEANFILES += normal_mod-normal_cmdline.d
normal_mod-normal_command.d normal_mod-normal_main.d
normal_mod-normal_menu.d normal_mod-normal_arg.d
normal_mod-normal_i386_setjmp.d
+CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o
normal_mod-normal_cmdline.o normal_mod-normal_command.o
normal_mod-normal_script.o normal_mod-normal_main.o
normal_mod-normal_menu.o normal_mod-normal_arg.o
normal_mod-normal_i386_setjmp.o def-normal.lst und-normal.lst
+MOSTLYCLEANFILES += normal_mod-normal_cmdline.d
normal_mod-normal_command.d normal_mod-normal_script.d
normal_mod-normal_main.d normal_mod-normal_menu.d
normal_mod-normal_arg.d normal_mod-normal_i386_setjmp.d
DEFSYMFILES += def-normal.lst
UNDSYMFILES += und-normal.lst
@@ -1303,7 +1311,7 @@
$(LD) -r -d -o $@ $^
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R
.note -R .comment $@
-pre-normal.o: normal_mod-normal_cmdline.o normal_mod-normal_command.o
normal_mod-normal_main.o normal_mod-normal_menu.o
normal_mod-normal_arg.o normal_mod-normal_i386_setjmp.o
+pre-normal.o: normal_mod-normal_cmdline.o normal_mod-normal_command.o
normal_mod-normal_script.o normal_mod-normal_main.o
normal_mod-normal_menu.o normal_mod-normal_arg.o
normal_mod-normal_i386_setjmp.o
-rm -f $@
$(LD) -r -d -o $@ $^
@@ -1336,6 +1344,14 @@
-include normal_mod-normal_command.d
+normal_mod-normal_script.o: normal/script.c
+ $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS)
$(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_script.d: normal/script.c
+ set -e; $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS)
$(CFLAGS) $(normal_mod_CFLAGS) -M $< | sed 's,script\.o[
:]*,normal_mod-normal_script.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_script.d
+
normal_mod-normal_main.o: normal/main.c
$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS)
$(normal_mod_CFLAGS) -c -o $@ $<
diff -b -B -r -u -E -N -x '*~' -x '*.d' -x output.0 -x kernel_syms.lst
-x symlist.c -x requests -x traces.0 --expand-tabs
./grub2pr/normal/menu.c ./grub2/normal/menu.c
--- ./grub2pr/normal/menu.c 2005-01-29 14:55:55.000000000 +0100
+++ ./grub2/normal/menu.c 2005-01-29 15:00:11.000000000 +0100
@@ -239,42 +239,148 @@
static int
run_menu (grub_menu_t menu, int nested)
{
- return script_list_execute(entry);
-}
+ int first, offset;
+ unsigned long saved_time;
-/* Run a menu entry. */
-static void
-run_menu_entry (grub_menu_entry_t entry)
-{
- grub_command_list_t cl;
+ first = 0;
+ offset = menu->default_entry;
+ if (offset > TERM_NUM_ENTRIES - 1)
+ {
+ first = offset - (TERM_NUM_ENTRIES - 1);
+ offset = TERM_NUM_ENTRIES - 1;
+ }
+
+ /* Initialize the time. */
+ saved_time = grub_get_rtc ();
+
+ refresh:
+ grub_setcursor (0);
+ init_page (nested, 0);
+ print_entries (menu, first, offset);
+ grub_refresh ();
+
+ while (1)
+ {
+ int c;
+
+ if (menu->timeout > 0)
+ {
+ unsigned long current_time;
- for (cl = entry->command_list; cl != 0; cl = cl->next)
+ current_time = grub_get_rtc ();
+ if (current_time - saved_time >= GRUB_TICKS_PER_SECOND)
{
- grub_command_t c;
+ menu->timeout--;
+ saved_time = current_time;
+ }
+
+ grub_gotoxy (0, TERM_HEIGHT - 3);
+ /* NOTE: Do not remove the trailing space characters.
+ They are required to clear the line. */
+ grub_printf ("\
+ The highlighted entry will be booted automatically in %d seconds. ",
+ menu->timeout);
+ grub_gotoxy (TERM_CURSOR_X, TERM_FIRST_ENTRY_Y + offset);
+ grub_refresh ();
+ }
- if (cl->command[0] == '\0')
- /* Ignore an empty command line. */
- continue;
+ if (menu->timeout == 0)
+ return menu->default_entry;
- c = grub_command_find (cl->command);
- if (! c)
+ if (grub_checkkey () >= 0 || menu->timeout < 0)
+ {
+ c = GRUB_TERM_ASCII_CHAR (grub_getkey ());
+
+ if (menu->timeout >= 0)
+ {
+ grub_gotoxy (0, TERM_HEIGHT - 3);
+ grub_printf ("\
+ ");
+ menu->timeout = -1;
+ menu->fallback_entry = -1;
+ grub_gotoxy (TERM_CURSOR_X, TERM_FIRST_ENTRY_Y + offset);
+ }
+
+ switch (c)
+ {
+ case 16:
+ case '^':
+ if (offset > 0)
+ {
+ print_entry (TERM_FIRST_ENTRY_Y + offset, 0,
+ get_entry (menu, first + offset));
+ offset--;
+ print_entry (TERM_FIRST_ENTRY_Y + offset, 1,
+ get_entry (menu, first + offset));
+ }
+ else if (first > 0)
+ {
+ first--;
+ print_entries (menu, first, offset);
+ }
break;
- if (! (c->flags & GRUB_COMMAND_FLAG_CMDLINE))
+ case 14:
+ case 'v':
+ if (menu->size > first + offset + 1)
{
- grub_error (GRUB_ERR_INVALID_COMMAND,
- "invalid command `%s'",
- cl->command);
+ if (offset < TERM_NUM_ENTRIES - 1)
+ {
+ print_entry (TERM_FIRST_ENTRY_Y + offset, 0,
+ get_entry (menu, first + offset));
+ offset++;
+ print_entry (TERM_FIRST_ENTRY_Y + offset, 1,
+ get_entry (menu, first + offset));
+ }
+ else
+ {
+ first++;
+ print_entries (menu, first, offset);
+ }
+ }
break;
+
+ case '\n':
+ case '\r':
+ case 6:
+ grub_setcursor (1);
+ return first + offset;
+
+ case '\e':
+ if (nested)
+ {
+ grub_setcursor (1);
+ return -1;
}
+ break;
- if (! (c->flags & GRUB_COMMAND_FLAG_NO_ECHO))
- grub_printf ("%s\n", cl->command);
+ case 'c':
+ grub_setcursor (1);
+ grub_cmdline_run (1);
+ goto refresh;
+
+ case 'e':
+ edit_menu_entry (get_entry (menu, first + offset));
+ goto refresh;
- if (grub_command_execute (cl->command) != 0)
+ default:
break;
}
+ grub_refresh ();
+ }
+ }
+
+ /* Never reach here. */
+ return -1;
+}
+
+/* Run a menu entry. */
+static void
+run_menu_entry (grub_menu_entry_t entry)
+{
+
+ script_list_execute(entry);
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
/* Implicit execution of boot, only if something is loaded. */
grub_command_execute ("boot");
- Feature suggestion to grub, Aki Tossavainen, 2005/01/12
- Re: Feature suggestion to grub, Marco Gerards, 2005/01/22
- Re: Feature suggestion to grub, Yoshinori K. Okuji, 2005/01/22
- Re: Feature suggestion to grub, Aki Tossavainen, 2005/01/22
- Re: Feature suggestion to grub, Yoshinori K. Okuji, 2005/01/22
- Bash pre-alpha, Serbinenko Vladimir, 2005/01/29
- Re: Bash pre-alpha,
Serbinenko Vladimir <=
- Re: Bash pre-alpha, Marco Gerards, 2005/01/29
- Re: Bash pre-alpha, Serbinenko Vladimir, 2005/01/29
- Re: Bash pre-alpha, Serbinenko Vladimir, 2005/01/31