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 9use strict; 10use warnings; 11 12use lib "."; 13use Getopt::Std; 14use Pod::Html; 15 16# Options. 17our($opt_i); # -i INFILE 18our($opt_o); # -o OUTFILE 19our($opt_t); # -t TITLE 20our($opt_r); # -r PODROOT 21 22getopts('i:o:t:r:'); 23die "-i flag missing" unless $opt_i; 24die "-o flag missing" unless $opt_o; 25die "-t flag missing" unless $opt_t; 26die "-r flag missing" unless $opt_r; 27 28pod2html 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. 37open F, "<$opt_o" 38 or die "Can't read $opt_o, $!"; 39my $contents = ''; 40{ 41 local $/ = undef; 42 $contents = <F>; 43} 44close F; 45unlink $opt_o; 46 47$contents =~ 48 s|href="http://man\.he\.net/(man\d/[^"]+)(?:\.html)?"|href="../$1.html"|g; 49open F, ">$opt_o" 50 or die "Can't write $opt_o, $!"; 51print F $contents; 52close F; 53