]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-resp.c
Fix spaces
[tcpdump] / print-resp.c
index bec3858efa13f52a75e22aab307125677c605f43..47f1eb3d9f88bbb662fe12919205e0187dbe9a1f 100644 (file)
 /* \summary: REdis Serialization Protocol (RESP) printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
 #include "netdissect.h"
 #include <limits.h>
 #include <string.h>
@@ -42,7 +42,6 @@
 
 #include "extract.h"
 
-static const char tstr[] = " [|RESP]";
 
 /*
  * For information regarding RESP, see: http://redis.io/topics/protocol
@@ -136,7 +135,7 @@ static int resp_get_length(netdissect_options *, const u_char *, int, const u_ch
             /*                                   \
              * Have we hit the end of data?      \
              */                                  \
-            if (_len == 0 || !ND_TTEST(*_ptr)) { \
+            if (_len == 0 || !ND_TTEST_1(_ptr)) {\
                 /*                               \
                  * Yes.  Have we seen a \r       \
                  * or \n?                        \
@@ -205,7 +204,7 @@ static int resp_get_length(netdissect_options *, const u_char *, int, const u_ch
  */
 #define RESP_PRINT_SEGMENT(_ndo, _bp, _len)            \
     ND_PRINT(" \"");                                   \
-    if (fn_printn(_ndo, _bp, _len, _ndo->ndo_snapend)) \
+    if (nd_printn(_ndo, _bp, _len, _ndo->ndo_snapend)) \
         goto trunc;                                    \
     fn_print_char(_ndo, '"');
 
@@ -214,6 +213,7 @@ resp_print(netdissect_options *ndo, const u_char *bp, u_int length)
 {
     int ret_len = 0, length_cur = length;
 
+    ndo->ndo_protocol = "resp";
     if(!bp || length <= 0)
         return;
 
@@ -237,7 +237,7 @@ resp_print(netdissect_options *ndo, const u_char *bp, u_int length)
     return;
 
 trunc:
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
 }
 
 static int