shithub: bin.rc

ref: 3c7b96eefe4382559c195eec433f48ee0e5afc38
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