All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Kiper <dkiper@net-space.pl>
To: Steve McIntyre <steve@einval.com>
Cc: The development of GNU GRUB <grub-devel@gnu.org>,
	Vladimir Serbinenko <phcoder@gmail.com>,
	Daniel Kiper <daniel.kiper@oracle.com>,
	Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>,
	Javier Martinez Canillas <javierm@redhat.com>
Subject: Re: [PATCH 2/3] Add %X option to printf functions
Date: Tue, 15 Oct 2019 16:26:47 +0200	[thread overview]
Message-ID: <20191015142647.y27plmamlosyc2qa@tomti.i.net-space.pl> (raw)
In-Reply-To: <20191005014716.GV5783@tack.einval.com>

On Sat, Oct 05, 2019 at 02:47:23AM +0100, Steve McIntyre wrote:
> On Sat, Oct 05, 2019 at 12:44:26AM +0200, Javier Martinez Canillas wrote:
> >From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
> >
> >The printf(3) function has support for the %X format specifier, to output
> >an unsigned hexadecimal integer in uppercase.
> >
> >This can be achived in GRUB using the %x format specifier in grub_printf()
> >and calling grub_toupper(), but it is more convenient if there is support
> >for %X in grub_printf().
> >
> >Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
> >Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> >---
> >
> > grub-core/kern/misc.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> >diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
> >index 3b633d51f4c..76e7fb22872 100644
> >--- a/grub-core/kern/misc.c
> >+++ b/grub-core/kern/misc.c
> >@@ -588,7 +588,7 @@ grub_divmod64 (grub_uint64_t n, grub_uint64_t d, grub_uint64_t *r)
> > static inline char *
> > grub_lltoa (char *str, int c, unsigned long long n)
> > {
> >-  unsigned base = (c == 'x') ? 16 : 10;
> >+  unsigned base = ((c == 'x') || (c == 'X')) ? 16 : 10;
> >   char *p;
> >
> >   if ((long long) n < 0 && c == 'd')
> >@@ -603,7 +603,7 @@ grub_lltoa (char *str, int c, unsigned long long n)
> >     do
> >       {
> > 	unsigned d = (unsigned) (n & 0xf);
> >-	*p++ = (d > 9) ? d + 'a' - 10 : d + '0';
> >+	*p++ = (d > 9) ? d + ((c == 'x') ? 'a' : 'A') - 10 : d + '0';
> >       }
> >     while (n >>= 4);
> >   else
> >@@ -676,6 +676,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
> > 	{
> > 	case 'p':
> > 	case 'x':
> >+	case 'X':
> > 	case 'u':
> > 	case 'd':
> > 	case 'c':
> >@@ -762,6 +763,7 @@ parse_printf_args (const char *fmt0, struct printf_args *args,
> >       switch (c)
> > 	{
> > 	case 'x':
> >+	case 'X':
> > 	case 'u':
> > 	  args->ptr[curn].type = UNSIGNED_INT + longfmt;
> > 	  break;
> >@@ -900,6 +902,7 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
> > 	  c = 'x';
> > 	  /* Fall through. */
> > 	case 'x':
> >+	case 'X':
> > 	case 'u':
> > 	case 'd':
> > 	  {
>
> Ummm, isn't this exactly the same patch that Colin Watson proposed and
> I reviewed back in March, as part of his changeset for UEFI?
>
> https://lists.gnu.org/archive/html/grub-devel/2019-03/msg00121.html
>
> Oh, that never got applied. :-(

Well, IIRC because the whole patch series was not taken... :-(((
I hope that this time we will take it.

Daniel


  parent reply	other threads:[~2019-10-15 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 22:44 [PATCH 0/3] Search for specific config files using UUID, MAC and IP Javier Martinez Canillas
2019-10-04 22:44 ` [PATCH 1/3] Set net_<interface>_client{id, uuid} variables from DHCP options Javier Martinez Canillas
2019-10-15 14:19   ` Daniel Kiper
2019-10-18  7:46     ` Javier Martinez Canillas
2019-10-04 22:44 ` [PATCH 2/3] Add %X option to printf functions Javier Martinez Canillas
2019-10-05  1:47   ` Steve McIntyre
2019-10-05  7:15     ` Javier Martinez Canillas
2019-10-15 14:26     ` Daniel Kiper [this message]
2019-10-15 14:24   ` Daniel Kiper
2019-10-04 22:44 ` [PATCH 3/3] Search for specific config files for netboot Javier Martinez Canillas
2019-10-15 14:35   ` Daniel Kiper
2019-10-15 14:37 ` [PATCH 0/3] Search for specific config files using UUID, MAC and IP Daniel Kiper
2019-10-18  8:00   ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191015142647.y27plmamlosyc2qa@tomti.i.net-space.pl \
    --to=dkiper@net-space.pl \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=javierm@redhat.com \
    --cc=pfsmorigo@br.ibm.com \
    --cc=phcoder@gmail.com \
    --cc=steve@einval.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.