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