aboutsummaryrefslogtreecommitdiffstats
path: root/readme.pl
diff options
context:
space:
mode:
Diffstat (limited to 'readme.pl')
-rwxr-xr-xreadme.pl30
1 files changed, 30 insertions, 0 deletions
diff --git a/readme.pl b/readme.pl
new file mode 100755
index 0000000..877364b
--- /dev/null
+++ b/readme.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $readme = 'README';
+my $readme_cgit = 'README.cgit';
+
+die "$0: $readme does not exist\n" unless -e $readme;
+
+open(my $fh, '<', $readme) or die "Cannot open $readme for reading: $!\n";
+my $text = do { local $/; <$fh> };
+close($fh);
+
+$text = do {
+ local $_ = $text;
+ s/</&lt;/g;
+ s/>/&gt;/g;
+ $_
+};
+
+print "Writing $readme_cgit\n";
+
+open($fh, '>', $readme_cgit) or die "Cannot open $readme_cgit for writing: $!\n";
+print {$fh} <<"CGIT";
+<pre>
+$text
+</pre>
+CGIT
+close($fh);