.title timedrd ttname: .ascid /sys$command/ ttchan: .blkw 1 devdesc: nlen: .long 0 naddr: .long 0 name: .blkb 63 ; ; timedrd::; read sys$input but timeout after given amount of time ; timer reset after each character typed in ; ; call timedrd(string,time,status block,maxlength) ; string = string to receive input ; time = time in seconds ; status block - 4 words as follows: ; word 1: return code: 1 = max length/cr ; >1 = timeout ; 2: # of chars read (up to cr) ; 3: terminating char: 0 if max length ; 13 if cr ; 4: not used ; maxlength = max size of input ; .word 0 movl #63,devdesc moval name,naddr $trnlog_s lognam=ttname,rsllen=nlen,rslbuf=devdesc blbc r0,bad cmpb name,#^x1b bneq 10$ subl #4,nlen addl #4,naddr 10$: $assign_s devnam=devdesc,- chan=ttchan ;assign channel bsbb error moval @4(ap),r1 ;r1=descriptor address movl 4(r1),r1 ;r1=character string address ; $qiow_s chan=ttchan,- ; func=#io$_readvblk!io$m_timed!io$m_noecho,- ; iosb=@12(ap),- ; p1=(r1),- ; p2=@16(ap),- ; p3=@8(ap),- ; p4=#0 $qiow_s chan=ttchan,- func=#io$_readvblk!io$m_timed,- iosb=@12(ap),- p1=(r1),- p2=@16(ap),- p3=@8(ap),- p4=#0 bsbb error $dassgn_s chan=ttchan ret ; ; error: blbc r0,bad rsb bad: pushl r0 calls #1,g^lib$signal ret .end