1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/perl -w print "char *usage_opts[] = {\n"; while(<>) { chomp; if(/^-[a-zA-Z]/) { $opt = $_; next; } if($opt && (/^\.\. (.*)$/)) { print "\t\" $opt: $1\",\n"; undef $opt; } } # don't use NULL, it's not defined. print "\t(char *)0\n};\n";