#define DP_F_UNSIGNED (1 << 6)
/* Conversion Flags */
-#define DP_C_SHORT 1
-#define DP_C_LONG 2
-#define DP_C_LDOUBLE 3
+#define DP_C_SHORT 1
+#define DP_C_LONG 2
+#define DP_C_LONGLONG 3
+#define DP_C_LDOUBLE 4
#define char_to_int(p) (p - '0')
#undef MAX
state = DP_S_MOD;
break;
case DP_S_MOD:
- /* Currently, we don't support Long Long, bummer */
switch (ch)
{
case 'h':
case 'l':
cflags = DP_C_LONG;
ch = *format++;
+ if (ch == 'l')
+ {
+ cflags = DP_C_LONGLONG;
+ ch = *format++;
+ }
break;
case 'L':
cflags = DP_C_LDOUBLE;
value = va_arg (args, short int);
else if (cflags == DP_C_LONG)
value = va_arg (args, long int);
+ else if (cflags == DP_C_LONGLONG)
+ value = va_arg (args, long long int);
else
value = va_arg (args, int);
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
value = va_arg (args, unsigned short int);
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
+ else if (cflags == DP_C_LONGLONG)
+ value = va_arg (args, unsigned long long int);
else
value = va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
value = va_arg (args, unsigned short int);
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
+ else if (cflags == DP_C_LONGLONG)
+ value = va_arg (args, unsigned long long int);
else
value = va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
value = va_arg (args, unsigned short int);
else if (cflags == DP_C_LONG)
value = va_arg (args, unsigned long int);
+ else if (cflags == DP_C_LONGLONG)
+ value = va_arg (args, unsigned long long int);
else
value = va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
break;
case 'p':
+ flags |= DP_F_UNSIGNED;
strvalue = va_arg (args, void *);
fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags);
break;
num = va_arg (args, long int *);
*num = currlen;
}
+ else if (cflags == DP_C_LONGLONG)
+ {
+ long long int *num;
+ num = va_arg (args, long long int *);
+ *num = currlen;
+ }
else
{
int *num;
int padlen, strln; /* amount to pad */
int cnt = 0;
- if (value == 0)
+ if (!value)
{
value = "<NULL>";
}