]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fallback to dumb printf if malloc failes
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 28 Aug 2010 09:35:02 +0000 (11:35 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 28 Aug 2010 09:35:02 +0000 (11:35 +0200)
grub-core/normal/term.c

index 4f5779abe5c711efccb712d116fb0fb4ee33e651..a5fdbe4e99e750eee3b1d18322b70dbb25cd61b7 100644 (file)
@@ -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;
     }