# sdata - send a data packet to the other KERMIT # integer function sdata(x) include ratdef include kerdef include kercom # integer x,num,len,bufill,status,rpack,tnum if(numtry>MAXTRY){ sdata=BIGA return } else numtry=numtry+1 tnum=n call spack(BIGD,tnum,size,packet) if(host==FALSE){ call putdec(tnum,4) call putc(CR) call flush(STDOUT) } status=rpack(len,num,recpkt) # the next statements is to make sure we are not one packet ahead of other # KERMIT, it will happen if other KERMIT sends a NAK before we send the # the first SINIT packet if((status==BIGY)&(n==(num+1)))status=rpack(len,num,recpkt) if(status==BIGN){ if(n!=(num-1)){ sdata=state return } } else if(status==BIGY){ if(n!=num){ sdata=state return } numtry=0 n=mod((n+1),64) size=bufill(packet) if(size==EOF){ sdata=BIGZ return } sdata=BIGD return } else if(status==FALSE){ sdata=state return } else sdata=BIGA return end