]>
git.saurik.com Git - apple/network_cmds.git/blob - pcap/etherent.c
3b2347e97976d3d63070ad69a95f007c95edcbaa
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
24 /* $OpenBSD: etherent.c,v 1.5 1996/09/16 02:33:04 tholo Exp $ */
27 * Copyright (c) 1990, 1993, 1994, 1995
28 * The Regents of the University of California. All rights reserved.
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that: (1) source code distributions
32 * retain the above copyright notice and this paragraph in its entirety, (2)
33 * distributions including binary code include the above copyright notice and
34 * this paragraph in its entirety in the documentation or other materials
35 * provided with the distribution, and (3) all advertising materials mentioning
36 * features or use of this software display the following acknowledgement:
37 * ``This product includes software developed by the University of California,
38 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
39 * the University nor the names of its contributors may be used to endorse
40 * or promote products derived from this software without specific prior
42 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
43 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
44 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
48 "@(#) Header: etherent.c,v 1.18 95/10/07 03:08:12 leres Exp (LBL)";
51 #include <sys/types.h>
56 #include <pcap-namedb.h>
60 #ifdef HAVE_OS_PROTO_H
66 static __inline
int xdtoi(int);
67 static __inline
int skip_space(FILE *);
68 static __inline
int skip_line(FILE *);
70 /* Hex digit to integer. */
91 } while (isspace(c
) && c
!= '\n');
104 while (c
!= '\n' && c
!= EOF
);
109 struct pcap_etherent
*
110 pcap_next_etherent(FILE *fp
)
112 register int c
, d
, i
;
114 static struct pcap_etherent e
;
116 memset((char *)&e
, 0, sizeof(e
));
123 /* If this is a comment, or first thing on line
124 cannot be etehrnet address, skip the line. */
130 /* must be the start of an address */
131 for (i
= 0; i
< 6; i
+= 1) {
147 /* Must be whitespace */
154 /* hit end of line... */
165 /* Use 'd' to prevent buffer overflow. */
166 d
= sizeof(e
.name
) - 1;
170 } while (!isspace(c
) && c
!= EOF
&& --d
> 0);
173 /* Eat trailing junk */