Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/smallprint.c')
-rw-r--r--winsup/cygwin/smallprint.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/winsup/cygwin/smallprint.c b/winsup/cygwin/smallprint.c
index d6be72a6c..247fcf942 100644
--- a/winsup/cygwin/smallprint.c
+++ b/winsup/cygwin/smallprint.c
@@ -1,6 +1,6 @@
/* smallprint.c: small print routines for WIN32
- Copyright 1996, 1998, 2000, 2001 Red Hat, Inc.
+ Copyright 1996, 1998, 2000, 2001, 2002 Red Hat, Inc.
This file is part of Cygwin.
@@ -19,11 +19,11 @@ int __small_sprintf (char *dst, const char *fmt,...);
int __small_vsprintf (char *dst, const char *fmt, va_list ap);
static char *
-rn (char *dst, int base, int dosign, int val, int len, int pad)
+rn (char *dst, int base, int dosign, long long val, int len, int pad)
{
- /* longest number is 4294967295, 10 digits */
+ /* longest number is ULLONG_MAX, 18446744073709551615, 20 digits */
unsigned uval;
- char res[10];
+ char res[20];
static const char str[16] = "0123456789ABCDEF";
int l = 0;
@@ -126,9 +126,18 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
case 'd':
dst = rn (dst, 10, addsign, va_arg (ap, int), len, pad);
break;
+ case 'D':
+ dst = rn (dst, 10, addsign, va_arg (ap, long long), len, pad);
+ break;
case 'u':
dst = rn (dst, 10, 0, va_arg (ap, int), len, pad);
break;
+ case 'U':
+ dst = rn (dst, 10, 0, va_arg (ap, long long), len, pad);
+ break;
+ case 'o':
+ dst = rn (dst, 8, 0, va_arg (ap, unsigned), len, pad);
+ break;
case 'p':
*dst++ = '0';
*dst++ = 'x';
@@ -136,6 +145,9 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
case 'x':
dst = rn (dst, 16, 0, va_arg (ap, int), len, pad);
break;
+ case 'X':
+ dst = rn (dst, 16, 0, va_arg (ap, long long), len, pad);
+ break;
case 'P':
if (!GetModuleFileName (NULL, tmp, MAX_PATH))
s = "cygwin program";