mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
0b6247c27f
On Windows, the git repository is checked out as CR-LF. Tell perl to open the pod file with cr-lf as the end of line. On Windows, the input file names are of the form podX\foo.pod.in. Cygwin perl cannot parse the directory for the file name unless the path separator is converted from \ to /. Change-Id: I7139bd2138573e938ea3e8386685f3b69e131c4d Reviewed-on: http://gerrit.openafs.org/5113 Tested-by: BuildBot <buildbot@rampaginggeek.com> Tested-by: Jeffrey Altman <jaltman@openafs.org> Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
48 lines
1.7 KiB
Perl
Executable File
48 lines
1.7 KiB
Perl
Executable File
#!/usr/bin/perl -w
|
|
#
|
|
# POD currently doesn't support any sort of =include directive. This
|
|
# processor works around that limitation. It takes a list of files ending in
|
|
# *.in as its argument and processes any POD directives of the form =include
|
|
# <file> in that file, generating a file with the *.in suffix removed. All
|
|
# paths are taken to be relative to the directory containing the file being
|
|
# processed.
|
|
#
|
|
# Currently, only single include nesting is supported. The included file is
|
|
# not processed for additional =include statements.
|
|
|
|
require 5.00503;
|
|
|
|
use Cwd qw(getcwd);
|
|
use File::Basename qw(dirname basename);
|
|
|
|
my $start = getcwd;
|
|
for my $file (@ARGV) {
|
|
chdir $start or die "cannot chdir to $start: $!\n";
|
|
$file =~ s:\\:/:g if $^O eq 'cygwin';
|
|
my $dir = dirname ($file);
|
|
my $out = $file;
|
|
unless ($out =~ s/\.in\z//) {
|
|
die "input file $file does not end in .in\n";
|
|
}
|
|
open (FILE, "< $file") or die "cannot open $file: $!\n";
|
|
binmode FILE, ':crlf' if $^O eq 'MSWin32';
|
|
binmode FILE, ':crlf' if $^O eq 'cygwin';
|
|
open (OUT, "> $out") or die "cannot open $out: $!\n";
|
|
chdir $dir or die "cannot chdir to $dir: $!\n";
|
|
local $/ = '';
|
|
local $_;
|
|
while (<FILE>) {
|
|
if (/^=include\s+(\S+)/) {
|
|
open (INCLUDE, "< $1") or die "cannot open $1: $!\n";
|
|
local $/;
|
|
print OUT <INCLUDE> or die "cannot read/write from $1: $!\n";
|
|
close INCLUDE or die "cannot read from $1: $!\n";
|
|
print OUT "\n" or die "cannot write to $out: $!\n";
|
|
} else {
|
|
print OUT $_ or die "cannot write to $out: $!\n";
|
|
}
|
|
}
|
|
close OUT or die "cannot write to $out: $!\n";
|
|
close FILE or die "cannot read from $file\n";
|
|
}
|