mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
adjusted the compressed generation to be more helpful in comments etc
This commit is contained in:
parent
3aced61465
commit
a1af6f3614
@ -20,34 +20,39 @@ push @out, " / __| | | | |_) | | \n";
|
|||||||
push @out, " | (__| |_| | _ <| |___ \n";
|
push @out, " | (__| |_| | _ <| |___ \n";
|
||||||
push @out, " \\___|\\___/|_| \\_\\_____|\n";
|
push @out, " \\___|\\___/|_| \\_\\_____|\n";
|
||||||
|
|
||||||
my $head=0;
|
|
||||||
|
|
||||||
while (<STDIN>) {
|
while (<STDIN>) {
|
||||||
$line = $_;
|
my $line = $_;
|
||||||
|
|
||||||
# this kind should be removed first:
|
# this should be removed:
|
||||||
$line =~ s/_//g;
|
$line =~ s/(.|_)//g;
|
||||||
|
|
||||||
# then this:
|
if($line =~ /^([ \t]*\n|curl)/i) {
|
||||||
$line =~ s/.//g;
|
# cut off headers and empty lines
|
||||||
|
$wline++; # count number of cut off lines
|
||||||
if($line =~ /^curl/i) {
|
|
||||||
# cut off the page headers
|
|
||||||
$head=1;
|
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($line =~ /^[ \t]*\n/) {
|
my $text = $line;
|
||||||
$wline++;
|
$text =~ s/^\s+//g; # cut off preceeding...
|
||||||
# we only make one empty line max
|
$text =~ s/\s+$//g; # and trailing whitespaces
|
||||||
next;
|
|
||||||
|
$tlen = length($text);
|
||||||
|
|
||||||
|
if($wline && ($olen == $tlen)) {
|
||||||
|
# if the previous line with contents was exactly as long as
|
||||||
|
# this line, then we ignore the newlines!
|
||||||
|
|
||||||
|
# We do this magic because a header may abort a paragraph at
|
||||||
|
# any line, but we don't want that to be noticed in the output
|
||||||
|
# here
|
||||||
|
$wline=0;
|
||||||
}
|
}
|
||||||
|
$olen = $tlen;
|
||||||
|
|
||||||
if($wline) {
|
if($wline) {
|
||||||
|
# we only make one empty line max
|
||||||
$wline = 0;
|
$wline = 0;
|
||||||
if(!$head) {
|
push @out, "\n";
|
||||||
push @out, "\n";
|
|
||||||
}
|
|
||||||
$head =0;
|
|
||||||
}
|
}
|
||||||
push @out, $line;
|
push @out, $line;
|
||||||
}
|
}
|
||||||
@ -101,9 +106,17 @@ print <<HEAD
|
|||||||
HEAD
|
HEAD
|
||||||
;
|
;
|
||||||
if($c) {
|
if($c) {
|
||||||
print "/* gzip shrunk this data from $gzip to $gzipped bytes */\n",
|
print <<HEAD
|
||||||
"#include <zlib.h>\nstatic const unsigned char hugehelpgz[] = {\n ";
|
#include <zlib.h>
|
||||||
|
static const unsigned char hugehelpgz[] = {
|
||||||
|
/* This mumbo-jumbo is the huge help text compressed with gzip.
|
||||||
|
Thanks to this operation, the size of this data shrunk from $gzip
|
||||||
|
to $gzipped bytes. You can disable the use of compressed help
|
||||||
|
texts by NOT passing -c to the mkhelp.pl tool. */
|
||||||
|
HEAD
|
||||||
|
;
|
||||||
my $c=0;
|
my $c=0;
|
||||||
|
print " ";
|
||||||
for(@gzip) {
|
for(@gzip) {
|
||||||
my @all=split(//, $_);
|
my @all=split(//, $_);
|
||||||
for(@all) {
|
for(@all) {
|
||||||
|
Loading…
Reference in New Issue
Block a user