grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hexcat + grub_ncurses_getwh


From: Vladimir Serbinenko
Subject: hexcat + grub_ncurses_getwh
Date: Mon, 08 Aug 2005 19:23:18 +0200
User-agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324)

I wrote a new patch: grub_ncurses_getwh + hexcat. hexcat shows the
contents of file like hex editors.

                                                                        
                     Vladimir

2005-08-08 Vladimir Serbinenko <address@hidden>
    * commands/hexcat.c: new file
    * conf/i386-pc.rmk (hexcat): new module
    (grub_emu): hexcat added
    * conf/powerpc-ieee1275.rmk: Likewise
    * normal/cmdline.c: include grub/machine/console.h
    (grub_cmdline_get): support for special keys in grub-emu
    * normal/menu.c: include grub/machine/console.h
    (run_menu): support for special keys in grub-emu   
    * util/console.c (grub_ncurses_getwh): New function
    * util/grub-emu.c: call to grub_hexcat_init() and grub_hexcat_fini()
diff -urpN ./grub2_2/commands/hexcat.c ./grub2_3/commands/hexcat.c
--- ./grub2_2/commands/hexcat.c 1970-01-01 01:00:00.000000000 +0100
+++ ./grub2_3/commands/hexcat.c 2005-08-08 15:48:43.000000000 +0200
@@ -0,0 +1,111 @@
+/* hexcat.c - command to show the contents of a file in hexadecimal  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003,2005  Free Software Foundation, Inc.
+ *  Vladimir Serbinenko <address@hidden>
+ *
+ *  GRUB is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/normal.h>
+#include <grub/dl.h>
+#include <grub/arg.h>
+#include <grub/file.h>
+#include <grub/disk.h>
+#include <grub/term.h>
+#include <grub/misc.h>
+
+static grub_err_t
+grub_cmd_cat (struct grub_arg_list *state __attribute__ ((unused)),
+             int argc, char **args)
+
+{
+  grub_file_t file;
+  char buf[16];
+  unsigned int offset = 0;
+  grub_ssize_t size;
+
+  if (argc != 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+
+  file = grub_file_open (args[0]);
+  if (! file)
+    return 0;
+  
+  while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
+    {
+      int i;
+
+      grub_printf ("%08x: ", offset);
+
+      for (i = 0; i < size; i++)
+       {
+         unsigned int c = buf[i];
+         
+         grub_printf ("%02x ", c & 0xFF);
+       }
+
+      for (; i < 16; i++)
+       grub_printf ("   ");
+      
+      for (i = 0; i < size; i++)
+       {
+         unsigned char c = buf[i];
+         
+         if (grub_isprint (c) || c == ' ')
+           grub_putchar (c);
+         else
+           grub_putchar ('.');
+       }
+      
+      grub_putchar ('\n');
+
+      offset += 16;
+    }
+
+  grub_putchar ('\n');
+  grub_refresh ();
+  grub_file_close (file);
+  
+  return 0;
+}
+
+
+#ifdef GRUB_UTIL
+void
+grub_hexcat_init (void)
+{
+  grub_register_command ("hexcat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
+                        "hexcat FILE", "Show the contents of a file in 
hexadecimal.", 0);
+}
+
+void
+grub_hexcat_fini (void)
+{
+  grub_unregister_command ("hexcat");
+}
+#else /* ! GRUB_UTIL */
+GRUB_MOD_INIT
+{
+  (void) mod;                  /* To stop warning. */
+  grub_register_command ("hexcat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
+                        "hexcat FILE", "Show the contents of a file ins 
hexadecimal.", 0);
+}
+
+GRUB_MOD_FINI
+{
+  grub_unregister_command ("hexcat");
+}
+#endif /* ! GRUB_UTIL */
diff -urpN ./grub2_2/conf/i386-pc.mk ./grub2_3/conf/i386-pc.mk
--- ./grub2_2/conf/i386-pc.mk   2005-08-08 12:05:33.000000000 +0200
+++ ./grub2_3/conf/i386-pc.mk   2005-08-08 15:10:19.000000000 +0200
@@ -671,11 +671,11 @@ grub_probefs-fs_fshelp.d: fs/fshelp.c
 
 
 # For grub-emu.
-grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c       \
-       commands/configfile.c commands/default.c commands/help.c        \
-       commands/terminal.c commands/ls.c commands/timeout.c            \
-       commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
-       disk/loopback.c                                                 \
+grub_emu_SOURCES = commands/boot.c commands/cat.c commands/hexcat.c    \
+       commands/cmp.c commands/configfile.c commands/default.c         \
+       commands/help.c commands/terminal.c commands/ls.c               \
+       commands/timeout.c commands/i386/pc/halt.c                      \
+       commands/i386/pc/reboot.c disk/loopback.c                       \
        fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
        fs/minix.c fs/ufs.c                                             \
        kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c       \
@@ -687,10 +687,10 @@ grub_emu_SOURCES = commands/boot.c comma
        util/console.c util/grub-emu.c util/misc.c                      \
        util/i386/pc/biosdisk.c util/i386/pc/getroot.c                  \
        util/i386/pc/misc.c
-CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o 
grub_emu-commands_cmp.o grub_emu-commands_configfile.o 
grub_emu-commands_default.o grub_emu-commands_help.o 
grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o 
grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o 
grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o 
grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o 
grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o 
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o 
grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o 
grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o 
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o 
grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o 
grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o 
grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o 
grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
-MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d 
grub_emu-commands_cmp.d grub_emu-commands_configfile.d 
grub_emu-commands_default.d grub_emu-commands_help.d 
grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d 
grub_emu-commands_i386_pc_halt.d grub_emu-commands_i386_pc_reboot.d 
grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d 
grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d 
grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d 
grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d 
grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d 
grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d 
grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d 
grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_context.d 
grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d 
grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d 
grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d 
grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d 
grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d
+CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o 
grub_emu-commands_hexcat.o grub_emu-commands_cmp.o 
grub_emu-commands_configfile.o grub_emu-commands_default.o 
grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o 
grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o 
grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o 
grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o 
grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o 
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o 
grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o 
grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o 
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o 
grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o 
grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o 
grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o 
grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
+MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d 
grub_emu-commands_hexcat.d grub_emu-commands_cmp.d 
grub_emu-commands_configfile.d grub_emu-commands_default.d 
grub_emu-commands_help.d grub_emu-commands_terminal.d grub_emu-commands_ls.d 
grub_emu-commands_timeout.d grub_emu-commands_i386_pc_halt.d 
grub_emu-commands_i386_pc_reboot.d grub_emu-disk_loopback.d grub_emu-fs_ext2.d 
grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d 
grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d 
grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d 
grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d 
grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d 
grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d 
grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_context.d 
grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d 
grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d 
grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d 
grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d 
grub_emu-util_i386_pc_getroot.d grub_emu-util_i386_pc_misc.d
 
-grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o 
grub_emu-commands_cmp.o grub_emu-commands_configfile.o 
grub_emu-commands_default.o grub_emu-commands_help.o 
grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o 
grub_emu-commands_i386_pc_halt.o grub_emu-commands_i386_pc_reboot.o 
grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o 
grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o 
grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o 
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o 
grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o 
grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o 
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o 
grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o 
grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o 
grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o 
grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
+grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o 
grub_emu-commands_hexcat.o grub_emu-commands_cmp.o 
grub_emu-commands_configfile.o grub_emu-commands_default.o 
grub_emu-commands_help.o grub_emu-commands_terminal.o grub_emu-commands_ls.o 
grub_emu-commands_timeout.o grub_emu-commands_i386_pc_halt.o 
grub_emu-commands_i386_pc_reboot.o grub_emu-disk_loopback.o grub_emu-fs_ext2.o 
grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o 
grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o 
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o 
grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o 
grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o 
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o 
grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o 
grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o 
grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o 
grub_emu-util_i386_pc_getroot.o grub_emu-util_i386_pc_misc.o
        $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
 
 grub_emu-commands_boot.o: commands/boot.c
@@ -709,6 +709,14 @@ grub_emu-commands_cat.d: commands/cat.c
 
 -include grub_emu-commands_cat.d
 
+grub_emu-commands_hexcat.o: commands/hexcat.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) 
$(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-commands_hexcat.d: commands/hexcat.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands 
$(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | 
sed 's,hexcat\.o[ :]*,grub_emu-commands_hexcat.o $@ : ,g' > $@;       [ -s $@ ] 
|| rm -f $@
+
+-include grub_emu-commands_hexcat.d
+
 grub_emu-commands_cmp.o: commands/cmp.c
        $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) 
$(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -1132,7 +1140,7 @@ pkgdata_MODULES = _chain.mod _linux.mod 
        terminal.mod fshelp.mod chain.mod multiboot.mod amiga.mod       \
        apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod       \
        help.mod default.mod timeout.mod configfile.mod sendkey.mod     \
-       activate.mod parttype.mod
+       activate.mod parttype.mod hexcat.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -2324,6 +2332,56 @@ fs-cat.lst: commands/cat.c genfslist.sh
 
 cat_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For hexcat.mod.
+hexcat_mod_SOURCES = commands/hexcat.c
+CLEANFILES += hexcat.mod mod-hexcat.o mod-hexcat.c pre-hexcat.o 
hexcat_mod-commands_hexcat.o def-hexcat.lst und-hexcat.lst
+MOSTLYCLEANFILES += hexcat_mod-commands_hexcat.d
+DEFSYMFILES += def-hexcat.lst
+UNDSYMFILES += und-hexcat.lst
+
+hexcat.mod: pre-hexcat.o mod-hexcat.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment $@
+
+pre-hexcat.o: hexcat_mod-commands_hexcat.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-hexcat.o: mod-hexcat.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(hexcat_mod_CFLAGS) -c -o $@ $<
+
+mod-hexcat.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'hexcat' $< > $@ || (rm -f $@; exit 1)
+
+def-hexcat.lst: pre-hexcat.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hexcat/' > $@
+
+und-hexcat.lst: pre-hexcat.o
+       echo 'hexcat' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+hexcat_mod-commands_hexcat.o: commands/hexcat.c
+       $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) 
$(hexcat_mod_CFLAGS) -c -o $@ $<
+
+hexcat_mod-commands_hexcat.d: commands/hexcat.c
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) 
$(CFLAGS) $(hexcat_mod_CFLAGS) -M $<          | sed 's,hexcat\.o[ 
:]*,hexcat_mod-commands_hexcat.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+
+-include hexcat_mod-commands_hexcat.d
+
+CLEANFILES += cmd-hexcat.lst fs-hexcat.lst
+COMMANDFILES += cmd-hexcat.lst
+FSFILES += fs-hexcat.lst
+
+cmd-hexcat.lst: commands/hexcat.c gencmdlist.sh
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) 
$(CFLAGS) $(hexcat_mod_CFLAGS) -E $<          | sh $(srcdir)/gencmdlist.sh 
hexcat > $@ || (rm -f $@; exit 1)
+
+fs-hexcat.lst: commands/hexcat.c genfslist.sh
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) 
$(CFLAGS) $(hexcat_mod_CFLAGS) -E $<          | sh $(srcdir)/genfslist.sh 
hexcat > $@ || (rm -f $@; exit 1)
+
+
+hexcat_mod_CFLAGS = $(COMMON_CFLAGS)
+
 # For help.mod.
 help_mod_SOURCES = commands/help.c
 CLEANFILES += help.mod mod-help.o mod-help.c pre-help.o 
