3 # Yeah, I know, probably 1000 other persons already wrote a script like
4 # this, but I'll tell ya:
6 # THEY DON'T FIT ME :-)
8 # Get readme file as parameter:
10 if($ARGV[0] eq "-c") {
15 my $README = $ARGV[0];
18 print "usage: mkreadme.pl [-c] <README> < manpage\n";
23 push @out, " _ _ ____ _ \n";
24 push @out, " Project ___| | | | _ \\| | \n";
25 push @out, " / __| | | | |_) | | \n";
26 push @out, " | (__| |_| | _ <| |___ \n";
27 push @out, " \\___|\\___/|_| \\_\\_____|\n";
33 # this should be removed:
34 $line =~ s/(
\b.|_
\b)//g;
36 if($line =~ /^([ \t]*\n|curl)/i) {
37 # cut off headers and empty lines
38 $wline++; # count number of cut off lines
43 $text =~ s/^\s+//g; # cut off preceeding...
44 $text =~ s/\s+$//g; # and trailing whitespaces
46 $tlen = length($text);
48 if($wline && ($olen == $tlen)) {
49 # if the previous line with contents was exactly as long as
50 # this line, then we ignore the newlines!
52 # We do this magic because a header may abort a paragraph at
53 # any line, but we don't want that to be noticed in the output
60 # we only make one empty line max
66 push @out, "\n"; # just an extra newline
68 open(READ, "<$README") ||
69 die "couldn't read the README infile $README";
78 my @test = `gzip --version 2>&1`;
79 if($test[0] =~ /gzip/) {
80 open(GZIP, ">dumpit") ||
81 die "can't create the dumpit file, try without -c";
89 system("gzip --best --no-name dumpit");
91 open(GZIP, "<dumpit.gz") ||
92 die "can't read the dumpit.gz file, try without -c";
96 $gzipped += length($_);
103 # no gzip, no compression!
105 print STDERR "MEEEP: Couldn't find gzip, disable compression\n";
112 * NEVER EVER edit this manually, fix the mkhelp.pl script instead!
113 * Generation time: $now
115 #include "hugehelp.h"
122 static const unsigned char hugehelpgz[] = {
123 /* This mumbo-jumbo is the huge help text compressed with gzip.
124 Thanks to this operation, the size of this data shrunk from $gzip
125 to $gzipped bytes. You can disable the use of compressed help
126 texts by NOT passing -c to the mkhelp.pl tool. */
132 my @all=split(//, $_);
135 printf("0x%02x, ", 0+$num);
145 /* Decompress and send to stdout a gzip-compressed buffer */
148 unsigned char buf[0x10000];
149 int status,headerlen;
152 /* Make sure no gzip options are set */
153 if (hugehelpgz[3] & 0xfe)
157 z.avail_in = sizeof(hugehelpgz) - headerlen;
158 z.next_in = (unsigned char *)hugehelpgz + headerlen;
159 z.zalloc = (alloc_func)Z_NULL;
160 z.zfree = (free_func)Z_NULL;
163 if (inflateInit2(&z, -MAX_WBITS) != Z_OK)
167 z.avail_out = (int)sizeof(buf);
169 status = inflate(&z, Z_SYNC_FLUSH);
170 if (status == Z_OK || status == Z_STREAM_END) {
171 fwrite(buf, sizeof(buf) - z.avail_out, 1, stdout);
172 if (status == Z_STREAM_END)
199 $outsize += length($new)+1; # one for the newline
204 # gcc 2.96 claims ISO C89 only is required to support 509 letter strings
206 # terminate and make another fputs() call here
207 print ", stdout);\n fputs(\n";
208 $outsize=length($new)+1;
210 printf("\"%s\\n\"\n", $new);
214 print ", stdout) ;\n}\n"