]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Assume that u_int64_t is defined, along with PRI[dux]64, as per the
authorguy <guy>
Sat, 17 Apr 2004 08:56:14 +0000 (08:56 +0000)
committerguy <guy>
Sat, 17 Apr 2004 08:56:14 +0000 (08:56 +0000)
recent configure script changes.

On UN*X, include <inttypes.h> in "tcpdump-stdinc.h" if it defines the
PRI[duxo]64 macros.

print-nfs.c
tcpdump-stdinc.h

index 0e7bdb5ab657936f5cd5109677c1f8bc80391d4c..fd70090c027b5e18c874f349c3f819eec6c857a5 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.101 2003-11-16 09:36:30 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.102 2004-04-17 08:56:14 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -162,8 +162,8 @@ static struct tok type2str[] = {
  * try to make the best of it. The integer stored as 2 consecutive XDR
  * encoded 32-bit integers, to which a pointer is passed.
  *
- * Assume that a system that has INT64_FORMAT defined, has a 64-bit
- * integer datatype and can print it.
+ * We assume that PRId64, PRIu64, and PRIx64 are defined, and that
+ * u_int64_t is defined.
  */
 
 #define UNSIGNED 0
@@ -172,42 +172,23 @@ static struct tok type2str[] = {
 
 static int print_int64(const u_int32_t *dp, int how)
 {
-#ifdef INT64_FORMAT
        u_int64_t res;
 
        res = ((u_int64_t)EXTRACT_32BITS(&dp[0]) << 32) | (u_int64_t)EXTRACT_32BITS(&dp[1]);
        switch (how) {
        case SIGNED:
-               printf(INT64_FORMAT, res);
+               printf("%" PRId64, res);
                break;
        case UNSIGNED:
-               printf(U_INT64_FORMAT, res);
+               printf("%" PRIu64, res);
                break;
        case HEX:
-               printf(HEX_INT64_FORMAT, res);
+               printf("%" PRIx64, res);
                break;
        default:
                return (0);
        }
-#else
-       u_int32_t high;
-
-       high = EXTRACT_32BITS(&dp[0]);
-
-       switch (how) {
-       case SIGNED:
-       case UNSIGNED:
-       case HEX:
-               if (high != 0)
-                       printf("0x%x%08x", high, EXTRACT_32BITS(&dp[1]));
-               else
-                       printf("0x%x", EXTRACT_32BITS(&dp[1]));
-               break;
-       default:
-               return (0);
-       }
-#endif
-       return 1;
+       return (1);
 }
 
 static void
index 1f300bc2bb4342bf9f46e51d5af08185580e2b44..c0b920c89a4364d780350dcd867bcc4329de464f 100644 (file)
@@ -29,7 +29,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  *
- * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.8 2003-11-16 09:57:04 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/tcpdump-stdinc.h,v 1.9 2004-04-17 08:56:15 guy Exp $ (LBL)
  */
 
 /*
@@ -95,6 +95,9 @@ typedef short ino_t;
 #include <ctype.h>
 #include <unistd.h>
 #include <netdb.h>
+#ifdef INTTYPES_H_DEFINES_FORMATS
+#include <inttypes.h>
+#endif
 #include <sys/param.h>
 #include <sys/types.h>                 /* concession to AIX */
 #include <sys/time.h>