diff options
author | flz <flz@FreeBSD.org> | 2005-04-12 16:06:16 +0800 |
---|---|---|
committer | flz <flz@FreeBSD.org> | 2005-04-12 16:06:16 +0800 |
commit | b52a867ab8b4b37c56db75b0da29e9e693c4b6ab (patch) | |
tree | 84a837c0dfb88d33fd91cad18d00c52a11a9c0e1 /textproc/cdiff | |
parent | 09c6854a0ada85470f9f7e3bf1716e9105f153e7 (diff) | |
download | freebsd-ports-gnome-b52a867ab8b4b37c56db75b0da29e9e693c4b6ab.tar.gz freebsd-ports-gnome-b52a867ab8b4b37c56db75b0da29e9e693c4b6ab.tar.zst freebsd-ports-gnome-b52a867ab8b4b37c56db75b0da29e9e693c4b6ab.zip |
- Fix issues with monochrome terminals.
PR: ports/75310
Submitted by: Alex Kapranoff <kappa@rambler-co.ru>
Approved by: maintainer timeout (> 3 months)
Diffstat (limited to 'textproc/cdiff')
-rw-r--r-- | textproc/cdiff/Makefile | 1 | ||||
-rw-r--r-- | textproc/cdiff/src/cdiff.1 | 6 | ||||
-rw-r--r-- | textproc/cdiff/src/cdiff.sh | 25 |
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 |