.title rdpmpt ; ; function to read a record from a VMS file, prompting first ; ; call sequence n = rdpmpt(rab, prompt, psize, buffer, size) ; ; where rab is the integer descriptor from an openf call ; prompt is the prompt string ; psize is the length of the prompt string ; buffer is a character buffer to receive the record ; size is the size of the buffer ; ; returns -3(ERR) if error reading record ; number of bytes read if successful ; err=-3 rab=4 ; offset from ap for rab address pmt=8 ; offset from ap for prompt address psz=12 ; offset from ap for prompt length buf=16 ; offset from ap for buf address siz=20 ; offset from ap for size of buf .psect st_pure_code rel,con,lcl,exe,nowrt,rd,pic,shr,usr,novec,long .entry rdpmpt ^m movl @rab(ap),r2 ; rab address in r2 movl buf(ap),rab$l_ubf(r2) ; user buffer address in rab movw @siz(ap),rab$w_usz(r2) ; size of buffer in rab movl pmt(ap),rab$l_pbf(r2) ; prompt buffer address in rab movb @psz(ap),rab$b_psz(r2) ; length of prompt buffer in rab bisl #rab$m_pmt,rab$l_rop(r2) ; set bit for prompting $get rab=r2 bicl #rab$m_pmt,rab$l_rop(r2) ; turn off prompting blbc r0,error ; low bit clear => error movzwl rab$w_rsz(r2),r0 ; number of bytes in record returned addl3 r0,buf(ap),r1 ; address of first free byte movb #10,(r1)+ ; append NEWLINE character clrb (r1) ; terminate with EOS incl r0 ; include NEWLINE in count ret error: movl #err,r0 ret .end