Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/bin/rc/cdiff

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

# Parse adiff output and plumb the next addresses.
# "Next" is relative to the current selection.
# Run from the tag of an acme window produced by adiff.

rfork en

dir=`{basename -d $%}

cd /mnt/acme/$winid

<>[5] addr {
	echo -n 'addr=dot' > ctl
	echo -n '/^[^<>\-].+$/' > /fd/5
	echo -n 'dot=addr' > ctl
	echo -n 'show' > ctl
	targ=`{cat xdata}
}

file1=`{echo $targ | sed 's/^([^ ]+:[0-9]+(,[0-9]+)?) . [^ ]+:[0-9]+(,[0-9]+)?$/\1/'}
file2=`{echo $targ | sed 's/^[^ ]+:[0-9]+(,[0-9]+)? . ([^ ]+:[0-9]+(,[0-9]+)?)$/\2/'}

addr1=$dir^/^$file1
addr2=$dir^/^$file2

echo plumb $addr1 $addr2

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.