typedef unsigned long long uint64_t;
typedef long long int64_t;
#endif
+
+ /*
+ * We have _strtoi64(). Use that for strtoint64_t().
+ */
+ #define strtoint64_t _strtoi64
#endif
/*
#ifdef _MSC_VER
/*
* Compiler is MSVC.
- *
+ */
+ #if _MSC_VER >= 1800
+ /*
+ * VS 2013 or newer; we have strtoll(). Use that for strtoint64_t().
+ */
+ #define strtoint64_t strtoll
+ #else
+ /*
+ * Earlier VS; we don't have strtoll(), but we do have
+ * _strtoi64(). Use that for strtoint64_t().
+ */
+ #define strtoint64_t _strtoi64
+ #endif
+
+ /*
* Microsoft's documentation doesn't speak of LL as a valid
* suffix for 64-bit integers, so we'll just use i64.
*/
#define INT64_T_CONSTANT(constant) (constant##i64)
#else
/*
- * Non-Microsoft compiler; assume LL works.
+ * Non-Microsoft compiler.
+ *
+ * XXX - should we use strtoll or should we use _strtoi64()?
+ */
+ #define strtoint64_t strtoll
+
+ /*
+ * Assume LL works.
*/
#define INT64_T_CONSTANT(constant) (constant##LL)
#endif
#include <arpa/inet.h>
+/*
+ * Assume all UN*Xes have strtoll(), and use it for strtoint64_t().
+ */
+#define strtoint64_t strtoll
+
/*
* Assume LL works.
*/
#endif
static int Bflag; /* buffer size */
-#ifdef HAVE_PCAP_FTELL64
+#ifdef HAVE_PCAP_DUMP_FTELL64
static int64_t Cflag; /* rotate dump files after this many bytes */
#else
static long Cflag; /* rotate dump files after this many bytes */
case 'C':
errno = 0;
-#ifdef HAVE_PCAP_FTELL64
+#ifdef HAVE_PCAP_DUMP_FTELL64
Cflag = strtoint64_t(optarg, &endp, 10);
#else
Cflag = strtol(optarg, &endp, 10);
/*
* Will multiplying it by 1000000 overflow?
*/
-#ifdef HAVE_PCAP_FTELL64
+#ifdef HAVE_PCAP_DUMP_FTELL64
if (Cflag > INT64_T_CONSTANT(0x7fffffffffffffffU) / 1000000)
#else
if (Cflag > LONG_MAX / 1000000)
* file could put it over Cflag.
*/
if (Cflag != 0) {
-#ifdef HAVE_PCAP_FTELL64
+#ifdef HAVE_PCAP_DUMP_FTELL64
int64_t size = pcap_dump_ftell64(dump_info->p);
#else
/*