aboutsummaryrefslogtreecommitdiff
path: root/textproc/cdiff
diff options
context:
space:
mode:
authorFlorent Thoumie <flz@FreeBSD.org>2005-04-12 08:06:16 +0000
committerFlorent Thoumie <flz@FreeBSD.org>2005-04-12 08:06:16 +0000
commit856736e7480f6911085688bea498940e27cf3d47 (patch)
tree94de3aeb03823823639b5b71037e87c93a9700b1 /textproc/cdiff
parent4597659e7202090b619a4ae7613a451a12d8ccaf (diff)
downloadports-856736e7480f6911085688bea498940e27cf3d47.tar.gz
ports-856736e7480f6911085688bea498940e27cf3d47.zip
Notes
Diffstat (limited to 'textproc/cdiff')
-rw-r--r--textproc/cdiff/Makefile1
-rw-r--r--textproc/cdiff/src/cdiff.16
-rw-r--r--textproc/cdiff/src/cdiff.sh25
3 files changed, 23 insertions, 9 deletions
diff --git a/textproc/cdiff/Makefile b/textproc/cdiff/Makefile
index a04d342ddcdc..974da664ee57 100644
--- a/textproc/cdiff/Makefile
+++ b/textproc/cdiff/Makefile
@@ -9,6 +9,7 @@
PORTNAME= cdiff
PORTVERSION= 1.4
+PORTREVISION= 1
CATEGORIES= textproc
MASTER_SITES= # none
DISTFILES= # none
diff --git a/textproc/cdiff/src/cdiff.1 b/textproc/cdiff/src/cdiff.1
index 551928a81118..53d167629425 100644
--- a/textproc/cdiff/src/cdiff.1
+++ b/textproc/cdiff/src/cdiff.1
@@ -34,6 +34,7 @@
.Nd show diffs with colors
.Sh SYNOPSIS
.Nm cdiff
+.Op Fl m
.Op Ar diff ...
.Sh DESCRIPTION
.Nm
@@ -43,6 +44,11 @@ results to
.Xr less 1 .
If used on a color terminal, it makes diffs much easier to read.
There is also handling of "cvs annotate" in it.
+.Pp
+.Bl -tag -width Ds
+.It Fl m
+Use bold, reverse and underline codes (for monochrome terminals).
+.El
.Sh AUTHORS
.Nm
was written by
diff --git a/textproc/cdiff/src/cdiff.sh b/textproc/cdiff/src/cdiff.sh
index 3823d3b63322..47f62d97f5c8 100644
--- a/textproc/cdiff/src/cdiff.sh
+++ b/textproc/cdiff/src/cdiff.sh
@@ -1,4 +1,10 @@
#!/bin/sh
+if [ "$1" = "-m" ]; then
+ shift;
+ CODES="4:7:1:1"
+else
+ CODES="1:34:31:35"
+fi
(if [ "$1" != "" ]; then
while [ "$1" != "" ]; do
case $1 in
@@ -13,20 +19,21 @@
done
else
cat
-fi) | perl -pe '
+fi) | perl -p -mconstant=CODES,${CODES} -e '
+($at, $m, $p, $c) = split /:/, CODES;
while (s/\t/" " x (8 - ((length($`)-1) % 8))/e) {}
-s/^(\+.*)$/\033[31m$1\033[m/o;
-s/^(-.*)$/\033[34m$1\033[m/o
- if !s/^(--- \d+,\d+ ----.*)$/\033[1m$1\033[m/o;
-s/^(\*\*\* \d+,\d+ *\*\*\*.*)$/\033[1m$1\033[m/o;
-s/^(\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*)$/\033[1m$1\033[m/o;
-s/^(!.*)$/\033[35m$1\033[m/o;
-s/^(@@.*$)/\033[1m$1\033[m/o;
+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;
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;
- $_ = "\033[3" . ($lastcol + 1) . "m1.$1$2\033[m$3\n";
+ $_ = "\033[3" . ($lastcol + 1) . "m1.$1$2\033[0m$3\n";
}
' | less -R