Created
December 8, 2020 15:21
-
-
Save lincerely/1dc0756428fd11758c6b1db7408dd26b to your computer and use it in GitHub Desktop.
plan9port adiff (https://plan9.io/sources/plan9/acme/bin/adiff)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/plan9/bin/rc | |
. 9.rc | |
. $PLAN9/lib/acme.rc | |
if(~ $#* 0 1){ | |
echo >[1=2] usage: adiff file1 file2 | |
echo >[1=2] or adiff file1 file2... dir | |
exit usage | |
} | |
newwindow | |
l=$1 | |
r=$2 | |
if (test -d $1) l=$1/`{basename $2} | |
if not if (test -d $2) r=$2/`{basename $1} | |
9 echo 'name '^`{pwd}^/-diff-^`{basename $l} | winwrite ctl | |
9 diff $* | 9 awk -v 'l='$l -v 'r='^$r '/^diff/ {l=$2; r=$3; next} /^[1-9]/ {sub("[acd]", " & " r ":"); sub("^", l ":", $0)} | |
{print $0}' | winwrite body | |
winctl clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment