]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-telnet.c
Fix the pointer tests in the non-ndoified TTEST2() macro as well.
[tcpdump] / print-telnet.c
index 308e924897135390ea58da17b32cc0391cf68962..4911e5caf2385375daae78d32a592216342f8c7c 100644 (file)
 #endif
 
 #ifndef lint
-static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.19 2002-06-11 17:08:57 itojun Exp $";
+static const char rcsid[] _U_ =
+     "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.24 2003-12-29 11:05:10 hannes Exp $";
 #endif
 
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <ctype.h>
-
-#include <netinet/in.h>
+#include <tcpdump-stdinc.h>
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 
 #include "interface.h"
@@ -115,7 +109,8 @@ numstr(int x)
 static int
 telnet_parse(const u_char *sp, u_int length, int print)
 {
-       int i, c, x;
+       int i, x;
+       u_int c;
        const u_char *osp, *p;
 #define FETCH(c, sp, length) \
        do { \
@@ -161,7 +156,7 @@ telnet_parse(const u_char *sp, u_int length, int print)
                        break;
                /* IAC SB .... IAC SE */
                p = sp;
-               while (length > p + 1 - sp) {
+               while (length > (u_int)(p + 1 - sp)) {
                        if (p[0] == IAC && p[1] == SE)
                                break;
                        p++;
@@ -249,7 +244,7 @@ telnet_print(const u_char *sp, u_int length)
                if (Xflag && 2 < vflag) {
                        if (first)
                                printf("\nTelnet:");
-                       hex_print_with_offset(sp, l, sp - osp);
+                       hex_print_with_offset("\n", sp, l, sp - osp);
                        if (l > 8)
                                printf("\n\t\t\t\t");
                        else