# HG changeset patch # User Christophe Lincoln # Date 1302542605 -7200 # Node ID 92ad1f0612dbc10f6b41c29b9856298262d55cf9 # Parent b542e1db674c6916f1bbdf42e8c40cd7947ed0b7 index.cgi: Add some colors to config file diff -r b542e1db674c -r 92ad1f0612db index.cgi --- a/index.cgi Sun Apr 10 20:28:21 2011 +0200 +++ b/index.cgi Mon Apr 11 19:23:25 2011 +0200 @@ -45,7 +45,18 @@ xhtml_header echo "

$WANT

" echo '
'
-		cat $WANT
+		# Handle file type by extension as a Web Server does it.
+		# HTML entities: -e 's|&|\&|g' -e 's|<|\<|g' -e 's|>|\>|g'
+		case "$WANT" in
+			*.conf|*.lst)
+				cat $WANT | sed \
+					-e s"#^\#\([^']*\)#\0#"g \
+					-e s"#^[A-Z]\([^']*\)=#\0#"g \
+					-e s"#^[a-z]\([^']*\)#\0#"g \
+					-e s"#\"\([^']*\)\"#\0#"g ;;
+			*)
+				cat $WANT ;;
+		esac
 		echo '
' ;; debug*) TITLE="- Debug"