]>
git.ipfire.org Git - thirdparty/glibc.git/blob - nss/nss_files/files-ethers.c
290d931c9712a7a17c11a410bf3f8b58448f795e
1 /* Copyright (C) 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 #include <netinet/if_ether.h>
22 /* Because the `ethers' lookup does not fit so well in the scheme so
23 we define a dummy struct here which helps us to use the available
28 struct ether_addr e_addr
;
30 struct etherent_data
{};
32 #define ENTNAME etherent
33 #define DATABASE "ethers"
34 #include "files-parse.c"
37 /* Read the ethernet address: 6 x 8bit hexadecimal number. */
41 for (cnt
= 0; cnt
< 6; ++cnt
)
46 INT_FIELD (number
, ISCOLON
, 0, 16, (unsigned int))
48 INT_FIELD (number
, isspace
, 0, 16, (unsigned int))
52 result
->e_addr
.ether_addr_octet
[cnt
] = number
;
55 STRING_FIELD (result
->e_name
, isspace
, 1);
61 DB_LOOKUP (hostton
, 1 + strlen (name
), (".%s", name
),
63 if (strcmp (result
->e_name
, name
) == 0)
67 DB_LOOKUP (ntohost
, 18, ("=%x:%x:%x:%x:%x:%x",
68 addr
->ether_addr_octet
[0], addr
->ether_addr_octet
[1],
69 addr
->ether_addr_octet
[2], addr
->ether_addr_octet
[3],
70 addr
->ether_addr_octet
[4], addr
->ether_addr_octet
[5]),
72 if (memcmp (&result
->e_addr
, addr
,
73 sizeof (struct ether_addr
)) == 0)
75 }, struct ether_addr
*addr
)