#!/usr/bin/perl
# Combine generated html page with GNU boilerplate.
# Copyright (C) 2012, 2020 Free Software Foundation, Inc.
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
# Written by Brendan O'Dea
BEGIN
{
# Override SHELL. On DJGPP SHELL may not be set to a shell
# that can handle redirection and quote arguments correctly,
# e.g.: COMMAND.COM. For DJGPP always use the shell that configure
# has detected.
$ENV{'SHELL'} = '/dev/env/DJDIR/bin/bash.exe' if ($^O eq 'dos');
}
use strict;
use warnings;
use File::Temp;
use Getopt::Long;
my %opts;
die "Usage: $0 [--quiet] [--stdout]\n"
unless GetOptions \%opts, qw(quiet stdout) and !@ARGV;
undef $/;
# Fetch GNU boilerplate
my $boilerplate;
my $url = 'http://www.gnu.org/server/standards/boilerplate-source.html';
do {
open my $b, '-|', 'curl', '-sL', $url or die "curl: $!";
$boilerplate = <$b>;
($url) = $boilerplate =~ /]*)/xi;
} while $url;
for ($boilerplate)
{
s#\$Revision:\s+(\S+)\s+\$#$1#;
s#(?:\s+)*##s;
s#Baz\s+(- GNU Project)#help2man $1#s;
s#\bbug-baz\b#bug-help2man#g;
s#GNU\sBaz
.*(