1: / makdir -- make a directory
2:
3: sys getuid
4: mov r0,uid
5: mov sp,r5
6: tst (r5)+
7:
8: loop:
9: tst (r5)+
10: dec (sp)
11: bgt 1f
12: sys exit
13: 1:
14: mov (r5),r0
15: mov $buf1,r1
16: mov $buf2,r2
17: clr r3
18: 1:
19: movb (r0)+,r4
20: beq 2f
21: movb r4,(r1)+
22: movb r4,(r2)+
23: cmpb r4,$'/
24: bne 1b
25: mov r2,r3
26: br 1b
27: 2:
28: movb $'/,(r1)+
29: movb $'.,(r1)+
30: clrb (r1)
31: mov $dot,dir
32: tst r3
33: beq 1f
34: mov $buf2,dir
35: clrb (r3)
36: cmp r3,$buf2+1
37: beq 1f
38: clrb -(r3) / ???
39: 1:
40: tstb uid
41: beq 2f
42: sys stat; dir:..; stbuf / status of parent dir
43: bes error
44: mov stbuf+4,r0
45: cmpb uid,stbuf+7
46: bne 1f
47: ash $-6,r0
48: 1:
49: ror r0
50: ror r0
51: bcc error / no write permission in parent
52: 2:
53: mov (r5),0f
54: sys makdir; 0:..; 140777; 0
55: bes error / prob already exists
56: mov (r5),0f
57: sys chown; 0:..; uid:..
58: mov (r5),0f
59: sys link; 0:..; buf1
60: bes error
61: movb $'.,(r1)+
62: clrb (r1)
63: mov dir,0f
64: sys link; 0:..; buf1
65: bec loop
66:
67: error:
68: mov (r5),r0
69: mov r0,0f
70: clr 0f+2
71: 1:
72: tstb (r0)+
73: beq 1f
74: inc 0f+2
75: br 1b
76: 1:
77: mov $1,r0
78: sys write; 0:..; ..
79: mov $1,r0
80: sys write; ques; 3
81: br loop
82:
83: dot: <.\0>
84: ques: < ?\n>
85: .even
86:
87: .bss
88: buf1: .=.+100.
89: buf2: .=.+100.
90: stbuf: .=.+40.
Defined functions
dir
defined in line
42; used 3 times
dot
defined in line
83; used 1 times
error
defined in line
67; used 4 times
loop
defined in line
8; used 2 times
ques
defined in line
84; used 1 times
uid
defined in line
57; used 3 times
Defined variables
buf1
defined in line
88; used 3 times
buf2
defined in line
89; used 3 times
stbuf
defined in line
90; used 3 times