]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
managen: output tabs for each 8 leading spaces
authorDaniel Stenberg <daniel@haxx.se>
Tue, 25 Jun 2024 11:37:51 +0000 (13:37 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 25 Jun 2024 14:13:30 +0000 (16:13 +0200)
This replacing of eight leading spaces into tabs was already done for
the embedded uncompressed version in tool_hugehelp.c so it does not save
anything there. But the gzip compressed version ends up almost 2K
smaller.

The output in a terminal should be identical.

Before using TABs:

curl.txt 282492 bytes
curl.txt.gz 73261 bytes

With this change applied:

curl.txt 249382 bytes
curl.txt.gz 71470 bytes

Closes #14016

scripts/managen
src/mkhelp.pl

index c56cb86a1fba7df92bdec3aa6e5d601bece0929c..ef30e7e1632aee1b2f68504b67d0e4615b1c4975 100755 (executable)
@@ -89,6 +89,12 @@ sub manpageify {
 
 my $colwidth=79; # max number of columns
 
+sub prefixline {
+    my ($num) = @_;
+    print "\t" x ($num/8);
+    print ' ' x ($num%8);
+}
+
 sub justline {
     my ($lvl, @line) = @_;
     my $w = -1;
@@ -105,7 +111,7 @@ sub justline {
         $ratio = $inject / $spaces;
     }
     my $spare = 0;
-    print ' ' x ($lvl * $indent);
+    prefixline($lvl * $indent);
     my $prev;
     for(@line) {
         while($spare >= 0.90) {
@@ -121,7 +127,7 @@ sub justline {
 
 sub lastline {
     my ($lvl, @line) = @_;
-    print ' ' x ($lvl * $indent);
+    prefixline($lvl * $indent);
     my $prev = 0;
     for(@line) {
         printf "%s%s", $prev?" ":"", $_;
index 52b6e13e344b83e4425795f689c15da6e7dbc65d..96c2b4192b32a5bfc5da3c53d8351c6d3e06d948 100755 (executable)
@@ -167,6 +167,7 @@ for my $n (@out) {
     chomp $n;
     $n =~ s/\\/\\\\/g;
     $n =~ s/\"/\\\"/g;
+    $n =~ s/\t/\\t/g;
 
     if(!$n) {
         $blank++;