help_mod-commands_help.o def-help.lst und-help.lst
diff -urpN ./grub2_2/conf/i386-pc.rmk ./grub2_3/conf/i386-pc.rmk
--- ./grub2_2/conf/i386-pc.rmk  2005-08-08 12:05:33.000000000 +0200
+++ ./grub2_3/conf/i386-pc.rmk  2005-08-08 15:08:59.000000000 +0200
@@ -75,11 +75,11 @@ grub_probefs_SOURCES = util/i386/pc/grub
        fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c
 
 # For grub-emu.
-grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c       \
-       commands/configfile.c commands/default.c commands/help.c        \
-       commands/terminal.c commands/ls.c commands/timeout.c            \
-       commands/i386/pc/halt.c commands/i386/pc/reboot.c               \
-       disk/loopback.c                                                 \
+grub_emu_SOURCES = commands/boot.c commands/cat.c commands/hexcat.c    \
+       commands/cmp.c commands/configfile.c commands/default.c         \
+       commands/help.c commands/terminal.c commands/ls.c               \
+       commands/timeout.c commands/i386/pc/halt.c                      \
+       commands/i386/pc/reboot.c disk/loopback.c                       \
        fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
        fs/minix.c fs/ufs.c                                             \
        kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c       \
@@ -110,7 +110,7 @@ pkgdata_MODULES = _chain.mod _linux.mod 
        terminal.mod fshelp.mod chain.mod multiboot.mod amiga.mod       \
        apple.mod pc.mod sun.mod loopback.mod reboot.mod halt.mod       \
        help.mod default.mod timeout.mod configfile.mod sendkey.mod     \
