]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
gen.pl: do not generate CURLHELP bitmask lines > 79 characters
authorPatrick Monnerat <patrick@monnerat.net>
Mon, 31 Oct 2022 03:23:59 +0000 (04:23 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 1 Nov 2022 11:00:39 +0000 (12:00 +0100)
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

docs/cmdline-opts/gen.pl

index fe3e43e06f99a8f0deaa64ac45d7217a1f47bdd9..d34e9051394aa030c40d34baab51e5899cece723 100755 (executable)
@@ -540,7 +540,7 @@ HEAD
         my $long = $f;
         my $short = $optlong{$long};
         my @categories = split ' ', $catlong{$long};
-        my $bitmask;
+        my $bitmask = ' ';
         my $opt;
 
         if(defined($short) && $long) {
@@ -556,6 +556,7 @@ HEAD
                 $bitmask .= ' | ';
             }
         }
+        $bitmask =~ s/(?=.{76}).{1,76}\|/$&\n  /g;
         my $arg = $arglong{$long};
         if($arg) {
             $opt .= " $arg";
@@ -563,7 +564,7 @@ HEAD
         my $desc = $helplong{$f};
         $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) {
             print STDERR "WARN: the --$long name is too long\n";