From: Vladimir 'phcoder' Serbinenko Date: Sat, 28 Aug 2010 09:35:02 +0000 (+0200) Subject: Fallback to dumb printf if malloc failes X-Git-Tag: 1.99~629^2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcc953eecb077923049b6e6b50fbef3055122a2e;p=thirdparty%2Fgrub.git Fallback to dumb printf if malloc failes --- diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index 4f5779abe..a5fdbe4e9 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -751,6 +751,34 @@ grub_xputs_normal (const char *str) if (!unicode_str) { grub_errno = GRUB_ERR_NONE; + for (; *str; str++) + { + grub_term_output_t term; + grub_uint32_t code = *str; + if (code > 0x7f) + code = '?'; + + FOR_ACTIVE_TERM_OUTPUTS(term) + { + struct grub_unicode_glyph c = + { + .base = code, + .variant = 0, + .attributes = 0, + .ncomb = 0, + .combining = 0, + .estimated_width = 1 + }; + + (term->putchar) (term, &c); + if (code == '\n') + { + c.base = '\r'; + (term->putchar) (term, &c); + } + } + } + return; }