Added enscript hack for cvsweb
[tpope-extra.git] / enscript / enscript.pl
diff --git a/enscript/enscript.pl b/enscript/enscript.pl
new file mode 100755 (executable)
index 0000000..1253b27
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+# $Id$
+# -*- perl -*- vim: ft=perl sw=4 sts=4
+
+# This purpose of this script is to let enscript decide how to highlight a
+# file when called by cvsweb, despite cvsweb's retarded insistance on making
+# the decision itself.  Presumably, it can be adapted to work with viewcvs as
+# well, which has the same problem.
+
+# To use it, first tell cvsweb in cvsweb.conf to use this script for enscript:
+# $CMD{enscript} = search_path('enscript.pl');
+#
+# Then, to the contents of %enscript_types, add
+#   ' ' => qr/./o
+# which forces cvsweb to always call enscript.pl.
+
+use strict;
+
+for(my $i=0;$i<=$#ARGV;$i++) {
+    $ARGV[$i] = "--highlight" if $ARGV[$i] =~ m/^--highlight= *$/;
+}
+
+exec "/usr/bin/enscript", @ARGV;