print-atalk.c (26183) | print-atalk.c (39300) |
---|---|
1/* | 1/* |
2 * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 | 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[] = | 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.45 96/12/10 23:24:07 leres Exp $ (LBL)"; | 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" | 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" |
|
58 59static struct tok type2str[] = { 60 { ddpRTMP, "rtmp" }, 61 { ddpRTMPrequest, "rtmpReq" }, 62 { ddpECHO, "echo" }, 63 { ddpIP, "IP" }, 64 { ddpARP, "ARP" }, 65 { ddpKLAP, "KLAP" }, --- 341 unchanged lines hidden (view full) --- 407 408 if (cp >= (const char *)ep) { 409 fputs(tstr, stdout); 410 return (0); 411 } 412 length = *cp++; 413 414 /* Spec says string can be at most 32 bytes long */ | 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 */ |
415 if (length < 0 || length > 32) { 416 (void)printf("[len=%d]", length); | 416 if (length > 32) { 417 (void)printf("[len=%u]", length); |
417 return (0); 418 } | 418 return (0); 419 } |
419 while (--length >= 0) { | 420 while ((int)--length >= 0) { |
420 if (cp >= (char *)ep) { 421 fputs(tstr, stdout); 422 return (0); 423 } 424 putchar(*cp++); 425 } 426 return (cp); 427} --- 149 unchanged lines hidden --- | 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 --- |