aboutsummaryrefslogtreecommitdiff
path: root/docs/cmdline-opts
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-11-16 14:20:13 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-11-16 15:13:17 +0100
commitc3c1e9618513d245861c35ec0c563ab71ce892bb (patch)
tree85f27e98a37e721f1ef12b8a08747e9a6baaf5d0 /docs/cmdline-opts
parent5781e3653ed73e7d50febed40ff01db70e7dd780 (diff)
gen: support 'protos'
and warn on unrecognized lines
Diffstat (limited to 'docs/cmdline-opts')
-rwxr-xr-xdocs/cmdline-opts/gen.pl57
1 files changed, 45 insertions, 12 deletions
diff --git a/docs/cmdline-opts/gen.pl b/docs/cmdline-opts/gen.pl
index e39f380a3..cd9e3cf58 100755
--- a/docs/cmdline-opts/gen.pl
+++ b/docs/cmdline-opts/gen.pl
@@ -11,6 +11,7 @@ my %optlong;
my %helplong;
my %arglong;
my %redirlong;
+my %protolong;
# get the long name version, return the man page string
sub manpageify {
@@ -98,42 +99,52 @@ sub single {
my $seealso;
my $magic; # cmdline special option
while(<F>) {
- if(/^Short: (.)/i) {
+ if(/^Short: *(.)/i) {
$short=$1;
}
- elsif(/^Long: (.*)/i) {
+ elsif(/^Long: *(.*)/i) {
$long=$1;
}
- elsif(/^Added: (.*)/i) {
+ elsif(/^Added: *(.*)/i) {
$added=$1;
}
- elsif(/^Tags: (.*)/i) {
+ elsif(/^Tags: *(.*)/i) {
$tags=$1;
}
- elsif(/^Arg: (.*)/i) {
+ elsif(/^Arg: *(.*)/i) {
$arg=$1;
}
- elsif(/^Magic: (.*)/i) {
+ elsif(/^Magic: *(.*)/i) {
$magic=$1;
}
- elsif(/^Mutexed: (.*)/i) {
+ elsif(/^Mutexed: *(.*)/i) {
$mutexed=$1;
}
- elsif(/^Protocols: (.*)/i) {
+ elsif(/^Protocols: *(.*)/i) {
$protocols=$1;
}
- elsif(/^See-also: (.*)/i) {
+ elsif(/^See-also: *(.*)/i) {
$seealso=$1;
}
- elsif(/^Requires: (.*)/i) {
+ elsif(/^Requires: *(.*)/i) {
$requires=$1;
}
- elsif(/^Redirect: (.*)/i) {
+ elsif(/^Redirect: *(.*)/i) {
$redirect=$1;
}
+ elsif(/^Help: *(.*)/i) {
+ ;
+ }
elsif(/^---/) {
+ if(!$long) {
+ print STDERR "WARN: no 'Long:' in $f\n";
+ }
last;
}
+ else {
+ chomp;
+ print STDERR "WARN: unrecognized line in $f, ignoring:\n:'$_';"
+ }
}
my @dest;
while(<F>) {
@@ -222,6 +233,7 @@ sub getshortlong {
my $long;
my $help;
my $arg;
+ my $protocols;
while(<F>) {
if(/^Short: (.)/i) {
$short=$1;
@@ -235,6 +247,9 @@ sub getshortlong {
elsif(/^Arg: (.*)/i) {
$arg=$1;
}
+ elsif(/^Protocols: (.*)/i) {
+ $protocols=$1;
+ }
elsif(/^---/) {
last;
}
@@ -247,6 +262,7 @@ sub getshortlong {
$optlong{$long}=$short;
$helplong{$long}=$help;
$arglong{$long}=$arg;
+ $protolong{$long}=$protocols;
}
}
@@ -311,6 +327,19 @@ sub showonly {
}
}
+sub showprotocols {
+ my %prots;
+ foreach my $f (keys %optlong) {
+ my @p = split(/ /, $protolong{$f});
+ for my $p (@p) {
+ $prots{$p}++;
+ }
+ }
+ for(sort keys %prots) {
+ printf "$_ (%d options)\n", $prots{$_};
+ }
+}
+
sub getargs {
my $f;
do {
@@ -327,9 +356,13 @@ sub getargs {
showonly(shift @ARGV);
return;
}
+ elsif($f eq "protos") {
+ showprotocols();
+ return;
+ }
} while($f);
- print "Usage: gen.pl <mainpage/listhelp/single FILE>\n";
+ print "Usage: gen.pl <mainpage/listhelp/single FILE/protos>\n";
}
#------------------------------------------------------------------------