# Copyright (c) 1979 Regents of the University of California
# char sccsid[] = "@(#)30read.s 4.2 10/29/80";
calls $0,_iosync #insure that something is in the window
bisw2 $SYNC,FUNIT(r7) #throw it away
jbs $fWRITE,FUNIT(r0),l3002 #ignore sync of output files
calls $0,_unit #do not discard arguement to unit on return
calls $0,_unsync #prepare input stream
pushl $0 #space for answer
pushl sp #ptr to answer space
pushal rd4 #ptr to input format
calls $0,_unsync #prepare input stream
clrd -(sp) #space for answer
pushl sp #ptr to answer space
pushal rd8 #ptr to input format
jbs $fEOLN,FUNIT(r7),l3005 #check for already at end of line
movab -1024(sp),sp #temp space
pushal 8(sp) #ptr to buffer
movab 1024(sp),sp #pop temp space
calls $0,_unsync #push back char if present
subl2 $bufsze,sp #allocate space for name
pushal rden #format string
calls $3,_fscanf #read name
cmpl r0,$1 #check for valid input
locc $0,$bufsze,(sp) #find size of input
subl3 r0,$bufsze+1,r6 #r6 has length of input
addl3 (r10),ap,r5 #r5 points to candidate data
cvtwl (r5)+,r4 #r4 has number of candidates
movaw 2(r5)[r4],r1 #r1 has addr of candidate name list
subw3 (r5)+,(r5),r0 #r0 has candidate length
cmpw r0,r6 #check for correct length
cmpc3 r0,(r1),(sp) #check for actual match
addl2 r0,r1 #update ptr to next candidate
addl2 $bufsze,sp #deallocate buffer
addl2 $bufsze,sp #deallocate buffer
addl3 (r10)+,ap,r0 #r0 has number of cases
subw3 r4,(r0),-(sp) #push internal value
rden: .asciz "%*[ \t\n]%80[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]",