-       activate.mod parttype.mod
+       activate.mod parttype.mod hexcat.mod
 
 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -203,6 +203,10 @@ cmp_mod_CFLAGS = $(COMMON_CFLAGS)
 cat_mod_SOURCES = commands/cat.c
 cat_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For hexcat.mod.
+hexcat_mod_SOURCES = commands/hexcat.c
+hexcat_mod_CFLAGS = $(COMMON_CFLAGS)
+
 # For help.mod.
 help_mod_SOURCES = commands/help.c
 help_mod_CFLAGS = $(COMMON_CFLAGS)
diff -urpN ./grub2_2/conf/powerpc-ieee1275.mk ./grub2_3/conf/powerpc-ieee1275.mk
--- ./grub2_2/conf/powerpc-ieee1275.mk  2005-08-08 12:05:33.000000000 +0200
+++ ./grub2_3/conf/powerpc-ieee1275.mk  2005-08-08 15:10:20.000000000 +0200
@@ -67,7 +67,7 @@ grub_emu_SOURCES = commands/boot.c comma
        commands/configfile.c commands/default.c commands/help.c        \
        commands/terminal.c commands/ls.c commands/timeout.c            \
        commands/ieee1275/halt.c commands/ieee1275/reboot.c             \
-       disk/loopback.c                                                 \
+       disk/loopback.c commands/hexcat.c                               \
        fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
        fs/minix.c fs/ufs.c                                             \
        kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c       \
