summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@samba.org>1999-03-25 20:21:01 +0000
committerAlexandre Oliva <oliva@samba.org>1999-03-25 20:21:01 +0000
commit1db113b0a2a81a0f37c55aa49517dc64f0578474 (patch)
tree3f527cd561cf01e2b851eb62732afa9f41492f2f /source3/lib
parentfa01e8764c9da8d0e37f07dbe1a3b116a0640acc (diff)
downloadsamba-1db113b0a2a81a0f37c55aa49517dc64f0578474.tar.gz
samba-1db113b0a2a81a0f37c55aa49517dc64f0578474.tar.bz2
samba-1db113b0a2a81a0f37c55aa49517dc64f0578474.zip
* client/client.c (dir_total): use SMB_BIG_UINT
* client/clitar.c (ttarf): ditto * * lib/snprintf.c: support long longs; adapted from Cloyce D. Spradling's patch <cloyce@headgear.org> (This used to be commit 29581f8486e221f41669c2ca268c282f36a496ce)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/snprintf.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source3/lib/snprintf.c b/source3/lib/snprintf.c
index 8bbc67a3b6..5798732643 100644
--- a/source3/lib/snprintf.c
+++ b/source3/lib/snprintf.c
@@ -91,6 +91,12 @@
#define LDOUBLE double
#endif
+#ifdef HAVE_LONG_LONG
+#define LLONG long long
+#else
+#define LLONG long
+#endif
+
/*int snprintf (char *str, size_t count, const char *fmt, ...);*/
/*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/
@@ -131,6 +137,7 @@ static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c );
#define DP_C_SHORT 1
#define DP_C_LONG 2
#define DP_C_LDOUBLE 3
+#define DP_C_LLONG 4
#define char_to_int(p) (p - '0')
#define MAX(p,q) ((p >= q) ? p : q)
@@ -138,7 +145,7 @@ static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c );
static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
{
char ch;
- long value;
+ LLONG value;
LDOUBLE fvalue;
char *strvalue;
int min;
@@ -237,7 +244,6 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
state = DP_S_MOD;
break;
case DP_S_MOD:
- /* Currently, we don't support Long Long, bummer */
switch (ch)
{
case 'h':
@@ -247,6 +253,10 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'l':
cflags = DP_C_LONG;
ch = *format++;
+ if (ch == 'l') { /* It's a long long */
+ cflags = DP_C_LLONG;
+ ch = *format++;
+ }
break;
case 'L':
cflags = DP_C_LDOUBLE;
@@ -266,6 +276,8 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
value = va_arg (args, short int);
else if (cflags == DP_C_LONG)
value = va_arg (args, long int);
+ else if (cflags == DP_C_LLONG)
+ value = va_arg (args, LLONG);
else
value = va_arg (args, int);
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
@@ -276,6 +288,8 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
value = va_arg (args, unsigned short int);
else if (cflags == DP_C_LONG)
value = (long)va_arg (args, unsigned long int);
+ else if (cflags == DP_C_LLONG)
+ value = (long)va_arg (args, unsigned LLONG);
else
value = (long)va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
@@ -286,6 +300,8 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
value = va_arg (args, unsigned short int);
else if (cflags == DP_C_LONG)
value = (long)va_arg (args, unsigned long int);
+ else if (cflags == DP_C_LLONG)
+ value = (LLONG)va_arg (args, unsigned LLONG);
else
value = (long)va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
@@ -298,6 +314,8 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
value = va_arg (args, unsigned short int);
else if (cflags == DP_C_LONG)
value = (long)va_arg (args, unsigned long int);
+ else if (cflags == DP_C_LLONG)
+ value = (LLONG)va_arg (args, unsigned LLONG);
else
value = (long)va_arg (args, unsigned int);
fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
@@ -352,6 +370,12 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
num = va_arg (args, long int *);
*num = (long int)currlen;
}
+ else if (cflags == DP_C_LLONG)
+ {
+ LLONG *num;
+ num = va_arg (args, LLONG *);
+ *num = (LLONG)currlen;
+ }
else
{
int *num;