]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
da8ba721 DM |
2 | /*** |
3 | This file is part of systemd | |
4 | ||
5 | Copyright 2015 Daniel Mack | |
6 | ||
7 | systemd is free software; you can redistribute it and/or modify it | |
8 | under the terms of the GNU Lesser General Public License as published by | |
9 | the Free Software Foundation; either version 2.1 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | systemd is distributed in the hope that it will be useful, but | |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | Lesser General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU Lesser General Public License | |
18 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
19 | ***/ | |
20 | ||
21 | #include <net/if_arp.h> | |
22 | #include <string.h> | |
23 | ||
24 | #include "macro.h" | |
07630cea | 25 | #include "string-util.h" |
da8ba721 DM |
26 | #include "util.h" |
27 | ||
cfe5b071 | 28 | _unused_ \ |
c9f7b4d3 | 29 | static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len); |
da8ba721 | 30 | |
07630cea | 31 | #include "arphrd-from-name.h" |
da8ba721 DM |
32 | #include "arphrd-list.h" |
33 | #include "arphrd-to-name.h" | |
da8ba721 DM |
34 | |
35 | int main(int argc, const char *argv[]) { | |
36 | ||
37 | unsigned int i; | |
38 | ||
39 | for (i = 1; i < ELEMENTSOF(arphrd_names); i++) { | |
40 | if (arphrd_names[i]) { | |
41 | assert_se(streq(arphrd_to_name(i), arphrd_names[i])); | |
42 | assert_se(arphrd_from_name(arphrd_names[i]) == (int) i); | |
43 | } | |
44 | } | |
45 | ||
46 | assert_se(arphrd_to_name(arphrd_max()) == NULL); | |
47 | assert_se(arphrd_to_name(0) == NULL); | |
48 | assert_se(arphrd_from_name("huddlduddl") == 0); | |
49 | ||
50 | return 0; | |
07630cea | 51 | } |