@@ -79,10 +79,10 @@ grub_emu_SOURCES = commands/boot.c comma
        util/console.c util/grub-emu.c util/misc.c                      \
        util/i386/pc/biosdisk.c util/i386/pc/getroot.c                  \
        util/powerpc/ieee1275/misc.c
-CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o 
grub_emu-commands_cmp.o grub_emu-commands_configfile.o 
grub_emu-commands_default.o grub_emu-commands_help.o 
grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o 
grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o 
grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o 
grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o 
grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o 
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o 
grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o 
grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o 
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o 
grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o 
grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o 
grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o 
grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o
-MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d 
grub_emu-commands_cmp.d grub_emu-commands_configfile.d 
grub_emu-commands_default.d grub_emu-commands_help.d 
grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d 
grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d 
grub_emu-disk_loopback.d grub_emu-fs_ext2.d grub_emu-fs_fat.d 
grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d grub_emu-fs_jfs.d 
grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d 
grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d 
grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d 
grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d 
grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d 
grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_context.d 
grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d 
grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d 
grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d 
grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d 
grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d
+CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o 
grub_emu-commands_cmp.o grub_emu-commands_configfile.o 
grub_emu-commands_default.o grub_emu-commands_help.o 
grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o 
grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o 
grub_emu-disk_loopback.o grub_emu-commands_hexcat.o grub_emu-fs_ext2.o 
grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o 
grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o 
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o 
grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o 
grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o 
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o 
grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o 
grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o 
grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o 
grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o
+MOSTLYCLEANFILES += grub_emu-commands_boot.d grub_emu-commands_cat.d 
grub_emu-commands_cmp.d grub_emu-commands_configfile.d 
grub_emu-commands_default.d grub_emu-commands_help.d 
grub_emu-commands_terminal.d grub_emu-commands_ls.d grub_emu-commands_timeout.d 
grub_emu-commands_ieee1275_halt.d grub_emu-commands_ieee1275_reboot.d 
grub_emu-disk_loopback.d grub_emu-commands_hexcat.d grub_emu-fs_ext2.d 
grub_emu-fs_fat.d grub_emu-fs_fshelp.d grub_emu-fs_hfs.d grub_emu-fs_iso9660.d 
grub_emu-fs_jfs.d grub_emu-fs_minix.d grub_emu-fs_ufs.d grub_emu-kern_device.d 
grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_env.d grub_emu-kern_err.d 
grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_loader.d 
grub_emu-kern_main.d grub_emu-kern_misc.d grub_emu-kern_partition.d 
grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-normal_arg.d 
grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_context.d 
grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_menu_entry.d 
grub_emu-partmap_amiga.d grub_emu-partmap_apple.d grub_emu-partmap_pc.d 
grub_emu-partmap_sun.d grub_emu-util_console.d grub_emu-util_grub_emu.d 
grub_emu-util_misc.d grub_emu-util_i386_pc_biosdisk.d 
grub_emu-util_i386_pc_getroot.d grub_emu-util_powerpc_ieee1275_misc.d
 
-grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o 
grub_emu-commands_cmp.o grub_emu-commands_configfile.o 
grub_emu-commands_default.o grub_emu-commands_help.o 
grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o 
grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o 
grub_emu-disk_loopback.o grub_emu-fs_ext2.o grub_emu-fs_fat.o 
grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o 
grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o 
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o 
grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o 
grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o 
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o 
grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o 
grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o 
grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o 
grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o
+grub-emu: grub_emu-commands_boot.o grub_emu-commands_cat.o 
grub_emu-commands_cmp.o grub_emu-commands_configfile.o 
grub_emu-commands_default.o grub_emu-commands_help.o 
grub_emu-commands_terminal.o grub_emu-commands_ls.o grub_emu-commands_timeout.o 
grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o 
grub_emu-disk_loopback.o grub_emu-commands_hexcat.o grub_emu-fs_ext2.o 
grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o 
grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_ufs.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_env.o grub_emu-kern_err.o 
grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o 
grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_partition.o 
grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-normal_arg.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_context.o 
grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_menu_entry.o 
grub_emu-partmap_amiga.o grub_emu-partmap_apple.o grub_emu-partmap_pc.o 
grub_emu-partmap_sun.o grub_emu-util_console.o grub_emu-util_grub_emu.o 
grub_emu-util_misc.o grub_emu-util_i386_pc_biosdisk.o 
grub_emu-util_i386_pc_getroot.o grub_emu-util_powerpc_ieee1275_misc.o
        $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS)
 
 grub_emu-commands_boot.o: commands/boot.c
@@ -181,6 +181,14 @@ grub_emu-disk_loopback.d: disk/loopback.
 
 -include grub_emu-disk_loopback.d
 
+grub_emu-commands_hexcat.o: commands/hexcat.c
+       $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) 
$(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
+
+grub_emu-commands_hexcat.d: commands/hexcat.c
+       set -e;           $(BUILD_CC) -Icommands -I$(srcdir)/commands 
$(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $<    | 
sed 's,hexcat\.o[ :]*,grub_emu-commands_hexcat.o $@ : ,g' > $@;       [ -s $@ ] 
|| rm -f $@
+
+-include grub_emu-commands_hexcat.d
+
 grub_emu-fs_ext2.o: fs/ext2.c
        $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) 
-DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $<
 
@@ -721,7 +729,7 @@ pkgdata_MODULES = _linux.mod linux.mod f
        hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
        boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
        pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
-       default.mod timeout.mod configfile.mod
+       default.mod timeout.mod configfile.mod hexcat.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
@@ -1664,6 +1672,56 @@ fs-cat.lst: commands/cat.c genfslist.sh
 
 cat_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For hexcat.mod.
+hexcat_mod_SOURCES = commands/hexcat.c
+CLEANFILES += hexcat.mod mod-hexcat.o mod-hexcat.c pre-hexcat.o 
hexcat_mod-commands_hexcat.o def-hexcat.lst und-hexcat.lst
+MOSTLYCLEANFILES += hexcat_mod-commands_hexcat.d
+DEFSYMFILES += def-hexcat.lst
+UNDSYMFILES += und-hexcat.lst
+
+hexcat.mod: pre-hexcat.o mod-hexcat.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment $@
+
+pre-hexcat.o: hexcat_mod-commands_hexcat.o
+       -rm -f $@
+       $(LD) -r -d -o $@ $^
+
+mod-hexcat.o: mod-hexcat.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(hexcat_mod_CFLAGS) -c -o $@ $<
+
+mod-hexcat.c: moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh 'hexcat' $< > $@ || (rm -f $@; exit 1)
+
+def-hexcat.lst: pre-hexcat.o
+       $(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hexcat/' > $@
+
+und-hexcat.lst: pre-hexcat.o
+       echo 'hexcat' > $@
+       $(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+hexcat_mod-commands_hexcat.o: commands/hexcat.c
+       $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) 
$(hexcat_mod_CFLAGS) -c -o $@ $<
+
+hexcat_mod-commands_hexcat.d: commands/hexcat.c
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) 
$(CFLAGS) $(hexcat_mod_CFLAGS) -M $<          | sed 's,hexcat\.o[ 
:]*,hexcat_mod-commands_hexcat.o $@ : ,g' > $@;     [ -s $@ ] || rm -f $@
+
+-include hexcat_mod-commands_hexcat.d
+
+CLEANFILES += cmd-hexcat.lst fs-hexcat.lst
+COMMANDFILES += cmd-hexcat.lst
+FSFILES += fs-hexcat.lst
+
+cmd-hexcat.lst: commands/hexcat.c gencmdlist.sh
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) 
$(CFLAGS) $(hexcat_mod_CFLAGS) -E $<          | sh $(srcdir)/gencmdlist.sh 
hexcat > $@ || (rm -f $@; exit 1)
+
+fs-hexcat.lst: commands/hexcat.c genfslist.sh
+       set -e;           $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) 
$(CFLAGS) $(hexcat_mod_CFLAGS) -E $<          | sh $(srcdir)/genfslist.sh 
hexcat > $@ || (rm -f $@; exit 1)
+
+
+hexcat_mod_CFLAGS = $(COMMON_CFLAGS)
+
 # For font.mod.
 font_mod_SOURCES = font/manager.c
 CLEANFILES += font.mod mod-font.o mod-font.c pre-font.o 
font_mod-font_manager.o def-font.lst und-font.lst
diff -urpN ./grub2_2/conf/powerpc-ieee1275.rmk 
./grub2_3/conf/powerpc-ieee1275.rmk
--- ./grub2_2/conf/powerpc-ieee1275.rmk 2005-08-08 12:05:33.000000000 +0200
+++ ./grub2_3/conf/powerpc-ieee1275.rmk 2005-08-08 15:10:12.000000000 +0200
@@ -37,7 +37,7 @@ grub_emu_SOURCES = commands/boot.c comma
        commands/configfile.c commands/default.c commands/help.c        \
        commands/terminal.c commands/ls.c commands/timeout.c            \
        commands/ieee1275/halt.c commands/ieee1275/reboot.c             \
-       disk/loopback.c                                                 \
+       disk/loopback.c commands/hexcat.c                               \
        fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c   \
        fs/minix.c fs/ufs.c                                             \
        kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c       \
