2005-06-23 Hollis Blanchard <hollis@penguinppc.org>

* kern/misc.c (grub_vsprintf): Add `longfmt'.  If format string
	contains `l' modifier, get a long from va_arg().
This commit is contained in:
hollisb 2005-06-23 23:13:57 +00:00
parent 50b5a0a793
commit e75d76e157
2 changed files with 17 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2005-06-23 Hollis Blanchard <hollis@penguinppc.org>
* kern/misc.c (grub_vsprintf): Add `longfmt'. If format string
contains `l' modifier, get a long from va_arg().
2005-06-23 Yoshinori K. Okuji <okuji@enbug.org>
* kern/mm.c (grub_free): If the next free block which is being

View File

@ -562,13 +562,14 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
char zerofill = ' ';
int rightfill = 0;
int n;
int longfmt = 0;
if (*fmt && *fmt =='-')
{
rightfill = 1;
fmt++;
}
p = (char *) fmt;
/* Read formatting parameters. */
while (*p && grub_isdigit (*p))
@ -600,6 +601,11 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
}
c = *fmt++;
if (c == 'l')
{
longfmt = 1;
c = *fmt++;
}
switch (c)
{
@ -610,7 +616,10 @@ grub_vsprintf (char *str, const char *fmt, va_list args)
case 'x':
case 'u':
case 'd':
n = va_arg (args, int);
if (longfmt)
n = va_arg (args, long);
else
n = va_arg (args, int);
grub_itoa (tmp, c, n);
if (!rightfill && grub_strlen (tmp) < format1)
write_fill (zerofill, format1 - grub_strlen (tmp));