blob: 22dbd7d03c08b3213c408dacb67e9e65c888fec1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/usr/bin/python
import re
import sys
for line in open(sys.argv[1]):
match = re.search('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',
for c in options:
if c == ':':
continue
print "case '%c':" % c,
print
|