]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-telnet.c
Fix spaces
[tcpdump] / print-telnet.c
index f0604054f4e7b6d34d264f2be1f65142e1150475..3bfb19a2f77362b57c83ebc5cac72b83d9b81168 100644 (file)
 /* \summary: Telnet option printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
 
 #include <stdio.h>
 
 #include "netdissect.h"
 #include "extract.h"
 
-static const char tstr[] = " [|telnet]";
 
 #define TELCMDS
 #define TELOPTS
@@ -382,7 +381,7 @@ numstr(int x)
 {
        static char buf[20];
 
-       snprintf(buf, sizeof(buf), "%#x", x);
+       nd_snprintf(buf, sizeof(buf), "%#x", x);
        return buf;
 }
 
@@ -398,7 +397,8 @@ telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print)
                if (length < 1) \
                        goto pktend; \
                ND_TCHECK_1(sp); \
-               c = *sp++; \
+               c = EXTRACT_U_1(sp); \
+               sp++; \
                length--; \
        } while (0)
 
@@ -500,7 +500,7 @@ done:
        return sp - osp;
 
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
 pktend:
        return -1;
 #undef FETCH
@@ -513,6 +513,7 @@ telnet_print(netdissect_options *ndo, const u_char *sp, u_int length)
        const u_char *osp;
        int l;
 
+       ndo->ndo_protocol = "telnet";
        osp = sp;
 
        ND_TCHECK_1(sp);
@@ -554,5 +555,5 @@ telnet_print(netdissect_options *ndo, const u_char *sp, u_int length)
        }
        return;
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
 }