gen.pl: insert the current date and version in generated man page

Reported-by: Gisle Vanem
Ref: #7780
Closes #7782
This commit is contained in:
Daniel Stenberg 2021-09-27 16:47:04 +02:00
parent 1ddfa8e480
commit 15910dfd14
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 16 additions and 1 deletions

View File

@ -45,6 +45,19 @@ my %redirlong;
my %protolong;
my %catlong;
use POSIX qw(strftime);
my $date = strftime "%b %e %Y", localtime;
my $version = "unknown";
open(INC, "<../../include/curl/curlver.h");
while(<INC>) {
if($_ =~ /^#define LIBCURL_VERSION \"([0-9.]*)/) {
$version = $1;
last;
}
}
close(INC);
# get the long name version, return the man page string
sub manpageify {
my ($k)=@_;
@ -365,6 +378,8 @@ sub header {
open(F, "<:crlf", "$f");
my @d;
while(<F>) {
s/%DATE/$date/g;
s/%VERSION/$version/g;
push @d, $_;
}
close(F);

View File

@ -22,7 +22,7 @@
.\"
.\" DO NOT EDIT. Generated by the curl project gen.pl man page generator.
.\"
.TH curl 1 "16 Dec 2016" "Curl 7.52.0" "Curl Manual"
.TH curl 1 "%DATE" "curl %VERSION" "curl Manual"
.SH NAME
curl \- transfer a URL
.SH SYNOPSIS