Line | |
---|
1 | /*
|
---|
2 | ethern2h.c
|
---|
3 |
|
---|
4 | Created: Nov 12, 1992 by Philip Homburg
|
---|
5 | */
|
---|
6 |
|
---|
7 | #include <sys/types.h>
|
---|
8 | #include <stdio.h>
|
---|
9 | #include <string.h>
|
---|
10 | #include <net/gen/ether.h>
|
---|
11 | #include <net/gen/if_ether.h>
|
---|
12 |
|
---|
13 | int
|
---|
14 | ether_ntohost(hostname, e)
|
---|
15 | char *hostname;
|
---|
16 | struct ether_addr *e;
|
---|
17 | {
|
---|
18 | FILE *etherf;
|
---|
19 | char b[256];
|
---|
20 | struct ether_addr e_tmp;
|
---|
21 |
|
---|
22 | etherf= fopen(_PATH_ETHERS, "r");
|
---|
23 | if (etherf == NULL)
|
---|
24 | return 1;
|
---|
25 |
|
---|
26 | while(fgets(b, sizeof(b), etherf) != NULL)
|
---|
27 | {
|
---|
28 | if (ether_line(b, &e_tmp, hostname) == 0 &&
|
---|
29 | memcmp(&e_tmp, e, sizeof(e_tmp)) == 0)
|
---|
30 | {
|
---|
31 | fclose(etherf);
|
---|
32 | return 0;
|
---|
33 | }
|
---|
34 | }
|
---|
35 | fclose(etherf);
|
---|
36 | return 1;
|
---|
37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.