Added support for printing hex (heheh... doesn't work right, but better than nothing)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1628 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-11-30 00:47:59 +00:00
parent fad8fe8cc8
commit 64444d7479

View file

@ -88,7 +88,54 @@ retry:
*buffer++ = _int;
tokens++;
break;
case 'x':
_int = va_arg(vargs, int);
if (_int < 0)
{
if (--maxlen < 0)
{*buffer++='\0';return tokens;}
*buffer++ = '-';
_int *= -1;
}
i = sizeof(tempbuffer)-2;
tempbuffer[sizeof(tempbuffer)-1] = '\0';
while(_int)
{
tempbuffer[i] = _int%16 + '0';
_int/=16;
i--;
}
string = tempbuffer+i+1;
if (!*string)
{
i=61;
string = tempbuffer+i+1;
string[0] = '0';
string[1] = '\0';
}
precision -= 62-i;
while (precision>0)
{
string--;
if (use0s)
*string = '0';
else
*string = ' ';
precision--;
}
while (*string)
{
if (--maxlen < 0)
{*buffer++='\0';return tokens;}
*buffer++ = *string++;
}
tokens++;
break;
case 'd':
case 'u':
case 'i':
_int = va_arg(vargs, int);
if (_int < 0)