Blame SOURCES/0098-Add-X-option-to-printf-functions.patch

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