]> The Tcpdump Group git mirrors - tcpdump/blobdiff - util.c
Add missing af.c and af.h files.
[tcpdump] / util.c
diff --git a/util.c b/util.c
index bee808c26b329bfed05b29d9968513ff9a4d95f2..5746b0949c14fb778621563f38ebd1246a63577f 100644 (file)
--- a/util.c
+++ b/util.c
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.105 2006-01-22 19:06:37 gianluca Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/util.c,v 1.107 2006-02-08 16:18:56 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -526,10 +526,12 @@ read_infile(char *fname)
 }
 
 void
-safeputs(const char *s)
+safeputs(const char *s, int maxlen)
 {
-       while (*s) {
+    int idx = 0;
+       while (*s && idx < maxlen) {
                safeputchar(*s);
+                idx++;
                s++;
        }
 }
@@ -543,5 +545,5 @@ safeputchar(int c)
        if (ch < 0x80 && isprint(ch))
                printf("%c", ch);
        else
-               printf("\\%03o", ch);
+               printf("\\0x%02x", ch);
 }