merge with mainline

This commit is contained in:
BVK Chaitanya 2010-09-04 09:05:21 +05:30
commit e5a73c4247
182 changed files with 9977 additions and 5276 deletions

View file

@ -297,13 +297,10 @@ grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
{
grub_size_t msg_len = grub_strlen (msg);
*unicode_msg = grub_malloc (grub_strlen (msg) * sizeof (grub_uint32_t));
*unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t));
if (!*unicode_msg)
{
grub_printf ("utf8_to_ucs4 ERROR1: %s", msg);
return -1;
}
return -1;
msg_len = grub_utf8_to_ucs4 (*unicode_msg, msg_len,
(grub_uint8_t *) msg, -1, 0);
@ -1215,6 +1212,8 @@ grub_bidi_logical_to_visual (const grub_uint32_t *logical,
struct grub_unicode_glyph *visual_ptr;
*visual_out = visual_ptr = grub_malloc (2 * sizeof (visual_ptr[0])
* logical_len);
if (!visual_ptr)
return -1;
for (ptr = logical; ptr <= logical + logical_len; ptr++)
{
if (ptr == logical + logical_len || *ptr == '\n')

View file

@ -585,6 +585,7 @@ grub_cmdline_get (const char *prompt)
break;
case '\e':
grub_free (cl_terms);
return 0;
case '\b':
@ -635,5 +636,6 @@ grub_cmdline_get (const char *prompt)
ret = grub_ucs4_to_utf8_alloc (buf + lpos, llen - lpos + 1);
grub_free (buf);
grub_free (cl_terms);
return ret;
}

View file

@ -125,10 +125,11 @@ 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, const char *val)
grub_env_write_color_normal (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
{
if (grub_parse_color_name_pair (&color_normal, val))
return 0;
return NULL;
set_colors ();
@ -137,10 +138,11 @@ grub_env_write_color_normal (struct grub_env_var *var, const char *val)
/* Replace default `highlight' colors with the ones specified by user (if any). */
char *
grub_env_write_color_highlight (struct grub_env_var *var, const char *val)
grub_env_write_color_highlight (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
{
if (grub_parse_color_name_pair (&color_highlight, val))
return 0;
return NULL;
set_colors ();

View file

@ -499,7 +499,10 @@ grub_normal_do_completion (char *buf, int *restore,
fail:
if (argc != 0)
grub_free (argv[0]);
{
grub_free (argv);
grub_free (argv[0]);
}
grub_free (match);
grub_errno = GRUB_ERR_NONE;

View file

@ -43,9 +43,20 @@ grub_err_t (*grub_gfxmenu_try_hook) (int entry, grub_menu_t menu,
void
grub_wait_after_message (void)
{
grub_uint64_t endtime;
grub_xputs ("\n");
grub_printf_ (N_("Press any key to continue..."));
(void) grub_getkey ();
grub_refresh ();
endtime = grub_get_time_ms () + 10000;
while (grub_get_time_ms () < endtime)
if (grub_checkkey () >= 0)
{
grub_getkey ();
break;
}
grub_xputs ("\n");
}

View file

@ -44,6 +44,9 @@ static int grub_more;
static int grub_normal_char_counter = 0;
static void
putcode_real (grub_uint32_t code, struct grub_term_output *term);
int
grub_normal_get_char_counter (void)
{
@ -83,7 +86,7 @@ print_more (void)
{
grub_print_ucs4 (unicode_str, unicode_last_position, 0, 0, term);
}
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
grub_setcolorstate (GRUB_TERM_COLOR_NORMAL);
grub_free (unicode_str);
@ -94,6 +97,7 @@ print_more (void)
FOR_ACTIVE_TERM_OUTPUTS(term)
grub_print_spaces (term, 8);
grub_term_restore_pos (pos);
grub_free (pos);
/* Scroll one lines or an entire page, depending on the key. */
@ -202,8 +206,39 @@ void
grub_puts_terminal (const char *str, struct grub_term_output *term)
{
grub_uint32_t *unicode_str, *unicode_last_position;
grub_error_push ();
grub_utf8_to_ucs4_alloc (str, &unicode_str,
&unicode_last_position);
grub_error_pop ();
if (!unicode_str)
{
for (; *str; str++)
{
struct grub_unicode_glyph c =
{
.variant = 0,
.attributes = 0,
.ncomb = 0,
.combining = 0,
.estimated_width = 1,
.base = *str
};
FOR_ACTIVE_TERM_OUTPUTS(term)
{
(term->putchar) (term, &c);
}
if (*str == '\n')
{
c.base = '\r';
FOR_ACTIVE_TERM_OUTPUTS(term)
{
(term->putchar) (term, &c);
}
}
}
return;
}
grub_print_ucs4 (unicode_str, unicode_last_position, 0, 0, term);
grub_free (unicode_str);
@ -742,15 +777,43 @@ grub_print_ucs4 (const grub_uint32_t * str,
void
grub_xputs_normal (const char *str)
{
grub_term_output_t term;
grub_uint32_t *unicode_str, *unicode_last_position;
grub_uint32_t *unicode_str = NULL, *unicode_last_position;
int backlog = 0;
grub_term_output_t term;
grub_error_push ();
grub_utf8_to_ucs4_alloc (str, &unicode_str,
&unicode_last_position);
&unicode_last_position);
grub_error_pop ();
if (!unicode_str)
{
grub_errno = GRUB_ERR_NONE;
for (; *str; str++)
{
struct grub_unicode_glyph c =
{
.variant = 0,
.attributes = 0,
.ncomb = 0,
.combining = 0,
.estimated_width = 1,
.base = *str
};
FOR_ACTIVE_TERM_OUTPUTS(term)
{
(term->putchar) (term, &c);
}
if (*str == '\n')
{
c.base = '\r';
FOR_ACTIVE_TERM_OUTPUTS(term)
{
(term->putchar) (term, &c);
}
}
}
return;
}