6b2dd0f
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f4c76c0
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
f4c76c0
Date: Tue, 27 Nov 2012 16:58:39 -0200
31cddd6
Subject: [PATCH] Add %X option to printf functions.
f4c76c0
f4c76c0
---
f4c76c0
 grub-core/kern/misc.c | 7 +++++--
f4c76c0
 1 file changed, 5 insertions(+), 2 deletions(-)
f4c76c0
f4c76c0
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
ec4acbb
index 952411d5dc6..8344526be7f 100644
f4c76c0
--- a/grub-core/kern/misc.c
f4c76c0
+++ b/grub-core/kern/misc.c
bc092b9
@@ -588,7 +588,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
f4c76c0
 static inline char *
f4c76c0
 grub_lltoa (char *str, int c, unsigned long long n)
f4c76c0
 {
f4c76c0
-  unsigned base = (c == 'x') ? 16 : 10;
f4c76c0
+  unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
f4c76c0
   char *p;
f4c76c0
 
f4c76c0
   if ((long long) n < 0 && c == 'd')
bc092b9
@@ -603,7 +603,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
f4c76c0
     do
f4c76c0
       {
f4c76c0
 	unsigned d = (unsigned) (n & 0xf);
f4c76c0
-	*p++ = (d > 9) ? d + 'a' - 10 : d + '0';
f4c76c0
+	*p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
f4c76c0
       }
f4c76c0
     while (n >>= 4);
f4c76c0
   else
bc092b9
@@ -676,6 +676,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
f4c76c0
 	{
f4c76c0
 	case 'p':
f4c76c0
 	case 'x':
f4c76c0
+	case 'X':
f4c76c0
 	case 'u':
f4c76c0
 	case 'd':
f4c76c0
 	case 'c':
bc092b9
@@ -762,6 +763,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
f4c76c0
       switch (c)
f4c76c0
 	{
f4c76c0
 	case 'x':
f4c76c0
+	case 'X':
f4c76c0
 	case 'u':
f4c76c0
 	  args->ptr[curn].type = UNSIGNED_INT + longfmt;
f4c76c0
 	  break;
bc092b9
@@ -900,6 +902,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
f4c76c0
 	  c = 'x';
f4c76c0
 	  /* Fall through. */
f4c76c0
 	case 'x':
f4c76c0
+	case 'X':
f4c76c0
 	case 'u':
f4c76c0
 	case 'd':
f4c76c0
 	  {