011fe81
From d7aaf1651f4b36721f73331753d017d33d7879b4 Mon Sep 17 00:00:00 2001
481bf3b
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
481bf3b
Date: Tue, 27 Nov 2012 16:58:39 -0200
4dcaf21
Subject: [PATCH 098/143] Add %X option to printf functions.
481bf3b
481bf3b
---
481bf3b
 grub-core/kern/misc.c | 7 +++++--
481bf3b
 1 file changed, 5 insertions(+), 2 deletions(-)
481bf3b
481bf3b
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
011fe81
index c5c815d..a56cfe7 100644
481bf3b
--- a/grub-core/kern/misc.c
481bf3b
+++ b/grub-core/kern/misc.c
011fe81
@@ -762,7 +762,7 @@ __umoddi3 (grub_uint64_t a, grub_uint64_t b)
481bf3b
 static inline char *
481bf3b
 grub_lltoa (char *str, int c, unsigned long long n)
481bf3b
 {
481bf3b
-  unsigned base = (c == 'x') ? 16 : 10;
481bf3b
+  unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
481bf3b
   char *p;
481bf3b
 
481bf3b
   if ((long long) n < 0 && c == 'd')
011fe81
@@ -777,7 +777,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
481bf3b
     do
481bf3b
       {
481bf3b
 	unsigned d = (unsigned) (n & 0xf);
481bf3b
-	*p++ = (d > 9) ? d + 'a' - 10 : d + '0';
481bf3b
+	*p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
481bf3b
       }
481bf3b
     while (n >>= 4);
481bf3b
   else
011fe81
@@ -850,6 +850,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
481bf3b
 	{
481bf3b
 	case 'p':
481bf3b
 	case 'x':
481bf3b
+	case 'X':
481bf3b
 	case 'u':
481bf3b
 	case 'd':
481bf3b
 	case 'c':
011fe81
@@ -930,6 +931,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
481bf3b
       switch (c)
481bf3b
 	{
481bf3b
 	case 'x':
481bf3b
+	case 'X':
481bf3b
 	case 'u':
481bf3b
 	  args->ptr[curn].type = UNSIGNED_INT + longfmt;
481bf3b
 	  break;
011fe81
@@ -1067,6 +1069,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
481bf3b
 	  c = 'x';
481bf3b
 	  /* Fall through. */
481bf3b
 	case 'x':
481bf3b
+	case 'X':
481bf3b
 	case 'u':
481bf3b
 	case 'd':
481bf3b
 	  {
481bf3b
-- 
37b39b7
1.9.3
481bf3b