📄 write.s
字号:
/ write -- write to another user.globl ttyn cmp (sp)+,$2 beq 1f bgt 2f mov $1,r0 sys write; argm; eargm-argm sys exit2: movb *4(sp),ltty1: tst (sp)+ mov (sp)+,r5 sys open; utmp; 0 bec 1f mov $1,r0 sys write; film; efilm-film sys exit1: mov r0,ufil1: mov ufil,r0 sys read; ubuf; 16. tst r0 bne 2f jmp 8f2: tstb ltty beq 2f cmpb ltty,8.+ubuf bne 1b2: mov $ubuf,r3 mov r5,r4 mov $9.,r22: dec r2 beq 2f cmpb (r4)+,(r3)+ beq 2b tstb -1(r4) bne 1b cmpb $' ,-1(r3) bne 1b2: movb 8.+ubuf,ttyno sys open; ttyx; 1 bes 3f sys stat; ttyx; statbuf bes 3f bit $2,statbuf+4 bne 2f3: mov $1,r0 sys write; dnymes; ednymes-dnymes sys exit2: mov r0,ttyf clr r0 jsr pc,ttyn mov r0,r3 mov statbuf,r4 mov ufil,r0 sys seek; 0; 01: mov ufil,r0 sys read; ubuf; 16. tst r0 beq unknown cmp r3,ubuf+8. bne 1b mov $ubuf,r0 mov $8.,r11: cmpb $' ,(r0)+ beq 1f dec r1 bne 1b1: neg r1 add $8,r1 mov r1,0f6: mov ttyf,r0 sys write; mesg; emesg-mesg mov ttyf,r0 sys 0; 5f.data5: sys write; ubuf; 0:2.text mov ttyf,r0 sys write; qnl; 4 sys signal; 2; 9f7: clr r0 sys read; ch; 1 tst r0 beq 9f tst nlflg beq 1f cmp ch,$'! bne 1f sys fork br mshproc sys wait mov $1,r0 sys write; excl; 2 br 7b1: clr nlflg cmp ch,$'\n bne 1f inc nlflg1: mov ttyf,r0 sys write; ch; 1 br 7b8: movb (r5)+,ch beq 8f mov $1,r0 sys write; ch; 1 br 8b8: tstb ltty beq 8f mov $1,r0 sys write; ltty-1; 28: mov $1,r0 sys write; errmsg; eerrmsg-errmsg sys exit9: mov ttyf,r0 sys write; endmsg; eendmsg-endmsg sys exitunknown: mov $"??,ubuf br 6bmshproc: sys exec; msh; mshp sys exit.datanlflg: 1.textmshp: msh minust 0msh: </bin/sh\0>minust: <-t\0>argm: <Arg count\n>eargm:film: <Cannot open utmp\n>efilm:.data < > / is ltty -1ltty: .=.+1.textexcl: <!\n>qnl: <...\n>.datattyx: </dev/ttyx\0>ttyno = .-2.textutmp: </etc/utmp\0>endmsg: <EOT\n>eendmsg:errmsg: < not logged in.\n>eerrmsg:mesg: <\nMessage from >emesg:dnymes: <Permission denied.\n>ednymes: .even .bssttyf: .=.+2ubuf: .=.+16.statbuf:.=.+40.ch: .=.+2ufil: .=.+2signal = 48.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -