merge mainline into bidi

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-05-05 16:28:52 +02:00
commit 99bfe57386
109 changed files with 3099 additions and 839 deletions

View file

@ -51,11 +51,8 @@ autoload_fs_module (void)
/* Read the file fs.lst for auto-loading. */
void
read_fs_list (void)
read_fs_list (const char *prefix)
{
const char *prefix;
prefix = grub_env_get ("prefix");
if (prefix)
{
char *filename;

View file

@ -23,6 +23,7 @@
#include <grub/mm.h>
#include <grub/command.h>
#include <grub/normal.h>
#include <grub/i18n.h>
struct menu_pointer
{
@ -172,7 +173,7 @@ grub_context_init (void)
grub_env_export ("prefix");
export_cmd = grub_register_command ("export", grub_cmd_export,
"export ENVVAR", "Export a variable.");
N_("ENVVAR"), N_("Export a variable."));
}
void

View file

@ -66,14 +66,12 @@ grub_crypto_spec_free (void)
/* Read the file crypto.lst for auto-loading. */
void
read_crypto_list (void)
read_crypto_list (const char *prefix)
{
const char *prefix;
char *filename;
grub_file_t file;
char *buf = NULL;
prefix = grub_env_get ("prefix");
if (!prefix)
{
grub_errno = GRUB_ERR_NONE;

View file

@ -60,11 +60,8 @@ grub_dyncmd_dispatcher (struct grub_command *cmd,
/* Read the file command.lst for auto-loading. */
void
read_command_list (void)
read_command_list (const char *prefix)
{
const char *prefix;
prefix = grub_env_get ("prefix");
if (prefix)
{
char *filename;

View file

@ -155,6 +155,17 @@ free_menu_entry_classes (struct grub_menu_entry_class *head)
}
}
static struct
{
char *name;
int key;
} hotkey_aliases[] =
{
{"backspace", '\b'},
{"tab", '\t'},
{"delete", GRUB_TERM_DC}
};
/* Add a menu entry to the current menu context (as given by the environment
variable data slot `menu'). As the configuration file is read, the script
parser calls this when a menu entry is to be created. */
@ -171,6 +182,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
struct grub_menu_entry_class *classes_head; /* Dummy head node for list. */
struct grub_menu_entry_class *classes_tail;
char *users = NULL;
int hotkey = 0;
/* Allocate dummy head node for class list. */
classes_head = grub_zalloc (sizeof (struct grub_menu_entry_class));
@ -237,6 +249,32 @@ grub_normal_add_menu_entry (int argc, const char **args,
continue;
}
else if (grub_strcmp(arg, "hotkey") == 0)
{
unsigned j;
i++;
if (args[i][1] == 0)
{
hotkey = args[i][0];
continue;
}
for (j = 0; j < ARRAY_SIZE (hotkey_aliases); j++)
if (grub_strcmp (args[i], hotkey_aliases[j].name) == 0)
{
hotkey = hotkey_aliases[j].key;
break;
}
if (j < ARRAY_SIZE (hotkey_aliases))
continue;
failed = 1;
grub_error (GRUB_ERR_MENU,
"Invalid hotkey: '%s'.", args[i]);
break;
}
else
{
/* Handle invalid argument. */
@ -293,6 +331,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
}
(*last)->title = menutitle;
(*last)->hotkey = hotkey;
(*last)->classes = classes_head;
if (users)
(*last)->restricted = 1;
@ -435,14 +474,20 @@ grub_normal_init_page (struct grub_term_output *term)
grub_free (unicode_msg);
}
static char *
read_lists (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
static void
read_lists (const char *val)
{
read_command_list ();
read_fs_list ();
read_crypto_list ();
read_terminal_list ();
read_command_list (val);
read_fs_list (val);
read_crypto_list (val);
read_terminal_list (val);
}
static char *
read_lists_hook (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
{
read_lists (val);
return val ? grub_strdup (val) : NULL;
}
@ -452,10 +497,11 @@ void
grub_normal_execute (const char *config, int nested, int batch)
{
grub_menu_t menu = 0;
const char *prefix = grub_env_get ("prefix");
read_lists (NULL, NULL);
read_lists (prefix);
read_handler_list ();
grub_register_variable_hook ("prefix", NULL, read_lists);
grub_register_variable_hook ("prefix", NULL, read_lists_hook);
grub_command_execute ("parser.grub", 0, 0);
if (config)
@ -665,9 +711,9 @@ GRUB_MOD_INIT(normal)
/* Register a command "normal" for the rescue mode. */
grub_register_command ("normal", grub_cmd_normal,
0, "Enter normal mode.");
0, N_("Enter normal mode."));
grub_register_command ("normal_exit", grub_cmd_normal_exit,
0, "Exit from normal mode.");
0, N_("Exit from normal mode."));
/* Reload terminal colors when these variables are written to. */
grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal);

View file

@ -477,6 +477,18 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
goto refresh;
default:
{
grub_menu_entry_t entry;
int i;
for (i = 0, entry = menu->entry_list; i < menu->size;
i++, entry = entry->next)
if (entry->hotkey == c)
{
menu_fini ();
*auto_boot = 0;
return i;
}
}
break;
}
}

View file

@ -120,10 +120,17 @@ print_message (int nested, int edit, struct grub_term_output *term)
if (edit)
{
grub_putcode ('\n', term);
#ifdef GRUB_MACHINE_EFI
grub_print_message_indented (_("Minimum Emacs-like screen editing is \
supported. TAB lists completions. Press F1 to boot, F2=Ctrl-a, F3=Ctrl-e, \
F4 for a command-line or ESC to discard edits and return to the GRUB menu."),
STANDARD_MARGIN, STANDARD_MARGIN, term);
#else
grub_print_message_indented (_("Minimum Emacs-like screen editing is \
supported. TAB lists completions. Press Ctrl-x to boot, Ctrl-c for a \
command-line or ESC to return menu."), STANDARD_MARGIN, STANDARD_MARGIN,
term);
command-line or ESC to discard edits and return to the GRUB menu."),
STANDARD_MARGIN, STANDARD_MARGIN, term);
#endif
}
else
{

View file

@ -252,14 +252,12 @@ grub_terminal_autoload_free (void)
/* Read the file terminal.lst for auto-loading. */
void
read_terminal_list (void)
read_terminal_list (const char *prefix)
{
const char *prefix;
char *filename;
grub_file_t file;
char *buf = NULL;
prefix = grub_env_get ("prefix");
if (!prefix)
{
grub_errno = GRUB_ERR_NONE;