Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
9c7703ac
Commit
9c7703ac
authored
21 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Based on Dan Fandrich's patch and gzip unpack function, we now compress
the 'hugehelp' text if libz and gzip are available at build time.
parent
4a8155b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Makefile.am
+9
-1
9 additions, 1 deletion
src/Makefile.am
src/mkhelp.pl
+106
-13
106 additions, 13 deletions
src/mkhelp.pl
with
115 additions
and
14 deletions
src/Makefile.am
+
9
−
1
View file @
9c7703ac
...
...
@@ -11,6 +11,14 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/src -I$(top_srcdir)/src
bin_PROGRAMS
=
curl
#memtest
if
HAVE_LIBZ
# libz available, attempt to compress the help data
MKHELPOPT
=
-c
else
# no libz, don't try to compress
MKHELPOPT
=
endif
#memtest_SOURCES = memtest.c
#memtest_LDADD = $(top_srcdir)/lib/libcurl.la
...
...
@@ -38,4 +46,4 @@ MKHELP=$(top_srcdir)/src/mkhelp.pl
# This generates the hugehelp.c file
hugehelp.c
:
$(README) $(MANPAGE) mkhelp.pl
rm
-f
hugehelp.c
$(
NROFF
)
-man
$(
MANPAGE
)
|
$(
PERL
)
$(
MKHELP
)
$(
README
)
>
hugehelp.c
$(
NROFF
)
-man
$(
MANPAGE
)
|
$(
PERL
)
-s
$(
MKHELP
)
$(
MKHELPOPT
)
$(
README
)
>
hugehelp.c
This diff is collapsed.
Click to expand it.
src/mkhelp.pl
+
106
−
13
View file @
9c7703ac
...
...
@@ -6,10 +6,10 @@
# THEY DON'T FIT ME :-)
# Get readme file as parameter:
$README
=
$ARGV
[
0
];
my
$README
=
$ARGV
[
0
];
if
(
$README
eq
"")
{
print
"
usage: mkreadme.pl <README>
\n
";
print
"
usage: mkreadme.pl
[-c]
<README>
< manpage
\n
";
exit
;
}
...
...
@@ -20,8 +20,8 @@ push @out, " / __| | | | |_) | | \n";
push
@out
,
"
| (__| |_| | _ <| |___
\n
";
push
@out
,
"
\\
___|
\\
___/|_|
\\
_
\\
_____|
\n
";
$head
=
0
;
loop:
my
$head
=
0
;
while
(
<
STDIN
>
)
{
$line
=
$_
;
...
...
@@ -34,13 +34,13 @@ while (<STDIN>) {
if
(
$line
=~
/^curl/i
)
{
# cut off the page headers
$head
=
1
;
next
loop
;
next
;
}
if
(
$line
=~
/^[ \t]*\n/
)
{
$wline
++
;
# we only make one empty line max
next
loop
;
next
;
}
if
(
$wline
)
{
$wline
=
0
;
...
...
@@ -54,20 +54,113 @@ while (<STDIN>) {
push
@out
,
"
\n
";
# just an extra newline
open
(
READ
,
"
<
$README
")
||
die
"
couldn't read the README infile
";
die
"
couldn't read the README infile
$README
";
while
(
<
READ
>
)
{
push
@out
,
$_
;
}
close
(
READ
);
# if compressed
if
(
$c
)
{
my
@test
=
`
gzip --version 2>&1
`;
if
(
$test
[
0
]
=~
/gzip/
)
{
open
(
GZIP
,
"
|gzip -9 >dumpit.gz
");
binmode
GZIP
;
for
(
@out
)
{
print
GZIP
$_
;
$gzip
+=
length
(
$_
);
}
close
(
GZIP
);
open
(
GZIP
,
"
<dumpit.gz
");
binmode
GZIP
;
while
(
<
GZIP
>
)
{
push
@gzip
,
$_
;
$gzipped
+=
length
(
$_
);
}
close
(
GZIP
);
}
else
{
# no gzip, no compression!
undef
$c
;
print
STDERR
"
MEEEP: Couldn't find gzip, disable compression
\n
";
}
}
print
"
/* NEVER EVER edit this manually, fix the mkhelp script instead! */
\n
"
;
print
"
#include <stdio.h>
\n
";
print
"
void hugehelp(void)
\n
";
print
"
{
\n
";
print
"
fputs (
\n
";
$now
=
localtime
;
print
<<HEAD
/*
* NEVER EVER edit this manually, fix the mkhelp.pl script instead!
* Generation time: $now
*/
#include <stdio.h>
HEAD
;
if
(
$c
)
{
print
"
/* gzip shrunk this data from
$gzip
to
$gzipped
bytes */
\n
",
"
#include <zlib.h>
\n
static const unsigned char hugehelpgz[] = {
\n
";
my
$c
=
0
;
for
(
@gzip
)
{
my
@all
=
split
(
//
,
$_
);
for
(
@all
)
{
my
$num
=
ord
(
$_
);
printf
("
0x%02x,
",
0
+
$num
);
if
(
++
$c
>
11
)
{
print
"
\n
";
$c
=
0
;
}
}
}
print
"
\n
};
\n
";
print
<<EOF
/* Decompress and send to stdout a gzip-compressed buffer */
void hugehelp(void)
{
unsigned char buf[0x10000];
int status,headerlen;
z_stream z;
/* Make sure no gzip options are set */
if (hugehelpgz[3] & 0xfe)
return;
headerlen = 10;
z.avail_in = sizeof(hugehelpgz) - headerlen;
z.next_in = (unsigned char *)hugehelpgz + headerlen;
z.zalloc = (alloc_func)Z_NULL;
z.zfree = (free_func)Z_NULL;
z.opaque = 0;
if (inflateInit2(&z, -MAX_WBITS) != Z_OK)
return;
for (;;) {
z.avail_out = (int)sizeof(buf);
z.next_out = buf;
status = inflate(&z, Z_SYNC_FLUSH);
if (status == Z_OK || status == Z_STREAM_END) {
fwrite(buf, sizeof(buf) - z.avail_out, 1, stdout);
if (status == Z_STREAM_END)
break;
} else
break; /* Error */
}
inflateEnd(&z);
}
EOF
;
exit
;
}
else
{
print
<<HEAD
void hugehelp(void)
{
fputs(
HEAD
;
}
$outsize
=
0
;
for
(
@out
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment