merge-pod changes for cygwin and MSWin32 perl
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 28 Jul 2011 18:59:05 +0000 (14:59 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 31 Jul 2011 17:19:26 +0000 (10:19 -0700)
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>

doc/man-pages/merge-pod

index d35b6e1..15ccc54 100755 (executable)
@@ -18,12 +18,15 @@ 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 $/ = '';