]>
Commit | Line | Data |
---|---|---|
1ec45fab RS |
1 | #! /usr/bin/env perl |
2 | # Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. | |
3 | # | |
4 | # Licensed under the Apache License 2.0 (the "License"). You may not use | |
5 | # this file except in compliance with the License. You can obtain a copy | |
6 | # in the file LICENSE in the source distribution or at | |
7 | # https://www.openssl.org/source/license.html | |
8 | ||
9 | use strict; | |
10 | use warnings; | |
11 | ||
12 | use lib "."; | |
13 | use Getopt::Std; | |
14 | use Pod::Html; | |
15 | ||
16 | # Options. | |
17 | our($opt_i); # -i INFILE | |
18 | our($opt_o); # -o OUTFILE | |
19 | our($opt_t); # -t TITLE | |
20 | our($opt_r); # -r PODROOT | |
21 | ||
22 | getopts('i:o:t:r:'); | |
23 | die "-i flag missing" unless $opt_i; | |
24 | die "-o flag missing" unless $opt_o; | |
25 | die "-t flag missing" unless $opt_t; | |
26 | die "-r flag missing" unless $opt_r; | |
27 | ||
28 | pod2html | |
29 | "--infile=$opt_i", | |
30 | "--outfile=$opt_o", | |
31 | "--title=$opt_t", | |
32 | "--podroot=$opt_r", | |
33 | "--podpath=man1:man3:man5:man7", | |
34 | "--htmldir=.."; | |
35 | ||
36 | # Read in contents. | |
37 | open F, "<$opt_o" | |
38 | or die "Can't read $opt_o, $!"; | |
39 | my $contents = ''; | |
40 | { | |
41 | local $/ = undef; | |
42 | $contents = <F>; | |
43 | } | |
44 | close F; | |
45 | unlink $opt_o; | |
46 | ||
47 | $contents =~ | |
48 | s|href="http://man\.he\.net/(man\d/[^"]+)(?:\.html)?"|href="../$1.html|g; | |
49 | open F, ">$opt_o" | |
50 | or die "Can't write $opt_o, $!"; | |
51 | print F $contents; | |
52 | close F; |