2000-09-20 13:37:28 +02:00
|
|
|
#!/bin/sh
|
2005-04-12 10:06:16 +02:00
|
|
|
if [ "$1" = "-m" ]; then
|
|
|
|
shift;
|
|
|
|
CODES="4:7:1:1"
|
|
|
|
else
|
2006-12-21 17:10:14 +01:00
|
|
|
if [ "$CDIFFCOLORS" != "" ]; then
|
|
|
|
CODES=$CDIFFCOLORS
|
|
|
|
else
|
|
|
|
CODES="1:34:31:35"
|
|
|
|
fi
|
2005-04-12 10:06:16 +02:00
|
|
|
fi
|
2000-10-24 18:51:16 +02:00
|
|
|
(if [ "$1" != "" ]; then
|
|
|
|
while [ "$1" != "" ]; do
|
|
|
|
case $1 in
|
|
|
|
http:*|https:*|ftp:*|file:*)
|
|
|
|
fetch -q -o - $1
|
|
|
|
;;
|
|
|
|
*)
|
2000-11-20 14:16:07 +01:00
|
|
|
zcat -f $1
|
2000-10-24 18:51:16 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift;
|
|
|
|
done
|
|
|
|
else
|
|
|
|
cat
|
2005-04-12 10:06:16 +02:00
|
|
|
fi) | perl -p -mconstant=CODES,${CODES} -e '
|
|
|
|
($at, $m, $p, $c) = split /:/, CODES;
|
2000-09-20 13:37:28 +02:00
|
|
|
while (s/\t/" " x (8 - ((length($`)-1) % 8))/e) {}
|
2005-04-12 10:06:16 +02:00
|
|
|
s/^(\+.*)$/\033[${p}m$1\033[0m/o;
|
|
|
|
s/^(-.*)$/\033[${m}m$1\033[0m/o
|
|
|
|
if !s/^(--- \d+,\d+ ----.*)$/\033[1m$1\033[0m/o;
|
|
|
|
s/^(\*\*\* \d+,\d+ *\*\*\*.*)$/\033[1m$1\033[0m/o;
|
|
|
|
s/^(\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*)$/\033[1m$1\033[0m/o;
|
|
|
|
s/^(!.*)$/\033[${c}m$1\033[0m/o;
|
|
|
|
s/^(@@.*$)/\033[${at}m$1\033[0m/o;
|
2002-03-10 23:01:55 +01:00
|
|
|
if (/^1.(\d+)(\s+\(\w+\s+\d{2}-\w{3}-\d{2}\):\s)(.*)/) {
|
|
|
|
$lastcol = $lastcol || 0;
|
|
|
|
$lastcol++ if defined($lastrev) && $lastrev != $1;
|
|
|
|
$lastrev = $1;
|
|
|
|
$lastcol %= 6;
|
2005-04-12 10:06:16 +02:00
|
|
|
$_ = "\033[3" . ($lastcol + 1) . "m1.$1$2\033[0m$3\n";
|
2002-03-10 23:01:55 +01:00
|
|
|
}
|
2001-04-26 20:03:16 +02:00
|
|
|
' | less -R
|