aboutsummaryrefslogtreecommitdiff
path: root/bin/Getdir
blob: 5e40dc4fb8720a24c69ba25846cd811162b1c253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/local/plan9/bin/rc

# Click on an acme directory window and then execute Getdir

. 9.rc
dir=acme/acme/$winid

fn rd {
	9p read $dir/$1 || { echo 9p failed >[1=2]; exit 9p }
}
fn wr {
	9p write $dir/$1 || { echo 9p failed >[1=2]; exit 9p }
}


tag=`{rd tag}
if(! ~ $tag(1) */){
	echo window $tag(1) is not a directory >[1=2]
	exit 'not a directory'
}

echo -n , | wr addr

ls -pF `{eval echo $tag(1)} | sed 's/\*$//' |
	grep -v '^''?\.|\.o$|^''?o\.' |
	mc |
	wr data
echo -n '#0' | wr addr
echo -n 'dot=addr' | wr ctl