{=============================================================================} Procedure sendfile (fn:integer); VAR f:filerec; cnt:integer; k:char; q:file of byte; label exit; begin seekffile (fn); read (ffile,f); assign (q,f.fname); reset (q); iocode:=ioresult; if iocode<>0 then begin fileerror (f.fname,'SENDFILE (Ascii download)'); goto exit end; writelog (4,1,f.descrip); writeln ('File: '^S,f.descrip); writeln ('Uploaded by: '^S,f.sentby); writeln ('Downloaded: '^s,f.downloaded); writeln ('File size: '^S,filesize(q),' characters'^M); writeln (^B'Press space when you''re ready, or [X] to abort...'); repeat repeat until charready; k:=readchar; if hungupon then goto exit; if upcase(k)='X' then goto exit until k=' '; if not hungupon then begin printfile (f.fname); f.downloaded:=f.downloaded+1; seekffile (fn); write (ffile,f); writeln (^B^M+asciidownload+^M'Press a key...'); repeat until charready; k:=readchar end; exit: close (q) end; {=============================================================================} Procedure receivefile (f:filerec); VAR fn:lstr; cnt,timeul:integer; k:char; done:boolean; fff:text; last3:array [1..3] of char; Procedure putchar (k:char); begin write (fff,k); write (usr,k) end; begin fn:=''; cnt:=1; timeul:=timer; repeat if cnt<=length(f.descrip) then begin k:=upcase(f.descrip[cnt]); if k in ['A'..'Z'] then fn:=fn+k end; cnt:=cnt+1 until cnt>length(f.descrip); if fn='' then fn:='Noname'; fn:=copy(fn,1,8); while devicename(fn) do fn:=fn+chr(random(26)+64); fn:=uploaddir+fn+'.'; cnt:=0; repeat cnt:=cnt+1 until (cnt=1000) or (not exist(fn+strr(cnt))); if cnt=1000 then begin writeln ('Please try another description!'); exit end; fn:=fn+strr(cnt); assign (fff,fn); rewrite (fff); iocode:=ioresult; if iocode<>0 then begin error ('%I opening %1 in RECEIVEFILE (ASCII upload)','',fn); exit end; f.fname:=fn; f.sentby:=unam; f.downloaded:=0; f.when:=now; writeln (^B'ASCII receive ready.'^M, 'Press [CR] and /E to end, /X to abort.'^M); textcolor (outlockcolor); repeat repeat until charready; if hungupon then done:=true else begin k := chr(ord(readchar)); last3[1]:=last3[2]; last3[2]:=last3[3]; last3[3]:=upcase(k); done:=((last3[1]=^M) or (last3[1]=^J)) and (last3[2]='/') and ((last3[3]='E') or (last3[3]='X')); if not done then begin if (last3[2]=^M) and (k<>^J) then putchar (^J); if last3[2]='/' then putchar ('/'); if k<>'/' then putchar (k) end end until done; textclose (fff); textcolor (normbotcolor); if last3[3]='E' then begin addfile (f); timeul:=timer-timeul; if timeul<0 then timeul:=timeul+1440; writeln (^B^M'That upload took ',timeul,' minutes.'); logontime:=logontime+timeul; writelog (4,2,f.descrip) end else begin writestr (^M^M'Upload aborted!'); erase (fff); iocode:=ioresult end end;