summaryrefslogtreecommitdiff
path: root/src/basic/generate-gperfs.py
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2017-04-25 16:10:15 +0300
committerGitHub <noreply@github.com>2017-04-25 16:10:15 +0300
commitd5d5e06086734f6406b3ccc522c4951cdc18ca21 (patch)
tree55cc62ab712a9ef82600cafbc8755c589f49d71f /src/basic/generate-gperfs.py
parentcaf222104afe2d12f3a188a6bfee3a35f2d04fc6 (diff)
parentd730e2d16452d522d3b130071847b75198f42c45 (diff)
Merge pull request #5704 from keszybz/meson
meson: build systemd using meson
Diffstat (limited to 'src/basic/generate-gperfs.py')
-rw-r--r--src/basic/generate-gperfs.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/basic/generate-gperfs.py b/src/basic/generate-gperfs.py
new file mode 100644
index 0000000000..2e7d8931dd
--- /dev/null
+++ b/src/basic/generate-gperfs.py
@@ -0,0 +1,16 @@
+#!/usr/bin/python3
+
+"""Generate %-from-name.gperf from %-list.txt
+"""
+
+import sys
+
+name, prefix, input = sys.argv[1:]
+
+print("""\
+struct {}_name {{ const char* name; int id; }};
+%null-strings
+%%""".format(name))
+
+for line in open(input):
+ print("{0}, {1}{0}".format(line.rstrip(), prefix))