* missing. Some systems only have snprintf() but not vsnprintf(), so
* the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
*
+ * Ben Lindstrom <mouring@pconline.com> 09/27/00 for OpenSSH
+ * Welcome to the world of %lld and %qd support. With other
+ * long long support. This is needed for sftp-server to work
+ * right.
**************************************************************/
#include "config.h"
#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_LDOUBLE 3
+#define DP_C_LONG_LONG 4
#define char_to_int(p) (p - '0')
#ifndef 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_LONG_LONG;
+ ch = *format++;
+ }
break;
+ case 'q':
+ cflags = DP_C_LONG_LONG;
+ ch = *format++;
+ break;
case 'L':
cflags = DP_C_LDOUBLE;
ch = *format++;
value = va_arg (args, short int);
else if (cflags == DP_C_LONG)
value = va_arg (args, long int);
+ else if (cflags == DP_C_LONG_LONG)
+ value = va_arg (args, long long);
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_LONG_LONG)
+ value = va_arg (args, unsigned long long);
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_LONG_LONG)
+ value = va_arg (args, unsigned long long);
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_LONG_LONG)
+ value = va_arg (args, unsigned long long);
else
value = va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
num = va_arg (args, long int *);
*num = currlen;
}
+ else if (cflags == DP_C_LONG_LONG)
+ {
+ long long *num;
+ num = va_arg (args, long long *);
+ *num = currlen;
+ }
else
{
int *num;
"%+22.33d",
"%01.3d",
"%4d",
+ "%lld",
+ "%qd",
NULL
};
- long int_nums[] = { -1, 134, 91340, 341, 0203, 0};
+ long long int_nums[] = { -1, 134, 91340, 341, 0203, 0, 9999999 };
int x, y;
int fail = 0;
int num = 0;