diff options
Diffstat (limited to 'debian/rules.d/scripts/mod/gendef.py')
-rwxr-xr-x | debian/rules.d/scripts/mod/gendef.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/debian/rules.d/scripts/mod/gendef.py b/debian/rules.d/scripts/mod/gendef.py new file mode 100755 index 000000000..55d3fc60e --- /dev/null +++ b/debian/rules.d/scripts/mod/gendef.py @@ -0,0 +1,20 @@ +#!/usr/bin/python3 +import re +import sys + +for line in open(sys.argv[1]): + match = re.search(r'getopt\(argc, argv, "([\w:]*?)"\)', line) + if match: + options = match.group(1) + break +else: + raise RuntimeError + +print('#define GETOPT_OPTIONS "%s"' % options) + +print('#define GETOPT_CASE', end=' ') +for c in options: + if c == ':' or c == 'T': + continue + print("case '%c':" % c, end=' ') +print() |