@@ -73,7 +73,7 @@ pkgdata_MODULES = _linux.mod linux.mod f
        hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
        boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
        pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
-       default.mod timeout.mod configfile.mod
+       default.mod timeout.mod configfile.mod hexcat.mod
 
 # For fshelp.mod.
 fshelp_mod_SOURCES = fs/fshelp.c
@@ -147,6 +147,10 @@ cmp_mod_CFLAGS = $(COMMON_CFLAGS)
 cat_mod_SOURCES = commands/cat.c
 cat_mod_CFLAGS = $(COMMON_CFLAGS)
 
+# For hexcat.mod.
+hexcat_mod_SOURCES = commands/hexcat.c
+hexcat_mod_CFLAGS = $(COMMON_CFLAGS)
+
 # For font.mod.
 font_mod_SOURCES = font/manager.c
 font_mod_CFLAGS = $(COMMON_CFLAGS)
diff -urpN ./grub2_2/normal/cmdline.c ./grub2_3/normal/cmdline.c
--- ./grub2_2/normal/cmdline.c  2005-08-08 12:05:42.000000000 +0200
+++ ./grub2_3/normal/cmdline.c  2005-08-08 16:34:09.000000000 +0200
@@ -27,6 +27,7 @@
 #include <grub/disk.h>
 #include <grub/file.h>
 #include <grub/env.h>
+#include <grub/machine/console.h>
 
 static char *kill_buf;
 
