X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/38082cac3604a182183c46c19c17d7e5504685a2..d29f3dab95d8b28a62848fcb043b8ba40348bc3d:/print-zephyr.c diff --git a/print-zephyr.c b/print-zephyr.c index d8c608e7..a08ab04c 100644 --- a/print-zephyr.c +++ b/print-zephyr.c @@ -1,6 +1,8 @@ /* * Decode and print Zephyr packets. * + * http://web.mit.edu/zephyr/doc/protocol + * * Copyright (c) 2001 Nickolai Zeldovich * All rights reserved. * @@ -18,11 +20,15 @@ * PURPOSE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + #include -#include #include #include -#include #include "interface.h" @@ -39,7 +45,7 @@ struct z_packet { char *inst; char *opcode; char *sender; - char *recipient; + const char *recipient; char *format; int cksum; int multi; @@ -47,7 +53,7 @@ struct z_packet { /* Other fields follow here.. */ }; -enum { +enum z_packet_type { Z_PACKET_UNSAFE = 0, Z_PACKET_UNACKED, Z_PACKET_ACKED, @@ -57,9 +63,9 @@ enum { Z_PACKET_SERVNAK, Z_PACKET_CLIENTACK, Z_PACKET_STAT -} z_packet_type; +}; -static struct tok z_types[] = { +static const struct tok z_types[] = { { Z_PACKET_UNSAFE, "unsafe" }, { Z_PACKET_UNACKED, "unacked" }, { Z_PACKET_ACKED, "acked" }, @@ -96,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 = "*"; @@ -113,7 +119,7 @@ str_to_lower(char *string) string = z_buf; while (*string) { - *string = tolower(*string); + *string = tolower((unsigned char)(*string)); string++; } @@ -129,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;