1
0
linux/debian/rules.d/scripts/mod/gendef.py
Konstantin Demin c3d09a3e94 initial commit
imported from https://salsa.debian.org/kernel-team/linux.git
commit 9d5cc9d9d6501d7f1dd7e194d4b245bd0b6c6a22
version 6.11.4-1
2024-10-23 12:12:30 +03:00

21 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()