]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-zephyr.c
CARP: NDOize
[tcpdump] / print-zephyr.c
index f526f07ceaac8b528e8e3d59403d5175de9fd24c..a08ab04ca253df61581223a4be09c0eada14935d 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[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-zephyr.c,v 1.3 2002-03-05 11:33:25 guy 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"
 
@@ -48,7 +45,7 @@ struct z_packet {
     char *inst;
     char *opcode;
     char *sender;
-    char *recipient;
+    const char *recipient;
     char *format;
     int cksum;
     int multi;
@@ -68,7 +65,7 @@ enum z_packet_type {
     Z_PACKET_STAT
 };
 
-static struct tok z_types[] = {
+static const struct tok z_types[] = {
     { Z_PACKET_UNSAFE,         "unsafe" },
     { Z_PACKET_UNACKED,                "unacked" },
     { Z_PACKET_ACKED,          "acked" },
@@ -105,7 +102,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 = "*";
@@ -122,7 +119,7 @@ str_to_lower(char *string)
 
     string = z_buf;
     while (*string) {
-       *string = tolower(*string);
+       *string = tolower((unsigned char)(*string));
        string++;
     }
 
@@ -138,6 +135,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;