]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/resolve/generate-dns_type-gperf.py
resolved: add missing error code check when initializing DNS-over-TLS
[thirdparty/systemd.git] / src / resolve / generate-dns_type-gperf.py
1 #!/usr/bin/env python3
2
3 """Generate %-from-name.gperf from %-list.txt
4 """
5
6 import sys
7
8 name, prefix, input = sys.argv[1:]
9
10 print("""\
11 %{
12 #if __GNUC__ >= 7
13 _Pragma("GCC diagnostic ignored \\"-Wimplicit-fallthrough\\"")
14 #endif
15 %}""")
16 print("""\
17 struct {}_name {{ const char* name; int id; }};
18 %null-strings
19 %%""".format(name))
20
21 for line in open(input):
22 line = line.rstrip()
23 s = line.replace('_', '-')
24 print("{}, {}{}".format(s, prefix, line))