diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-03-21 16:57:12 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-03-21 16:57:12 +0100 |
commit | 031cf5e8ffd0511c1d69a41da295ab6bb017bc1d (patch) | |
tree | a1e909a0c683e2ab1d684d61a7664111d3632302 /scripts | |
parent | b3c405408fb7abaad6039b65d86ef701b12c9f0a (diff) |
Remove autoconf (from branch 'autocruft')
Use config.mk for configuration, both GNU make and FreeBSD make are supported.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkopts.pl | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/scripts/checkopts.pl b/scripts/checkopts.pl new file mode 100755 index 0000000..fb88c0f --- /dev/null +++ b/scripts/checkopts.pl @@ -0,0 +1,66 @@ +#!/usr/bin/env perl +## Copyright © 2010 by Daniel Friesel <derf@derf.homelinux.org> +## License: WTFPL <http://sam.zoy.org/wtfpl> +use strict; +use warnings; + +my $options; + +open(my $c_fh, '<', 'src/options.c') or die("Can't read options.c: $!"); +while (my $line = <$c_fh>) { + + if ($line =~ /\{"(?<long>[\w-]+)",.*,\s*(?:'(?<short>.)'|(?<short>\d+))\}/o) { + push(@{$options->{$+{long}}}, ['source', $+{short}]); + } + elsif ($line =~ /" (?:\-(?<short>.), |\s*)--(?<long>[\w-]+) /) { + push(@{$options->{$+{long}}}, ['help', $+{short}]); + } + +} +close($c_fh); + +open(my $man_fh, '<', 'feh.1') or die("Can't read feh.1: $!"); +while (my $line = <$man_fh>) { + + if ($line =~ /^\.B (?:-(?<short>.), )?--(?<long>[\w-]+)/) { + push(@{$options->{$+{long}}}, ['manual', $+{short}]); + } + +} +close($man_fh); + +foreach my $option (keys %{$options}) { + my $last; + my $count = 0; + + if ($option =~ / ^ action\d | help /x) { + next; + } + + foreach my $source (@{$options->{$option}}) { + my $name = $source->[0]; + my $short = $source->[1] // ''; + $short = '' if ($short =~ /^\d+$/); + + if (not defined $last) { + $last = $short; + } + + if ($last ne $short) { + last; + } + + $last = $short; + $count++; + } + + if ($count == 3) { + next; + } + + foreach my $source (@{$options->{$option}}) { + my $name = $source->[0]; + my $short = $source->[1] // ''; + print "$option: $name ($short)\n"; + } +} |