Added enscript hack for cvsweb
authorTim Pope <code@tpope.net>
Mon, 26 Jul 2004 02:16:55 +0000 (02:16 +0000)
committerTim Pope <code@tpope.net>
Mon, 26 Jul 2004 02:16:55 +0000 (02:16 +0000)
enscript/enscript.pl [new file with mode: 0755]
enscript/enscriptrc [new file with mode: 0644]

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;
diff --git a/enscript/enscriptrc b/enscript/enscriptrc
new file mode 100644 (file)
index 0000000..d8cc9dd
--- /dev/null
@@ -0,0 +1,4 @@
+# On Debian, put the contents of this file in /var/www/.enscriptrc.  This will
+# override the default states configuration file.
+
+StatesConfigFile: /var/www/.enscript/hl/enscript.st