summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/lsopts.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/lsopts.pl b/scripts/lsopts.pl
new file mode 100755
index 0000000..1ea8aaf
--- /dev/null
+++ b/scripts/lsopts.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+
+my %opts;
+
+for my $chr ('a' .. 'z', 'A' .. 'Z') {
+ $opts{$chr} = q{};
+}
+
+open(my $fh, '<', 'src/options.c') or die("Can't open options.c: $!");
+while (my $line = <$fh>) {
+ chomp($line);
+ if ($line =~ /\{"(?<long>[^"]+)"\s*,.+,.+, (?<short>...)/) {
+ if (substr($+{'short'}, 0, 1) eq '\'') {
+ $opts{substr($+{'short'}, 1, 1)} = $+{'long'};
+ }
+ else {
+ $opts{$+{'short'}} = $+{'long'};
+ }
+ }
+}
+close($fh);
+
+foreach my $short (sort keys %opts) {
+ printf(
+ "%s\t%s\n",
+ $short,
+ $opts{$short},
+ );
+}