f4c76c0
From 28297386b1d3801d3a79d31e957b0fbed9eb5baa 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
f4c76c0
Subject: [PATCH 10/74] 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
f4c76c0
index 906d2c2..6b3397f 100644
f4c76c0
--- a/grub-core/kern/misc.c
f4c76c0
+++ b/grub-core/kern/misc.c
f4c76c0
@@ -587,7 +587,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')
f4c76c0
@@ -602,7 +602,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
f4c76c0
@@ -675,6 +675,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':
f4c76c0
@@ -755,6 +756,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;
f4c76c0
@@ -892,6 +894,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
 	  {
f4c76c0
-- 
f4c76c0
2.4.3
f4c76c0