* causing nast effects.
**************************************************************/
-/*static char _id[] = "$Id: snprintf.c,v 1.9 1998/10/07 17:12:52 momjian Exp $";*/
+/*static char _id[] = "$Id: snprintf.c,v 1.10 1998/10/08 00:34:47 momjian Exp $";*/
static char *end;
static int SnprfOverflow;
dopr(char *buffer, const char *format,...)
{
int ch;
+#ifdef HAVE_LONG_INT_64
+ long_long value;
+#else
long value;
+#endif
int longflag = 0;
int longlongflag = 0;
int pointflag = 0;
case 'U':
/* fmtnum(value,base,dosign,ljust,len,zpad) */
if (longflag)
- value = va_arg(args, long);
+ {
+#ifdef HAVE_LONG_INT_64
+ if (longlongflag)
+ value = va_arg(args, long_long);
+ else
+#endif
+ value = va_arg(args, long);
+ }
else
value = va_arg(args, int);
fmtnum(value, 10, 0, ljust, len, zpad);
case 'O':
/* fmtnum(value,base,dosign,ljust,len,zpad) */
if (longflag)
+ {
+#ifdef HAVE_LONG_INT_64
+ if (longlongflag)
+ value = va_arg(args, long_long);
+ else
+#endif
value = va_arg(args, long);
+ }
else
value = va_arg(args, int);
fmtnum(value, 8, 0, ljust, len, zpad);
break;
case 'x':
if (longflag)
+ {
+#ifdef HAVE_LONG_INT_64
+ if (longlongflag)
+ value = va_arg(args, long_long);
+ else
+#endif
value = va_arg(args, long);
+ }
else
value = va_arg(args, int);
fmtnum(value, 16, 0, ljust, len, zpad);
break;
case 'X':
if (longflag)
- value = va_arg(args, long);
+ {
+#ifdef HAVE_LONG_INT_64
+ if (longlongflag)
+ value = va_arg(args, long_long);
+ else
+#endif
+ value = va_arg(args, long);
+ }
else
value = va_arg(args, int);
fmtnum(value, -16, 0, ljust, len, zpad);
static void
fmtnum(value, base, dosign, ljust, len, zpad)
-long value;
+#ifdef HAVE_LONG_INT_64
+ long_long value;
+#else
+ long value;
+#endif
int base,
dosign,
ljust,
zpad;
{
int signvalue = 0;
+#ifdef HAVE_LONG_INT_64
+ unsigned long long uvalue;
+#else
unsigned long uvalue;
+#endif
char convert[20];
int place = 0;
int padlen = 0; /* amount to pad */