1: / rmdir -- unlink directory
2:
3: mov (sp)+,r5
4: tst (sp)+
5:
6: loop:
7: dec r5
8: ble done
9: mov (sp)+,r1
10: mov $name,r2
11: clr r0
12: 1:
13: inc r0
14: movb (r1)+,(r2)+
15: bne 1b
16: dec r2
17: dec r0
18: mov r0,size
19: cmp r2,$name
20: beq error
21: sys stat; name; stbuf
22: bes error
23: bic $!60000,stbuf+4
24: cmp $40000,stbuf+4
25: bne error
26: cmpb -1(r2),$'.
27: bne 1f
28: cmp r2,$name+1
29: beq error
30: cmpb -2(r2),$'/
31: beq error
32: cmpb -2(r2),$'.
33: bne 1f
34: cmp r2,$name+2
35: beq error
36: cmpb -3(r2),$'/
37: beq error
38: 1:
39: sys open; name; 0
40: bes error
41: mov r0,r1
42: 1:
43: mov r1,r0
44: sys read; stbuf; 16.
45: bes 1f
46: tst r0
47: beq 1f
48: tst stbuf
49: beq 1b
50: cmpb stbuf+2,$'.
51: bne error1
52: tstb stbuf+3
53: beq 1b
54: cmpb stbuf+3,$'.
55: bne error1
56: tstb stbuf+4
57: beq 1b
58:
59: error1:
60: jsr pc,prname
61: mov r1,r0
62: sys close
63: mov $1,r0
64: sys write; mes1; emes1-mes1
65: br loop
66:
67: 1:
68: mov r1,r0
69: sys close
70: movb $'/,(r2)+
71: movb $'.,(r2)+
72: movb $'.,(r2)+
73: clrb (r2)
74: sys unlink; name
75: clrb -(r2)
76: sys unlink; name
77: clrb -2(r2)
78: sys unlink; name
79: br loop
80:
81: error:
82: jsr pc,prname
83: mov $1,r0
84: sys write; mes2; emes2-mes2
85: br loop
86:
87: prname:
88: mov $1,r0
89: sys write; name; size:..
90: rts pc
91:
92: done:
93: sys exit
94:
95: mes1:
96: < -- directory not empty\n>
97: emes1:
98: mes2:
99: < ?\n>
100: emes2:
101: .even
102:
103: .bss
104: name: .=.+40.
105: stbuf: .=.+40.
Defined functions
done
defined in line
92; used 1 times
emes1
defined in line
97; used 1 times
error
defined in line
81; used 8 times
loop
defined in line
6; used 3 times
mes1
defined in line
95; used 2 times
mes2
defined in line
98; used 2 times
size
defined in line
89; used 1 times
Defined variables
name
defined in line
104; used 10 times