#!/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
|