@@ -474,7 +475,7 @@ grub_cmdline_get (const char *prompt, ch
   grub_size_t lpos, llen;
   grub_size_t plen;
   char buf[max_len];
-  int key;
+  int key, key0;
   int histpos = 0;
   auto void cl_insert (const char *str);
   auto void cl_delete (unsigned len);
@@ -564,18 +565,20 @@ grub_cmdline_get (const char *prompt, ch
   if (hist_used == 0)
     grub_history_add (buf);
 
-  while ((key = GRUB_TERM_ASCII_CHAR (grub_getkey ())) != '\n' && key != '\r')
+  while ((key = GRUB_TERM_ASCII_CHAR (key0 = grub_getkey ())) != '\n' && key 
!= '\r')
     {
       if (readline)
        {
          switch (key)
            {
            case 1:     /* Ctrl-a */
+           key_home:
              lpos = 0;
              cl_set_pos ();
              break;
 
            case 2:     /* Ctrl-b */
+           key_left:
              if (lpos > 0)
                {
                  lpos--;
@@ -584,11 +587,13 @@ grub_cmdline_get (const char *prompt, ch
              break;
 
            case 5:     /* Ctrl-e */
+           key_end:
              lpos = llen;
              cl_set_pos ();
              break;
 
            case 6:     /* Ctrl-f */
+           key_right:
              if (lpos < llen)
                {
                  lpos++;
@@ -641,6 +646,7 @@ grub_cmdline_get (const char *prompt, ch
              break;
 
            case 14:    /* Ctrl-n */
+           key_down:
              {
                char *hist;
 
@@ -658,7 +664,9 @@ grub_cmdline_get (const char *prompt, ch
 
                break;
              }
+
            case 16:    /* Ctrl-p */
+           key_up:
              {
                char *hist;
 
@@ -703,6 +711,28 @@ grub_cmdline_get (const char *prompt, ch
              if (kill_buf)
                cl_insert (kill_buf);
              break;
+             
+           default:
+             switch (key0)
+               {
+               case GRUB_CONSOLE_KEY_HOME:
+                 goto key_home;
+
+               case GRUB_CONSOLE_KEY_END:
+                 goto key_end;
+
+               case GRUB_CONSOLE_KEY_LEFT:
+                 goto key_left;
+
+               case GRUB_CONSOLE_KEY_RIGHT:
+                 goto key_right;
+
+               case GRUB_CONSOLE_KEY_UP:
+                 goto key_up;
+
+               case GRUB_CONSOLE_KEY_DOWN:
+                 goto key_down;
+               }
            }
        }
 
diff -urpN ./grub2_2/normal/menu.c ./grub2_3/normal/menu.c
--- ./grub2_2/normal/menu.c     2005-08-08 12:05:42.000000000 +0200
+++ ./grub2_3/normal/menu.c     2005-08-08 16:16:30.000000000 +0200
@@ -23,6 +23,7 @@
 #include <grub/loader.h>
 #include <grub/mm.h>
 #include <grub/machine/time.h>
+#include <grub/machine/console.h>
 
 static void
 draw_border (void)
@@ -195,7 +196,7 @@ run_menu (grub_menu_t menu, int nested)
 
   while (1)
     {
-      int c;
+      int c, c0;
 
       if (menu->timeout > 0)
        {
@@ -226,7 +227,7 @@ run_menu (grub_menu_t menu, int nested)
       
       if (grub_checkkey () >= 0 || menu->timeout < 0)
        {
-         c = GRUB_TERM_ASCII_CHAR (grub_getkey ());
+         c = GRUB_TERM_ASCII_CHAR (c0 = grub_getkey ());
          
          if (menu->timeout >= 0)
            {
@@ -242,6 +243,7 @@ run_menu (grub_menu_t menu, int nested)
            {
            case 16:
            case '^':
+           key_up:
              if (offset > 0)
                {
                  print_entry (GRUB_TERM_FIRST_ENTRY_Y + offset, 0,
@@ -259,6 +261,7 @@ run_menu (grub_menu_t menu, int nested)
              
            case 14:
            case 'v':
+           key_down:
              if (menu->size > first + offset + 1)
                {
                  if (offset < GRUB_TERM_NUM_ENTRIES - 1)
@@ -300,6 +303,17 @@ run_menu (grub_menu_t menu, int nested)
              goto refresh;
              
            default:
+
+             switch (c0)
+               {
+               case GRUB_CONSOLE_KEY_DOWN:
+                 goto key_down;
+
+               case GRUB_CONSOLE_KEY_UP:
+                 goto key_up;
+
+               }
+
              break;
            }
          
diff -urpN ./grub2_2/util/console.c ./grub2_3/util/console.c
--- ./grub2_2/util/console.c    2005-08-08 12:05:42.000000000 +0200
+++ ./grub2_3/util/console.c    2005-08-08 15:42:52.000000000 +0200
@@ -258,6 +258,12 @@ grub_ncurses_init (void)
   return 0;
 }
 
+static grub_uint16_t
+grub_ncurses_getwh (void)
+{
+  return (getmaxx (stdscr) << 8) | getmaxy (stdscr);
+}
+
 static grub_err_t
 grub_ncurses_fini (void)
 {
@@ -274,6 +280,7 @@ static struct grub_term grub_ncurses_ter
     .putchar = grub_ncurses_putchar,
     .checkkey = grub_ncurses_checkkey,
     .getkey = grub_ncurses_getkey,
+    .getwh = grub_ncurses_getwh,
     .getxy = grub_ncurses_getxy,
     .gotoxy = grub_ncurses_gotoxy,
     .cls = grub_ncurses_cls,
diff -urpN ./grub2_2/util/grub-emu.c ./grub2_3/util/grub-emu.c
--- ./grub2_2/util/grub-emu.c   2005-08-08 12:05:42.000000000 +0200
+++ ./grub2_3/util/grub-emu.c   2005-08-08 15:15:05.000000000 +0200
@@ -186,6 +186,7 @@ main (int argc, char *argv[])
   grub_boot_init ();
   grub_cmp_init ();
   grub_cat_init ();
+  grub_hexcat_init ();
   grub_terminal_init ();
   grub_loop_init ();
   grub_help_init ();
@@ -219,6 +220,7 @@ main (int argc, char *argv[])
   grub_fat_fini ();
   grub_boot_fini ();
   grub_cmp_fini ();
+  grub_hexcat_fini ();
   grub_cat_fini ();
   grub_terminal_fini ();
   grub_amiga_partition_map_fini ();

reply via email to

[Prev in Thread] Current Thread [Next in Thread]