]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-zephyr.c
Update Gisle Vanem's address.
[tcpdump] / print-zephyr.c
index d8c608e735524a9f3aa03feba43b2ccb9069ee32..7c52e65406589f2c12a86e84a4dc011edf435096 100644 (file)
@@ -1,6 +1,8 @@
 /*
  * Decode and print Zephyr packets.
  *
+ *     http://web.mit.edu/zephyr/doc/protocol
+ *
  * Copyright (c) 2001 Nickolai Zeldovich <[email protected]>
  * All rights reserved.
  *
  * PURPOSE.
  */
 
+#ifndef lint
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.10 2007-08-09 18:47:27 hannes Exp $";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
 #include <stdio.h>
-#include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
-#include <sys/types.h>
 
 #include "interface.h"
 
@@ -39,7 +50,7 @@ struct z_packet {
     char *inst;
     char *opcode;
     char *sender;
-    char *recipient;
+    const char *recipient;
     char *format;
     int cksum;
     int multi;
@@ -47,7 +58,7 @@ struct z_packet {
     /* Other fields follow here.. */
 };
 
-enum {
+enum z_packet_type {
     Z_PACKET_UNSAFE = 0,
     Z_PACKET_UNACKED,
     Z_PACKET_ACKED,
@@ -57,7 +68,7 @@ enum {
     Z_PACKET_SERVNAK,
     Z_PACKET_CLIENTACK,
     Z_PACKET_STAT
-} z_packet_type;
+};
 
 static struct tok z_types[] = {
     { Z_PACKET_UNSAFE,         "unsafe" },
@@ -96,7 +107,7 @@ parse_field(char **pptr, int *len)
 }
 
 static const char *
-z_triple(char *class, char *inst, char *recipient)
+z_triple(char *class, char *inst, const char *recipient)
 {
     if (!*recipient)
        recipient = "*";
@@ -113,7 +124,7 @@ str_to_lower(char *string)
 
     string = z_buf;
     while (*string) {
-       *string = tolower(*string);
+       *string = tolower((unsigned char)(*string));
        string++;
     }
 
@@ -129,6 +140,15 @@ zephyr_print(const u_char *cp, int length)
     char *s;
     int lose = 0;
 
+    /* squelch compiler warnings */
+
+    z.kind = 0;
+    z.class = 0;
+    z.inst = 0;
+    z.opcode = 0;
+    z.sender = 0;
+    z.recipient = 0;
+
 #define PARSE_STRING                           \
        s = parse_field(&parse, &parselen);     \
        if (!s) lose = 1;