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