shithub: bin.rc

ref: f6706e1759c3e16f6f710ac897b7aa1cb5e22fa4
dir: /bin/loc/

View raw version
#!/bin/rc
# Print the address of a selection in acme
nl='
'
w=/mnt/acme/$winid
tag=`{cat $w/tag}
fn regexaddr {
	echo 'addr=dot' >$w/ctl
	sel=`$nl{escape <$w/xdata}
	addr=$tag(1)^':/^'$sel
	echo $addr
}
fn charaddr {
	echo 'addr=dot' >$w/ctl
	addr=`{cat <$w/addr}
	echo $tag(1)^':#'^$addr(1)^',#'^$addr(2)
}
addrfn=regexaddr
if(test $#* -gt 0 && ~ $1 -c)
	addrfn=charaddr
$addrfn