diff options
author | Nigel Metheringham <nigel@exim.org> | 2009-10-16 10:36:52 +0000 |
---|---|---|
committer | Nigel Metheringham <nigel@exim.org> | 2009-10-16 10:36:52 +0000 |
commit | a21196501a7c718aa809e927fc9f1f38ed481cec (patch) | |
tree | cbfc02ec20e4171b19b9b84cd7c130bd9119b39c /doc/doc-docbook/OS-Fixups | |
parent | e6060e2ce135caa2d48e682c4d76d071ff760a30 (diff) |
doc os fixup script from Phil Pennock. fixes: #765
Diffstat (limited to 'doc/doc-docbook/OS-Fixups')
-rwxr-xr-x | doc/doc-docbook/OS-Fixups | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/doc/doc-docbook/OS-Fixups b/doc/doc-docbook/OS-Fixups new file mode 100755 index 000000000..f9c1d987f --- /dev/null +++ b/doc/doc-docbook/OS-Fixups @@ -0,0 +1,46 @@ +#!/usr/bin/perl -w +# $Cambridge: exim/doc/doc-docbook/OS-Fixups,v 1.1 2009/10/16 10:36:52 nm4 Exp $ +use strict; + +# Script to hack around using absolute paths in xsl:import with fixups. +# Let every OS define its own manipulations. +# Uses the Perl $^O values to identify the current OS. +# +# Define filter_$^O to do substitutions, will be called for every line of +# every .xsl file. + +sub filter_freebsd +{ +s{"/usr/share/sgml/docbook/xsl-stylesheets-1.70.1/} + {"/usr/local/share/xsl/docbook/}; +s{"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"} + {"/usr/local/share/xml/docbook/4.2/docbookx.dtd"}; +} + +# Define OS filters above. + +my $os_filter; +$os_filter = $main::{"filter_$^O"} if exists $main::{"filter_$^O"}; + +unless (defined $os_filter) + { + print "No changes defined for your OS ($^O).\n"; + exit 0; + } + +for my $fn (<*.xsl>, <*.xml>) + { + my $orig = "$fn.orig"; + rename($fn, $orig) or die "Failed to rename($fn, $orig): $!\n"; + # Most portable is two-argument form, and none of our filenames are + # untrusted or contain whitespace. + open(OLD, "< $orig") or die "Failed to read-open($orig): $!\n"; + open(NEW, "> $fn") or die "Failed to write-open($fn): $!\n"; + while (<OLD>) + { + $os_filter->(); + print NEW $_ or die "Write to \"$fn\" failed: $!\n"; + } + close(NEW) or die "Failed to close($fn) after writing: $!\n"; + close(OLD); + } |