mirror of
https://github.com/curl/curl.git
synced 2025-04-24 16:40:32 +08:00
gen.pl: do not generate CURLHELP bitmask lines > 79 characters
If a command line option is in many help categories, there is a risk that CURLHELP bitmask source lines generated for listhelp are longer than 79 characters. This change takes care of folding such long lines. Cloes #9834
This commit is contained in:
parent
65bdd6baec
commit
3b9af11c77
@ -540,7 +540,7 @@ HEAD
|
|||||||
my $long = $f;
|
my $long = $f;
|
||||||
my $short = $optlong{$long};
|
my $short = $optlong{$long};
|
||||||
my @categories = split ' ', $catlong{$long};
|
my @categories = split ' ', $catlong{$long};
|
||||||
my $bitmask;
|
my $bitmask = ' ';
|
||||||
my $opt;
|
my $opt;
|
||||||
|
|
||||||
if(defined($short) && $long) {
|
if(defined($short) && $long) {
|
||||||
@ -556,6 +556,7 @@ HEAD
|
|||||||
$bitmask .= ' | ';
|
$bitmask .= ' | ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$bitmask =~ s/(?=.{76}).{1,76}\|/$&\n /g;
|
||||||
my $arg = $arglong{$long};
|
my $arg = $arglong{$long};
|
||||||
if($arg) {
|
if($arg) {
|
||||||
$opt .= " $arg";
|
$opt .= " $arg";
|
||||||
@ -563,7 +564,7 @@ HEAD
|
|||||||
my $desc = $helplong{$f};
|
my $desc = $helplong{$f};
|
||||||
$desc =~ s/\"/\\\"/g; # escape double quotes
|
$desc =~ s/\"/\\\"/g; # escape double quotes
|
||||||
|
|
||||||
my $line = sprintf " {\"%s\",\n \"%s\",\n %s},\n", $opt, $desc, $bitmask;
|
my $line = sprintf " {\"%s\",\n \"%s\",\n %s},\n", $opt, $desc, $bitmask;
|
||||||
|
|
||||||
if(length($opt) > 78) {
|
if(length($opt) > 78) {
|
||||||
print STDERR "WARN: the --$long name is too long\n";
|
print STDERR "WARN: the --$long name is too long\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user