shithub: bin.rc

ref: 7888f0d7ab5dbd4f0a92cef3730590a4c7b9bea8
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