merge with mainline

This commit is contained in:
BVK Chaitanya 2010-08-15 11:12:53 +05:30
commit 1379af7834
29 changed files with 1468 additions and 797 deletions

View file

@ -56,22 +56,23 @@ parse_color_name (grub_uint8_t *ret, char *name)
return -1;
}
void
grub_parse_color_name_pair (grub_uint8_t *ret, const char *name)
int
grub_parse_color_name_pair (grub_uint8_t *color, const char *name)
{
int result = 1;
grub_uint8_t fg, bg;
char *fg_name, *bg_name;
/* nothing specified by user */
if (name == NULL)
return;
return result;
fg_name = grub_strdup (name);
if (fg_name == NULL)
{
/* "out of memory" message was printed by grub_strdup() */
grub_wait_after_message ();
return;
return result;
}
bg_name = grub_strchr (fg_name, '/');
@ -97,10 +98,12 @@ grub_parse_color_name_pair (grub_uint8_t *ret, const char *name)
goto free_and_return;
}
*ret = (bg << 4) | fg;
*color = (bg << 4) | fg;
result = 0;
free_and_return:
grub_free (fg_name);
return result;
}
static grub_uint8_t color_normal, color_highlight;
@ -122,10 +125,10 @@ set_colors (void)
/* Replace default `normal' colors with the ones specified by user (if any). */
char *
grub_env_write_color_normal (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
grub_env_write_color_normal (struct grub_env_var *var, const char *val)
{
grub_parse_color_name_pair (&color_normal, val);
if (grub_parse_color_name_pair (&color_normal, val))
return 0;
set_colors ();
@ -134,10 +137,10 @@ grub_env_write_color_normal (struct grub_env_var *var __attribute__ ((unused)),
/* Replace default `highlight' colors with the ones specified by user (if any). */
char *
grub_env_write_color_highlight (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
grub_env_write_color_highlight (struct grub_env_var *var, const char *val)
{
grub_parse_color_name_pair (&color_highlight, val);
if (grub_parse_color_name_pair (&color_highlight, val))
return 0;
set_colors ();

View file

@ -472,6 +472,7 @@ static void (*grub_xputs_saved) (const char *str);
GRUB_MOD_INIT(normal)
{
grub_context_init ();
grub_script_init ();
grub_xputs_saved = grub_xputs;
grub_xputs = grub_xputs_normal;
@ -501,11 +502,16 @@ GRUB_MOD_INIT(normal)
/* Preserve hooks after context changes. */
grub_env_export ("color_normal");
grub_env_export ("color_highlight");
/* Set default color names. */
grub_env_set ("color_normal", "white/black");
grub_env_set ("color_highlight", "black/white");
}
GRUB_MOD_FINI(normal)
{
grub_context_fini ();
grub_script_fini ();
grub_xputs = grub_xputs_saved;