.title readf ;+ ; integer function readf(buf, n, int) ; ; character buf(n) ; integer n, int ; ; this routine reads the next n bytes, or the number of bytes in the ; next record. It returns as its value the number of bytes ; actually read ; ; If an error occurs or an EOF is sensed, EOF is returned. ; ap=%5 buf=2 n=4 int=6 .mcall get$ .psect $r.roi,con,ro,rel,lcl,i .enabl lsb readf:: mov @int(ap),r0 ; ratfor unit number call r$gfbk ; get RFDB address into r1 bcs 10$ ; c set => invalid unit bit #rf.clo,(r1) ; is the file open? bne 10$ ; NO get$ r.fdb(r1),buf(ap),@n(ap) ; read the next record bcs 10$ ; c set => error mov f.nrbd(r0),r0 ; return number of bytes read return 10$: mov #eof,r0 ; return(EOF) return .end