1/* |
2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 |
3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and 9 * this paragraph in its entirety in the documentation or other materials 10 * provided with the distribution, and (3) all advertising materials mentioning --- 7 unchanged lines hidden (view full) --- 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * Format and print AppleTalk packets. 22 */ 23 24#ifndef lint 25static const char rcsid[] = |
26 "@(#) $Header: print-atalk.c,v 1.48 97/05/28 12:50:58 leres Exp $ (LBL)"; |
27#endif 28 29#include <sys/param.h> 30#include <sys/time.h> 31#include <sys/socket.h> 32 33#if __STDC__ 34struct mbuf; --- 15 unchanged lines hidden (view full) --- 50#include <stdlib.h> 51#include <string.h> 52 53#include "interface.h" 54#include "addrtoname.h" 55#include "ethertype.h" 56#include "extract.h" /* must come after interface.h */ 57#include "appletalk.h" |
58#include "savestr.h" |
59 60static struct tok type2str[] = { 61 { ddpRTMP, "rtmp" }, 62 { ddpRTMPrequest, "rtmpReq" }, 63 { ddpECHO, "echo" }, 64 { ddpIP, "IP" }, 65 { ddpARP, "ARP" }, 66 { ddpKLAP, "KLAP" }, --- 341 unchanged lines hidden (view full) --- 408 409 if (cp >= (const char *)ep) { 410 fputs(tstr, stdout); 411 return (0); 412 } 413 length = *cp++; 414 415 /* Spec says string can be at most 32 bytes long */ |
416 if (length > 32) { 417 (void)printf("[len=%u]", length); |
418 return (0); 419 } |
420 while ((int)--length >= 0) { |
421 if (cp >= (char *)ep) { 422 fputs(tstr, stdout); 423 return (0); 424 } 425 putchar(*cp++); 426 } 427 return (cp); 428} --- 149 unchanged lines hidden --- |