merge trunk into newenv

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-20 14:20:37 +01:00
commit 902a478aab
5 changed files with 79 additions and 30 deletions

View file

@ -385,22 +385,35 @@ read_config_file (const char *config)
void
grub_normal_init_page (void)
{
grub_uint8_t width, margin;
#define TITLE ("GNU GRUB version " PACKAGE_VERSION)
width = grub_getwh () >> 8;
margin = (width - (sizeof(TITLE) + 7)) / 2;
int msg_len;
int posx;
const char *msg = _("GNU GRUB version %s");
char *msg_formatted = grub_malloc (grub_strlen(msg) +
grub_strlen(PACKAGE_VERSION));
grub_cls ();
grub_putchar ('\n');
while (margin--)
grub_putchar (' ');
grub_sprintf (msg_formatted, msg, PACKAGE_VERSION);
grub_printf ("%s\n\n", TITLE);
grub_uint32_t *unicode_msg;
grub_uint32_t *last_position;
msg_len = grub_utf8_to_ucs4_alloc (msg_formatted,
&unicode_msg, &last_position);
if (msg_len < 0)
{
return;
}
#undef TITLE
posx = grub_getstringwidth (unicode_msg, last_position);
posx = (GRUB_TERM_WIDTH - posx) / 2;
grub_gotoxy (posx, 1);
grub_print_ucs4 (unicode_msg, last_position);
grub_printf("\n\n");
grub_free (unicode_msg);
}
static int reader_nested;