summaryrefslogtreecommitdiff
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
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)
-rw-r--r--source3/client/client.c4
-rw-r--r--source3/client/clitar.c5
-rw-r--r--source3/lib/snprintf.c28
3 files changed, 31 insertions, 6 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 830a43287e..a4bcd462b1 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -101,7 +101,7 @@ int put_total_size = 0;
int put_total_time_ms = 0;
/* totals globals */
-int dir_total = 0;
+SMB_BIG_UINT dir_total = 0;
#define USENMB
@@ -430,7 +430,7 @@ static void cmd_dir(void)
do_dskattr();
- DEBUG(3, ("Total bytes listed: %d\n", dir_total));
+ DEBUG(3, ("Total bytes listed: %llu\n", dir_total));
}
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index fd43d37abb..b655b2d325 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -85,7 +85,8 @@ static uint16 attribute = aDIR | aSYSTEM | aHIDDEN;
#endif
static char *tarbuf, *buffer_p;
-static int tp, ntarf, tbufsiz, ttarf;
+static int tp, ntarf, tbufsiz;
+static SMB_BIG_UINT ttarf;
/* Incremental mode */
BOOL tar_inc=False;
/* Reset archive bit */
@@ -1486,7 +1487,7 @@ int process_tar(void)
free(tarbuf);
DEBUG(0, ("tar: dumped %d tar files\n", ntarf));
- DEBUG(0, ("Total bytes written: %d\n", ttarf));
+ DEBUG(0, ("Total bytes written: %llu\n", ttarf));
break;
}
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;