From 031cf5e8ffd0511c1d69a41da295ab6bb017bc1d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 21 Mar 2010 16:57:12 +0100 Subject: Remove autoconf (from branch 'autocruft') Use config.mk for configuration, both GNU make and FreeBSD make are supported. --- scripts/checkopts.pl | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 scripts/checkopts.pl (limited to 'scripts') 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 +## License: 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 =~ /\{"(?[\w-]+)",.*,\s*(?:'(?.)'|(?\d+))\}/o) { + push(@{$options->{$+{long}}}, ['source', $+{short}]); + } + elsif ($line =~ /" (?:\-(?.), |\s*)--(?[\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 (?:-(?.), )?--(?[\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"; + } +} -- cgit v1.2.3