1
0
Fork 0
linux/debian/rules.d/scripts/mod/gendef.py
Daniel Baumann 09ce90cf76
Adding debian version 6.12.33-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-22 12:15:16 +02:00

20 lines
424 B
Python
Executable file

#!/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()