home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 270.img / FORUM25C.ZIP / FILEXFER.PAS < prev    next >
Pascal/Delphi Source File  |  1989-02-26  |  41KB  |  1,563 lines

  1. {Filexfer Externals protocol revision 2.1d}
  2. {$R-,S-,I-,V-,B-,L+ }
  3. {$O+,F+}
  4. {$M 65500,0,0 }
  5.  
  6. unit filexfer;
  7.  
  8. interface
  9.  
  10. uses crt,dos,
  11.      gentypes,configrt,modem,statret,gensubs,subs1,subs2,windows,
  12.      shell,
  13.      userret,mainr1,mainr2,overret1,protocol;
  14.  
  15. procedure udsection;
  16.  
  17. implementation
  18.  
  19. procedure udsection;
  20.  
  21. var ud:udrec;
  22.     area:arearec;
  23.     curarea:integer;
  24.  
  25.  
  26. (* Note: This Code has the added External Protocols by Mr. Transistor & by  *)
  27. (* Spring King.  The original code is written by Ken Duda.  The new code is *)
  28. (* written by Spring King & Mr. Transistor.  There is 1 new feature in this *)
  29. (* version:  in an external protocal transfer, a time credit of 1/2 of the  *)
  30. (* time of the upload is given the user.  Ymodem & Xmodem use a different   *)
  31. (* formula, which can be modified in the file 'protocol.pas'.               *)
  32. (* This code is written to include the megalink and protocol too, but       *)
  33. (* but the menu selections 'M' is disabled because of a problem setting     *)
  34. (* the modem back up after using MegaLink.  If you are going to use Sealink *)
  35. (* you must have your modem setup as COM1 or else Sealink will NOT work.    *)
  36. (* Thanks to Omen Technologies (DSZ) and to whoever wrote Wxmodem, Sealink, *)
  37. (* and Megalink.                                                            *)
  38. (* Special thanks to Spring King, Mr. Transistor, and Ken Duda, the author  *)
  39. (* of Forum PC.                                                             *)
  40. (* call the Isengard BBS (312) 985-9699                                     *)
  41.  
  42.   procedure runext (var ret_code:integer; var command_line,switches:lstr);
  43.   begin
  44.    Writeln(USR,Command_line+switches);
  45. {   exec(command_line,switches); }
  46.    ret_code := DOS_Exec(Command_line+switches,FALSE,FALSE);
  47.    if Ret_code<>0 then
  48.       begin
  49.       writeln;
  50.       writeln;
  51.       writestr(^G^G^G);
  52.       fileerror ('EXTERNPROTOCOL',command_line+switches);
  53.       writeln;
  54.       writestr('Press Enter to Continue... *');
  55.       read;
  56.       ret_code:=2;
  57.     end
  58.   End;
  59.  
  60. procedure beepbeep (ok:integer);
  61.   begin
  62.     delay (500);
  63.     write (^B^M);
  64.     case ok of
  65.       0:write ('Done');
  66.       1:write ('Aborted just before EOF');
  67.       2:write ('Aborted')
  68.     end;
  69.     writeln ('!'^G^G^M)
  70.   end;
  71.  
  72. function unsigned (i:integer):real;
  73.   begin
  74.     if i>=0
  75.       then unsigned:=i
  76.       else unsigned:=65536.0+i
  77.   end;
  78.  
  79. procedure writefreespace (path:lstr);
  80.   var drive:byte;
  81.       r:registers;
  82.       csize,free,total:real;
  83.   begin
  84.     r.ah:=$36;
  85.     r.dl:=ord(upcase(path[1]))-64;
  86.     intr ($21,r);
  87.     if r.ax=-1 then begin
  88.       writeln ('Invalid drive');
  89.       exit
  90.     end;
  91.     csize:=unsigned(r.ax)*unsigned(r.cx);
  92.     free:=csize*unsigned(r.bx);
  93.     total:=csize*unsigned(r.dx);
  94.     free:=free/1024;
  95.     total:=total/1024;
  96.     writeln (free:0:0,'k out of ',total:0:0,'k')
  97.   end;
  98.  
  99. procedure seekafile (n:integer);
  100.   begin
  101.     seek (afile,n-1)
  102.   end;
  103.  
  104. function numareas:integer;
  105.   begin
  106.     numareas:=filesize (afile)
  107.   end;
  108.  
  109. procedure seekudfile (n:integer);
  110.   begin
  111.     seek (udfile,n-1)
  112.   end;
  113.  
  114. function numuds:integer;
  115.   begin
  116.     numuds:=filesize (udfile)
  117.   end;
  118.  
  119. procedure assignud;
  120.   begin
  121.     close (udfile);
  122.     assign (udfile,'AREA'+strr(curarea))
  123.   end;
  124.  
  125. function sponsoron:boolean;
  126.   begin
  127.     sponsoron:=match(area.sponsor,unam) or issysop
  128.   end;
  129.  
  130. function getapath:lstr;
  131.   var q,r:integer;
  132.       f:file;
  133.       b:boolean;
  134.       p:lstr;
  135.   begin
  136.     getapath:=area.xmodemdir;
  137.     if ulvl<sysoplevel then exit;
  138.     repeat
  139.       writestr ('Upload path [CR for '+area.xmodemdir+']:');
  140.       if hungupon then exit;
  141.       if length(input)=0 then input:=area.xmodemdir;
  142.       p:=input;
  143.       if input[length(p)]<>'\' then p:=p+'\';
  144.       b:=true;
  145.       assign (f,p+'CON');
  146.       reset (f);
  147.       q:=ioresult;
  148.       close (f);
  149.       r:=ioresult;
  150.       if q<>0 then begin
  151.         writestr ('  Path doesn''t exist!  Create it? *');
  152.         b:=yes;
  153.         if b then begin
  154.           mkdir (copy(p,1,length(p)-1));
  155.           q:=ioresult;
  156.           b:=q=0;
  157.           if b
  158.             then writestr ('Directory created')
  159.             else writestr ('Unable to create directory')
  160.         end
  161.       end
  162.     until b;
  163.     getapath:=p
  164.   end;
  165.  
  166. function makearea:boolean;
  167.   var num,n:integer;
  168.       a:arearec;
  169.   begin
  170.     makearea:=false;
  171.     num:=numareas+1;
  172.     n:=numareas;
  173.     writestr ('Create area '+strr(num)+' [Y/N]? *');
  174.     if yes then begin
  175.       writestr ('Area name:');
  176.       if length(input)=0 then exit;
  177.       a.name:=input;
  178.       writestr ('Access level:');
  179.       if length(input)=0 then exit;
  180.       a.level:=valu(input);
  181.       writestr ('Sponsor [CR for '+unam+']:');
  182.       if length(input)=0 then input:=unam;
  183.       a.sponsor:=input;
  184.       a.xmodemdir:=getapath;
  185.       seekafile (num);
  186.       write (afile,a);
  187.       area:=a;
  188.       curarea:=num;
  189.       assignud;
  190.       rewrite (udfile);
  191.       writeln ('Area created');
  192.       makearea:=true;
  193.       writelog (15,4,a.name)
  194.     end
  195.   end;
  196.  
  197. procedure setarea (n:integer);
  198.  
  199.     procedure nosucharea;
  200.     begin
  201.       writeln (^B'No such area: ',n,'!')
  202.     end;
  203.  
  204.   begin
  205.     curarea:=n;
  206.     if (n>numareas) or (n<1) then begin
  207.       nosucharea;
  208.       if issysop
  209.         then if makearea
  210.           then setarea (curarea)
  211.           else setarea (1)
  212.         else setarea (1);
  213.       exit
  214.     end;
  215.     seekafile (n);
  216.     read (afile,area);
  217.     if (urec.udlevel<area.level) and (not issysop)
  218.       then if curarea=1
  219.         then error ('User can''t access first area','','')
  220.         else
  221.           begin
  222.             nosucharea;
  223.             setarea (1);
  224.             exit
  225.           end;
  226.  
  227.     assignud;
  228.     close (udfile);
  229.     reset (udfile);
  230.     if ioresult<>0 then rewrite (udfile);
  231.     writeln (^B^M'Active: '^S,area.name,' [',curarea,']');
  232.     if sponsoron then writeln ('%: Sponsor commands');
  233.     writeln
  234.   end;
  235.  
  236. procedure setareareset (n:integer);
  237.  
  238.   begin
  239.     curarea:=n;
  240.     seekafile (n);
  241.     read (afile,area);
  242.     assignud;
  243.     close (udfile);
  244.     reset (udfile);
  245.     if ioresult<>0 then rewrite (udfile);
  246.     writeln
  247.   end;
  248.  
  249. procedure listareas;
  250.   var a:arearec;
  251.       cnt:integer;
  252.   begin
  253.     if exist (textfiledir+'arealist.ans') then
  254.       begin
  255.         printfile (textfiledir+'arealist');
  256.         exit;
  257.       end
  258.     else if issysop then begin
  259.       writeln ('To create a file list, create 3 files in the Forum TEXTFILE');
  260.       writeln ('directory called arealist and append the appropriate suffixes');
  261.      end;
  262.     writehdr ('Area List');
  263.     seekafile (1);
  264.     for cnt:=1 to numareas do begin
  265.       read (afile,a);
  266.       if a.level<=urec.udlevel
  267.         then writeln (cnt:2,'. (',a.level,') ',a.name);
  268.       if break then exit
  269.     end
  270.   end;
  271.  
  272. function getareanum:integer;
  273.   var areastr:sstr;
  274.       areanum:integer;
  275.   begin
  276.     getareanum:=0;
  277.     if length(input)>1
  278.       then areastr:=copy(input,2,255)
  279.       else
  280.         repeat
  281.           writestr (^M'Area # [?=list]:');
  282.           if input='?' then listareas else areastr:=input
  283.         until (input<>'?') or hungupon;
  284.     if length(areastr)=0 then exit;
  285.     areanum:=valu(areastr);
  286.     if (areanum>0) and (areanum<=numareas)
  287.       then getareanum:=areanum
  288.       else begin
  289.         writestr ('No such area!');
  290.         if issysop then if makearea then getareanum:=numareas
  291.       end
  292.   end;
  293.  
  294. procedure getarea;
  295.   var areanum:integer;
  296.   begin
  297.     areanum:=getareanum;
  298.     if areanum<>0 then setarea (areanum)
  299.   end;
  300.  
  301. function getfname (path:lstr; name:mstr):lstr;
  302.   var l:lstr;
  303.   begin
  304.     l:=path;
  305.     if length(l)<>0
  306.       then if not (l[length(l)] in [':','\'])
  307.         then l:=l+'\';
  308.     l:=l+name;
  309.     getfname:=l
  310.   end;
  311.  
  312. procedure getpathname (fname:lstr; var path:lstr; var name:sstr);
  313.   var p:integer;
  314.   begin
  315.     path:='';
  316.     repeat
  317.       p:=pos('\',fname);
  318.       if p<>0 then begin
  319.         path:=path+copy(fname,1,p);
  320.         fname:=copy(fname,p+1,255)
  321.       end
  322.     until p=0;
  323.     name:=fname
  324.   end;
  325.  
  326. procedure listfile (n:integer; extended:boolean);
  327.   var ud:udrec;
  328.       q:sstr;
  329.   begin
  330.     seekudfile (n);
  331.     read (udfile,ud);
  332.     tab (strr(n)+'.',4);
  333.     tab (ud.filename,13);  {adds a space}
  334.     if ud.newfile
  335.       then write ('New ')
  336.       else if ud.specialfile
  337.         then write ('Ask ')
  338.         else if ud.points>0
  339.           then tab (strr(ud.points),4)
  340.           else write ('    ');
  341.     tab (strlong(ud.filesize),8); {2 spaces}
  342.     writeln (ud.descrip);
  343.     if break or (not extended) then exit;
  344.     write ('    ');
  345.     tab (datestr(ud.when),19);
  346.     tab (strr(ud.downloaded),10);
  347.     writeln (ud.sentby)
  348.   end;
  349.  
  350. function nofiles:boolean;
  351.   begin
  352.     if numuds=0 then begin
  353.       nofiles:=true;
  354.       writestr (^M'Sorry, no files!')
  355.     end else nofiles:=false
  356.   end;
  357.  
  358. procedure listfiles (extended:boolean);
  359.   var cnt,max,r1,r2:integer;
  360.   const extendedstr:array[false..true] of string[9]=('','Extended ');
  361.   begin
  362.     if nofiles then exit;
  363.     writehdr (extendedstr[extended]+'File List'^M);
  364.     max:=numuds;
  365.     thereare (max,'file','files');
  366.     parserange (max,r1,r2);
  367.     if r1=0 then exit;
  368.     for cnt:=r1 to r2 do begin
  369.       listfile (cnt,extended);
  370.       if break then exit
  371.     end
  372.   end;
  373.  
  374. function wildcardmatch (w,f:sstr):boolean;
  375.   var a,b:sstr;
  376.  
  377.     procedure transform (t:sstr; var q:sstr);
  378.     var p:integer;
  379.  
  380.       procedure filluntil (k:char; n:integer);
  381.       begin
  382.         while length(q)<n do q:=q+k
  383.       end;
  384.  
  385.       procedure dopart (mx:integer);
  386.       var k:char;
  387.       begin
  388.         repeat
  389.           if p>length(t)
  390.             then k:='.'
  391.             else k:=t[p];
  392.           p:=p+1;
  393.           case k of
  394.             '.':begin
  395.                   filluntil (' ',mx);
  396.                   exit
  397.                 end;
  398.             '*':filluntil ('?',mx);
  399.             else if length(q)<mx then q:=q+k
  400.           end
  401.         until 0=1
  402.       end;
  403.  
  404.     begin
  405.       p:=1;
  406.       q:='';
  407.       dopart (8);
  408.       dopart (11)
  409.     end;
  410.  
  411.     function theymatch:boolean;
  412.     var cnt:integer;
  413.     begin
  414.       theymatch:=false;
  415.       for cnt:=1 to 11 do
  416.         if (a[cnt]<>'?') and (b[cnt]<>'?') and
  417.            (upcase(a[cnt])<>upcase(b[cnt])) then exit;
  418.       theymatch:=true
  419.     end;
  420.  
  421.   begin
  422.     transform (w,a);
  423.     transform (f,b);
  424.     wildcardmatch:=theymatch
  425.   end;
  426.  
  427. function searchforfile (f:sstr):integer;
  428.   var ud:udrec;
  429.       cnt:integer;
  430.   begin
  431.     for cnt:=1 to numuds do begin
  432.       seekudfile (cnt);
  433.       read (udfile,ud);
  434.       if match(ud.filename,f) then begin
  435.         searchforfile:=cnt;
  436.         exit
  437.       end
  438.     end;
  439.     searchforfile:=0
  440.   end;
  441.  
  442.   procedure searchfile;
  443.   var cnt:integer;
  444.       searchall:boolean;
  445.       wildcard:sstr;
  446.       a:arearec;
  447.  
  448.     procedure searcharea;
  449.     var cnt:integer;
  450.         u:udrec;
  451.     begin
  452.       for cnt:=1 to numuds do begin
  453.         seekudfile (cnt);
  454.         read (udfile,u);
  455.         if wildcardmatch (wildcard,u.filename) then listfile (cnt,false);
  456.         if xpressed then exit
  457.       end
  458.     end;
  459.  
  460.   begin
  461.     writestr (^M'Search all areas? *');
  462.     searchall:=yes;
  463.     writestr ('File name (wildcards OK):');
  464.     if length(input)=0 then exit;
  465.     wildcard:=input;
  466.     if not searchall then begin
  467.       searcharea;
  468.       exit
  469.     end;
  470.     for cnt:=1 to numareas do begin
  471.       seekafile (cnt);
  472.       read (afile,a);
  473.       if urec.udlevel>=a.level then begin
  474.         setarea (cnt);
  475.         searcharea;
  476.         if xpressed then exit
  477.       end
  478.     end
  479.   end;
  480.  
  481. function getfilenumbatch (t:mstr):integer;
  482.   var n,s:integer;
  483.   begin
  484.     getfilenumbatch:=0;
  485.     if length(input)>1 then input:=copy(input,2,255) else
  486.       repeat
  487.         writestr ('File name/number to '+t);
  488.         writestr ('[?=List *=Change Area $=Search]:');
  489.         if hungupon or (length(input)=0) then exit;
  490.         if input='?' then begin
  491.           listfiles (false);
  492.           input:='';
  493.         end;
  494.         if input='$' then begin
  495.           searchfile;
  496.           input:='';
  497.         end;
  498.         if input='*' then begin
  499.           getarea;
  500.           input:='';
  501.         end;
  502.       until input<>'';
  503.     val (input,n,s);
  504.     if s<>0 then begin
  505.       n:=searchforfile(input);
  506.       if n=0 then begin
  507.         writeln ('File not found.');
  508.         exit
  509.       end
  510.     end;
  511.     if (n<1) or (n>numuds)
  512.       then writeln ('File number out of range!')
  513.       else getfilenumbatch:=n;
  514.       if t='Batch Transfer' then input:='';
  515.   end;
  516.  
  517. function getfilenum (t:mstr):integer;
  518.   var n,s:integer;
  519.   begin
  520.     getfilenum:=0;
  521.     if length(input)>1 then input:=copy(input,2,255) else
  522.       repeat
  523.         writestr ('File name/number to '+t+' [?=List]:');
  524.         if hungupon or (length(input)=0) then exit;
  525.         if input='?' then begin
  526.           listfiles (false);
  527.           input:=''
  528.         end
  529.       until input<>'';
  530.     val (input,n,s);
  531.     if s<>0 then begin
  532.       n:=searchforfile(input);
  533.       if n=0 then begin
  534.         writeln ('File not found.');
  535.         exit
  536.       end
  537.     end;
  538.     if (n<1) or (n>numuds)
  539.       then writeln ('File number out of range!')
  540.       else getfilenum:=n;
  541.       if t='Batch Transfer' then input:='';
  542.   end;
  543.  
  544. function allowxfer:boolean;
  545.   var cnt:baudratetype;
  546.       k:char;
  547.   begin
  548.     allowxfer:=false;
  549. {   if not carrier then begin
  550.       writeln ('You may only transfer from remote!');
  551.       exit
  552.     end;    }
  553.     for cnt:=firstbaud to lastbaud do
  554.       if baudrate=baudarray[cnt]
  555.         then if not (cnt in downloadrates)
  556.           then begin
  557.             writeln ('You may not transfer at ',baudrate,' baud.');
  558.             exit
  559.           end;
  560.     if parity then begin
  561.       writeln ('Please select NO parity and press return...');
  562.       parity:=false;
  563.       setparam (usecom,baudrate,parity);
  564.       repeat
  565.         k:=getchar;
  566.         if hungupon then exit
  567.       until k in [#13,#141];
  568.       if k=#141 then begin
  569.         parity:=true;
  570.         setparam (usecom,baudrate,parity);
  571.         writeln ('You did not turn off parity.  Transfer aborted.');
  572.         exit
  573.       end
  574.     end;
  575.     allowxfer:=true
  576.   end;
  577.  
  578. procedure addfile (ud:udrec);
  579.   begin
  580.     seekudfile (numuds+1);
  581.     write (udfile,ud)
  582.   end;
  583.  
  584. procedure getfsize (var ud:udrec);
  585.   var df:file of byte;
  586.   begin
  587.     ud.filesize:=-1;
  588.     assign (df,getfname(ud.path,ud.filename));
  589.     reset (df);
  590.     if ioresult<>0 then exit;
  591.     ud.filesize:=filesize(df);
  592.     close(df)
  593.   end;
  594.  
  595.  
  596. const beenaborted:boolean=false;
  597.  
  598. function aborted:boolean;
  599.   begin
  600.     if beenaborted then begin
  601.       aborted:=true;
  602.       exit
  603.     end;
  604.     aborted:=xpressed or hungupon;
  605.     if xpressed then begin
  606.       beenaborted:=true;
  607.       writeln (^B'Newscan aborted!')
  608.     end
  609.   end;
  610.  
  611. procedure newscan;
  612.   var cnt:integer;
  613.       u:udrec;
  614.   begin
  615.     beenaborted:=false;
  616.     for cnt:=1 to filesize(udfile) do begin
  617.       if aborted then exit;
  618.       seekudfile (cnt);
  619.       read (udfile,u);
  620.       if (u.whenrated>laston) or (u.when>laston)
  621.         then listfile (cnt,false)
  622.     end
  623.   end;
  624.  
  625. procedure getstring (t:lstr; var m);
  626.   var q:lstr absolute m;
  627.       mm:lstr;
  628.   begin
  629.     if t=('description') then {the following is for the change file description only}
  630.     buflen:=50;            {limits sysop input to 50 chars}
  631.     if t=('description') then
  632.       writeln  (^R'       Old description: '^S,q);
  633.  
  634.     if t=('description') then begin
  635.       writestr ('                        0        1         2         3         4         5');
  636.       writestr ('50 Characters Maximum!  1---!----0----!----0----!----0----!----0----!----0');
  637.     end
  638.     else writeln ('Old ',t,': ',q);
  639.     writestr ('Enter new '+t+' :');
  640.     mm:=input;
  641.     if length(mm)<>0 then q:=mm;
  642.     writeln
  643.   end;
  644.  
  645. procedure getint (t:lstr; var i:integer);
  646.   var s:sstr;
  647.   begin
  648.     s:=strr(i);
  649.     getstring (t,s);
  650.     i:=valu(s)
  651.   end;
  652.  
  653. procedure getboo (t:lstr; var b:boolean);
  654.   var s:sstr;
  655.   begin
  656.     s:=yesno (b);
  657.     getstring (t,s);
  658.     b:=upcase(s[1])='Y'
  659.   end;
  660.  
  661. procedure removefile (n:integer);
  662.   var cnt:integer;
  663.   begin
  664.     for cnt:=n to numuds-1 do begin
  665.       seekudfile (cnt+1);
  666.       read (udfile,ud);
  667.       seekudfile (cnt);
  668.       write (udfile,ud)
  669.     end;
  670.     seekudfile (numuds);
  671.     truncate (udfile)
  672.   end;
  673.  
  674. procedure displayfile (var ffinfo:searchrec);
  675.   var a:integer;
  676.   begin
  677.     a:=ffinfo.attr;
  678.     if (a and 8)=8 then exit;
  679.     tab (ffinfo.name,13);
  680.     if (a and 16)=16
  681.       then write ('Directory')
  682.       else write (ffinfo.size);
  683.     if (a and 1)=1 then write (' <read-only>');
  684.     if (a and 2)=2 then write (' <hidden>');
  685.     if (a and 4)=4 then write (' <system>');
  686.     writeln
  687.   end;
  688.  
  689. function defaultdrive:byte;
  690.   var r:registers;
  691.   begin
  692.     r.ah:=$19;
  693.     intr ($21,r);
  694.     defaultdrive:=r.al+1
  695.   end;
  696.  
  697. procedure directory;
  698.   var r:registers;
  699.       ffinfo:searchrec;
  700.       tpath:anystr;
  701.       b:byte;
  702.       cnt:integer;
  703.   begin
  704.     getdir (defaultdrive,tpath);
  705.     if tpath[length(tpath)]<>'\' then tpath:=tpath+'\';
  706.     tpath:=tpath+'*.*';
  707.     writestr ('Path/wildcard [CR for '+tpath+']:');
  708.     writeln (^M);
  709.     if length(input)<>0 then tpath:=input;
  710.     writelog (16,10,tpath);
  711.     findfirst (chr(defaultdrive+64)+':\*.*',8,ffinfo);
  712.     if doserror<>0
  713.       then writeln ('No volume label'^M)
  714.       else writeln ('Volume label: ',ffinfo.name,^M);
  715.     findfirst (tpath,$17,ffinfo);
  716.     if doserror<>0 then writeln ('No files found.') else begin
  717.       cnt:=0;
  718.       while doserror=0 do begin
  719.         cnt:=cnt+1;
  720.         if not break then displayfile (ffinfo);
  721.         findnext (ffinfo)
  722.       end;
  723.       writeln (^B^M'Total files: ',cnt)
  724.     end;
  725.     write ('Free disk space: ');
  726.     writefreespace (tpath)
  727.   end;
  728.  
  729. procedure listarchive;
  730.   var n:integer;
  731.       ud:udrec;
  732.       f:file of byte;
  733.       fname:lstr;
  734.       b:byte;
  735.       sg:boolean;
  736.       size:longint;
  737.       Temp : INTEGER;
  738.  
  739.     function getsize:longint;
  740.     var x:longint;
  741.         b:array [1..4] of byte absolute x;
  742.         cnt:integer;
  743.     begin
  744.       for cnt:=1 to 4 do read (f,b[cnt]);
  745.       getsize:=x
  746.     end;
  747.  
  748.     procedure badarchive;
  749.     begin
  750.       writeln (^M'That file isn''t an archive!');
  751.       close (f);
  752.       exit
  753.     end;
  754.  
  755.   begin
  756.     if nofiles then exit;
  757.     repeat
  758.      n:=getfilenum('list');
  759.      if n=0 then exit;
  760.      seekudfile (n);
  761.      read (udfile,ud);
  762.      fname:=getfname(ud.path,ud.filename);
  763.      if (pos ('.ZIP',fname)=0) and (pos ('.zip',fname)=0) then begin
  764.         writeln (^M^J'That file does NOT appear to be an ARCHIVE file.  Please enter a');
  765.         writeln ('different filename or 0 to abort.');
  766.         end;
  767.     until (pos ('.ZIP',fname)<>0) or (pos ('.zip',fname)<>0);
  768.     if exist ('arclist.bat') then
  769.      begin
  770.       writeln (^S'Creating Archive list');
  771.       TEMP := DOS_exec ('c:\command.com /C c:arclist.bat '+fname+' '+textfiledir+'arclist.',FALSE,FALSE);
  772.                                                   {I assume you keep }
  773.                                                   {command.com in the Root of}
  774.                                                   {of drive C:.  If not, change}
  775.       if ioresult <>0 then begin
  776.         iocode:=ioresult;
  777.         fileerror ('LISTARCHIVE',FNAME);
  778.         end
  779.       else begin
  780.           writeln (^R);
  781.           printfile (textfiledir+'arclist');
  782.           end;
  783.       exit;
  784.       end;
  785.     assign (f,fname);
  786.     reset (f);
  787.     iocode:=ioresult;
  788.     if iocode<>0 then begin
  789.       fileerror ('LISTARCHIVE',fname);
  790.       exit
  791.     end;
  792.     if filesize(f)<32 then begin
  793.       badarchive;
  794.       exit
  795.     end;
  796.     writehdr ('Archive File List');
  797.     repeat
  798.       read (f,b);
  799.       if b<>26 then begin
  800.         badarchive;
  801.         exit
  802.       end;
  803.       read (f,b);
  804.       if b=0 then begin
  805.         close (f);
  806.         exit
  807.       end;
  808.       sg:=false;
  809.       for n:=1 to 13 do begin
  810.         read (f,b);
  811.         if b=0 then sg:=true;
  812.         if sg then b:=32;
  813.         write (chr(b))
  814.       end;
  815.       size:=getsize;
  816.       for n:=1 to 6 do read (f,b);
  817.       writeln ('   ',getsize);
  818.       seek (f,filepos(f)+size)
  819.     until break or hungupon
  820.   end;
  821.  
  822. {$I TRANSFER.PAS}  {Reads in the file Transfer.pas, which contains all the}
  823.                    {Download & Upload subroutines}
  824.  
  825.  
  826.  
  827.   procedure yourudstatus;
  828.   begin
  829.     writeln (^B^M'Access level:    '^S,urec.udlevel,
  830.                ^M'Transfer points: '^S,urec.udpoints,
  831.                ^M'Uploads:         '^S,urec.uploads,
  832.                ^M'Downloads:       '^S,urec.downloads)
  833.   end;
  834.  
  835.  
  836.   procedure newscanall;
  837.   var cnt:integer;
  838.       a:arearec;
  839.   begin
  840.     writehdr ('Newscanning... press [X] to abort.');
  841.     beenaborted:=false;
  842.     if aborted then exit;
  843.     for cnt:=1 to filesize(afile) do begin
  844.       seekafile (cnt);
  845.       read (afile,a);
  846.       if urec.udlevel>=a.level then begin
  847.         if aborted then exit;
  848.         setarea (cnt);
  849.         if aborted then exit;
  850.         newscan
  851.       end;
  852.       if aborted then exit
  853.     end
  854.   end;
  855.  
  856.   procedure addresidentfile (fname:lstr);
  857.   var ud:udrec;
  858.   begin
  859.     getpathname (fname,ud.path,ud.filename);
  860.     getfsize(ud);
  861.     if ud.filesize=-1 then begin
  862.       writeln ('File can''t be opened!');
  863.       exit
  864.     end;
  865.     writestr ('Point value:');
  866.     if length(input)=0 then input:='0';
  867.     ud.points:=valu(input);
  868.     writestr ('Sent by [CR='+unam+']:');
  869.     if length(input)=0 then input:=unam;
  870.     ud.sentby:=input;
  871.     ud.when:=now;
  872.     ud.whenrated:=now;
  873.     ud.downloaded:=0;
  874.     buflen:=50;
  875.     writestr ('                   0        1         2         3         4         5');
  876.     writestr ('50 Characters Max! 1---!----0----!----0----!----0----!----0----!----0');
  877.     writestr ('      Description: &');
  878.     ud.descrip:=input;
  879.     writestr ('Special request only? *');
  880.     ud.specialfile:=yes;
  881.     ud.newfile:=false;
  882.     addfile (ud);
  883.     writelog (16,8,fname)
  884.   end;
  885.  
  886.   procedure sysopadd;
  887.   var fn:lstr;
  888.   begin
  889.     if ulvl<sysoplevel then begin
  890.       writeln
  891.         ('Sorry, you may not add resident files without true sysop access!');
  892.       exit
  893.     end;
  894.     writehdr ('Add Resident File');
  895.     writestr ('Name/path of file:');
  896.     fn:=input;
  897.     if exist(fn)
  898.       then
  899.         begin
  900.           writestr ('Confirm: '+fn+' (Y/N):');
  901.           if yes then addresidentfile (fn)
  902.         end
  903.       else writeln ('File not found!')
  904.   end;
  905.  
  906.   procedure addmultiplefiles;
  907.   var spath,pathpart:lstr;
  908.       dummy:sstr;
  909.       f:file;
  910.       ffinfo:searchrec;
  911.   begin
  912.     if ulvl<sysoplevel then begin
  913.       writeln (
  914.         'Sorry, you may not add resident files without true sysop access!');
  915.       exit
  916.     end;
  917.     writehdr ('Add Resident Files By Wildcard');
  918.     setareareset (curarea);
  919.     writeln ('The default path is: '^S,area.xmodemdir);
  920.     writeln;
  921.     writestr ('Enter a new path or RETURN to use the default:');
  922.     if length(input)=0 then spath:=area.xmodemdir
  923.     else spath:=input;
  924.     pathpart:=spath;
  925.     writestr ('Enter the wildcards or a filename:');
  926.     if length(input)=0 then spath:=spath+'*.*'
  927.     else spath:=spath+input;
  928.     if pathpart[length(pathpart)]='\' then dec(pathpart[0]);
  929.     assign (f,pathpart+'\con');
  930.     reset (f);
  931.     if ioresult<>0 then begin
  932.       close (f);
  933.       exit;
  934.       end
  935.     else close (f);
  936.     getpathname (spath,pathpart,dummy);
  937.     findfirst (spath,$17,ffinfo);
  938.     if doserror<>0
  939.       then writeln ('No files found!')
  940.       else
  941.         while doserror=0 do begin
  942.           writeln;
  943.           displayfile (ffinfo);
  944.           writestr ('Add this file (Y/N/X)? *');
  945.           if yes
  946.             then addresidentfile (getfname(pathpart,ffinfo.name))
  947.             else if (length(input)>0) and (upcase(input[1])='X')
  948.               then exit;
  949.           findnext (ffinfo)
  950.         end
  951.   end;
  952.  
  953.   procedure changef;
  954.   var n,q:integer;
  955.       ud:udrec;
  956.  
  957.     procedure showudrec (var ud:udrec);
  958.     begin
  959.       with ud do
  960.         writeln(^M^J'   Filename: '^S,ud.filename,
  961.                 ^M^J'       Path: '^S,ud.path,
  962.                 ^M^J'       Size: '^S,ud.filesize,
  963.                 ^M^J'     Points: '^S,ud.points,
  964.                 ^M^J'Description: '^S,ud.descrip,
  965.                 ^M^J'#downloaded: '^S,ud.downloaded,
  966.                 ^M^J'    Unrated: '^S,yesno(ud.newfile),
  967.                 ^M^J'Special req: '^S,yesno(ud.specialfile),
  968.                 ^M^J'    Sent by: '^S,sentby,
  969.                 ^M^J'    Sent on: '^S,datestr(when),
  970.                 ^M^J'    Sent at: '^S,timestr(when),^M^J);
  971.     end;
  972.  
  973.   begin
  974.     n:=getfilenum ('Change');
  975.     if n=0 then exit;
  976.     seekudfile (n);
  977.     read (udfile,ud);
  978.     writelog (16,4,ud.filename);
  979.     showudrec (ud);
  980.     repeat
  981.       q:=menu ('File change','FCHANGE','QUDSNFPRV');
  982.       case q of
  983.         2:getstring ('uploader',ud.sentby);
  984.         3:begin
  985.             nochain:=true;
  986.             getstring ('description',ud.descrip)
  987.           end;
  988.         4:getboo ('special request only',ud.specialfile);
  989.         5:getboo ('new file (unrated)',ud.newfile);
  990.         6:getstring ('filename',ud.filename);
  991.         7:getstring ('path',ud.path);
  992.         8:showudrec (ud);
  993.         9:getint ('point value',ud.points)
  994.       end
  995.     until (q=1);
  996.     getfsize(ud);
  997.     if ud.filesize=-1 then writestr ('Warning:  Can''t open file!');
  998.     seekudfile (n);
  999.     write (udfile,ud)
  1000.   end;
  1001.  
  1002.   procedure deletef;
  1003.   var n,cnt:integer;
  1004.       fn:lstr;
  1005.       ud:udrec;
  1006.       f:file;
  1007.   begin
  1008.     n:=getfilenum ('delete');
  1009.     if n=0 then exit;
  1010.     seekudfile (n);
  1011.     read (udfile,ud);
  1012.     fn:=getfname(ud.path,ud.filename);
  1013.     writelog (16,7,fn);
  1014.     writestr ('Confirm: File '+fn+' ('+ud.descrip+') ? *');
  1015.     if not yes then exit;
  1016.     removefile (n);
  1017.     writestr ('Erase disk file '+fn+'? *');
  1018.     if not yes then exit;
  1019.     assign (f,fn);
  1020.     erase (f)
  1021.   end;
  1022.  
  1023.   procedure killarea;
  1024.   var a:arearec;
  1025.       cnt,n:integer;
  1026.       oldname,newname:sstr;
  1027.   begin
  1028.     writestr ('Delete area #'+strr(curarea)+' ('+area.name+')? *');
  1029.     if not yes then exit;
  1030.     writelog (16,2,'');
  1031.     close (udfile);
  1032.     oldname:='Area'+strr(curarea);
  1033.     assign (udfile,oldname);
  1034.     erase (udfile);
  1035.     for cnt:=curarea to numareas-1 do begin
  1036.       newname:=oldname;
  1037.       oldname:='Area'+strr(cnt+1);
  1038.       assign (udfile,oldname);
  1039.       rename (udfile,newname);
  1040.       n:=ioresult;
  1041.       seekafile (cnt+1);
  1042.       read (afile,a);
  1043.       seekafile (cnt);
  1044.       write (afile,a)
  1045.     end;
  1046.     seekafile (numareas);
  1047.     truncate (afile);
  1048.     setarea (1)
  1049.   end;
  1050.  
  1051.   procedure modarea;
  1052.   var a:arearec;
  1053.   begin
  1054.     a:=area;
  1055.     getstring ('area name',a.name);
  1056.     writelog (16,3,a.name);
  1057.     getint ('access level',a.level);
  1058.     writelog (16,11,strr(a.level));
  1059.     getstring ('sponsor',a.sponsor);
  1060.     writelog (16,12,a.sponsor);
  1061.     if issysop then begin
  1062.       a.xmodemdir:=getapath;
  1063.       writelog (16,13,a.xmodemdir)
  1064.     end;
  1065.     seekafile (curarea);
  1066.     write (afile,a);
  1067.     area:=a
  1068.   end;
  1069.  
  1070.   procedure sortarea;
  1071.   var temp,mark,cnt:integer;
  1072.       u1,u2:udrec;
  1073.   begin
  1074.     writehdr ('Sort Area');
  1075.     writestr ('Confirm (Y/N):');
  1076.     if not yes then exit;
  1077.     writelog (16,6,'');
  1078.     mark:=numuds-1;
  1079.     repeat
  1080.       if mark<>0 then begin
  1081.         temp:=mark;
  1082.         mark:=0;
  1083.         for cnt:=1 to temp do begin
  1084.           seekudfile (cnt);
  1085.           read (udfile,u1);
  1086.           read (udfile,u2);
  1087.           if upstring(u1.filename)>upstring(u2.filename) then begin
  1088.             mark:=cnt;
  1089.             seekudfile (cnt);
  1090.             write (udfile,u2);
  1091.             write (udfile,u1)
  1092.           end
  1093.         end
  1094.       end
  1095.     until mark=0
  1096.   end;
  1097.  
  1098.     procedure ZipSortarea;
  1099.   var temp,mark,cnt:integer;
  1100.       u1,u2:udrec;
  1101.   begin
  1102.     writehdr ('Zip Sort Area');
  1103.     writestr ('Confirm (Y/N):');
  1104.     if not yes then exit;
  1105.     mark := numuds-1;
  1106.     if mark=0 then Exit;
  1107.     temp := numuds-1;
  1108.     mark := 0;
  1109.     writeln(temp);
  1110.     for cnt := 1 to temp do
  1111.       begin
  1112.         seekudfile (cnt);
  1113.         read (udfile,u1);
  1114.         mark := Pos('.ARC',UpString(u1.filename));
  1115.         If mark <> 0 THEN
  1116.           Begin
  1117.             delete(u1.filename,mark,4);
  1118.             u1.filename := UpString(u1.filename)+'.ZIP';
  1119.             Writeln(u1.filename);
  1120.           End;
  1121.         seekudfile(cnt);
  1122.         write(udfile,u1)
  1123.       End;
  1124.   end;
  1125.  
  1126.   procedure movefile;
  1127.   var an,fn,oldn:integer;
  1128.       zn,cddir,dirsave,dirsave1,p:lstr;
  1129.       ud:udrec;
  1130.       mbatchf,batchf,batchf1:text;
  1131.       f:file;
  1132.       Temp : INTEGER;
  1133.     begin
  1134.     getdir (0, dirsave);
  1135.     oldn:=curarea;
  1136.     if area.xmodemdir[length(area.xmodemdir)]='\'
  1137.     then
  1138.     cddir:=copy(area.xmodemdir,1,length(area.xmodemdir)-1)
  1139.     else
  1140.     cddir:=area.xmodemdir;
  1141.     chdir (cddir);
  1142.     getdir (0, dirsave1);
  1143.     chdir (dirsave);
  1144.     fn:=getfilenum ('move');
  1145.     if fn=0 then exit;
  1146.     input:='';
  1147.     seekudfile (fn);
  1148.     read (udfile,ud);
  1149.     writelog (16,5,ud.filename);
  1150.     zn:=getfname(ud.path,ud.filename);
  1151.     p:=ud.filename;
  1152.     writeln;
  1153.     writeln ('File '+zn+'');
  1154.     an:=getareanum;
  1155.     setarea (an);
  1156.     writestr ('Shall I move '+p+' from directory '+ud.path+' to File Area '+input+'');
  1157.     writeln;
  1158.     if area.xmodemdir[length(area.xmodemdir)]<'\'
  1159.     then
  1160.     cddir:=copy(area.xmodemdir,1,length(area.xmodemdir)-1)
  1161.     else
  1162.     cddir:=area.xmodemdir;
  1163.     writestr ('and directory '+cddir+' ? (Y/N): *');
  1164.     writeln;
  1165.     if not yes then begin
  1166.       setarea (oldn);
  1167.       chdir (dirsave);
  1168.       exit;
  1169.     end;
  1170.     chdir (dirsave1);
  1171.     cddir:=area.xmodemdir;
  1172.     if ud.path=cddir then begin
  1173.     if area.xmodemdir[length(area.xmodemdir)]>'\'
  1174.     then
  1175.     ud.path:=copy(ud.path,1,length(ud.path)-1)
  1176.     else
  1177.     ud.newfile:=false;
  1178.     addfile (ud);
  1179.     chdir (dirsave);
  1180.     setarea (oldn);
  1181.     removefile (fn);         
  1182.     exit
  1183.     end;
  1184.     assign (mbatchf,'mov.bat');
  1185.     rewrite (mbatchf);
  1186.     writeln (mbatchf,'echo off');        
  1187.     writeln (mbatchf,'if not exist %1 goto whoops1');
  1188.     writeln (mbatchf,'copy %1 %2');
  1189.     writeln (mbatchf,'if not exist %2 goto whoops2');
  1190.     writeln (mbatchf,'del %1');
  1191.     writeln (mbatchf,'goto end');
  1192.     writeln (mbatchf,':whoops1');
  1193.     writeln (mbatchf,'echo Move failed. File not found !');
  1194.     writeln (mbatchf,'goto end');
  1195.     writeln (mbatchf,':whoops2');
  1196.     writeln (mbatchf,'echo Move failed. File not erased from original directory !');
  1197.     writeln (mbatchf,':end');
  1198.     textclose (mbatchf);
  1199.     assign (batchf, 'move1.bat');
  1200.     rewrite (batchf);
  1201.     writeln (batchf,'echo off');     
  1202.     if area.xmodemdir[length(area.xmodemdir)]='\'
  1203.     then
  1204.     cddir:=copy(area.xmodemdir,1,length(area.xmodemdir)-1)
  1205.     else
  1206.     cddir:=area.xmodemdir;
  1207.     writeln (batchf,'mov.bat ',zn,' ',cddir,'\',p);
  1208.     textclose (batchf);
  1209.     Temp := DOS_exec('c:\command.com /c move1.bat',FALSE,FALSE);
  1210.     setparam(usecom,baudrate,parity);
  1211.     assign (f,'move1.bat');
  1212.     erase (f);
  1213.     assign (f,'mov.bat');
  1214.     erase (f);
  1215.     if area.xmodemdir[length(area.xmodemdir)]>'\'
  1216.     then
  1217.     ud.path:=copy(area.xmodemdir,1,length(area.xmodemdir)-1)
  1218.     else
  1219.     ud.path:=area.xmodemdir;
  1220.     ud.newfile:=false;
  1221.     getfsize(ud);
  1222.     if ud.filesize=-1 then begin
  1223.     writestr ('I can''t open the file in current directory! Continue? (Y/N): *');
  1224.     if not yes then exit
  1225.     end;
  1226.     addfile (ud);
  1227.     chdir (dirsave);
  1228.     setarea (oldn);
  1229.     removefile (fn);
  1230.     writeln;
  1231.     writeln (^B'The file has been moved from the current area & directory!');
  1232.   end;
  1233.  
  1234.   procedure renamefile;
  1235.   var fn:integer;
  1236.       ud:udrec;
  1237.       f:file;
  1238.   begin
  1239.     fn:=getfilenum ('rename');
  1240.     if fn=0 then exit;
  1241.     seekudfile (fn);
  1242.     read (udfile,ud);
  1243.     writestr ('Enter new filename:');
  1244.     if match(input,ud.filename)
  1245.       then
  1246.         ud.filename:=input
  1247.       else if length(input)>0
  1248.         then if validfname(input)
  1249.           then if exist(getfname(ud.path,input))
  1250.             then
  1251.               writeln ('Name already in use!')
  1252.             else
  1253.               begin
  1254.                 assign (f,getfname(ud.path,ud.filename));
  1255.                 rename (f,getfname(ud.path,input));
  1256.                 if ioresult=0 then begin
  1257.                   ud.filename:=input;
  1258.                   writeln (^B^M'File renamed.')
  1259.                 end else writeln (^B^M'Unable to rename file!')
  1260.               end
  1261.           else writeln ('Invalid filename!');
  1262.     seekudfile (fn);
  1263.     write (udfile,ud)
  1264.   end;
  1265.  
  1266.   procedure listxmodem;
  1267.   var cnt:integer;
  1268.       u:userrec;
  1269.   begin
  1270.     seek (ufile,1);
  1271.     writeln ('Name                          Lvl Pts'^M);
  1272.     for cnt:=1 to numusers do begin
  1273.       read (ufile,u);
  1274.       if u.handle<>'' then
  1275.         if u.udlevel>0 then begin
  1276.           tab (u.handle,30);
  1277.           tab (strr(u.udlevel),4);
  1278.           writeln (u.udpoints);
  1279.           if break then exit
  1280.         end
  1281.     end
  1282.   end;
  1283.  
  1284.   procedure reorderareas;
  1285.   var numa,cura,newa:integer;
  1286.       a1,a2:arearec;
  1287.       f1,f2:file;
  1288.       fn1,fn2:sstr;
  1289.   label exit;
  1290.   begin
  1291.     writelog (16,9,'');
  1292.     writehdr ('Re-order Areas');
  1293.     numa:=filesize (afile);
  1294.     writeln ('Number of areas: ',numa);
  1295.     for cura:=0 to numa-2 do begin
  1296.       repeat
  1297.         writestr ('New area #'+strr(cura+1)+' [?=List, CR to quit]:');
  1298.         if length(input)=0 then goto exit;
  1299.         if input='?'
  1300.           then
  1301.             begin
  1302.               listareas;
  1303.               newa:=-1
  1304.             end
  1305.           else
  1306.             begin
  1307.               newa:=valu(input)-1;
  1308.               if (newa<0) or (newa>numa) then begin
  1309.                 writeln ('Not found!  Please re-enter...');
  1310.                 newa:=-1
  1311.               end
  1312.             end;
  1313.       until (newa>=0);
  1314.       seek (afile,cura);
  1315.       read (afile,a1);
  1316.       seek (afile,newa);
  1317.       read (afile,a2);
  1318.       seek (afile,cura);
  1319.       write (afile,a2);
  1320.       seek (afile,newa);
  1321.       write (afile,a1);
  1322.       fn1:='Area';
  1323.       fn2:=fn1+strr(newa+1);
  1324.       fn1:=fn1+strr(cura+1);
  1325.       assign (f1,fn1);
  1326.       assign (f2,fn2);
  1327.       rename (f1,'Temp$$$$');
  1328.       rename (f2,fn1);
  1329.       rename (f1,fn2)
  1330.     end;
  1331.     exit:
  1332.     setarea (1)
  1333.   end;
  1334.  
  1335.   procedure newfiles;
  1336.   var a,fn,un:integer;
  1337.       ud:udrec;
  1338.       u:userrec;
  1339.       flag,aborted:boolean;
  1340.  
  1341.     procedure writeudrec;
  1342.     begin
  1343.       seekudfile (fn);
  1344.       write (udfile,ud)
  1345.     end;
  1346.  
  1347.     procedure ratefile (p:integer);
  1348.     begin
  1349.       ud.points:=p;
  1350.       ud.newfile:=false;
  1351.       ud.whenrated:=now;
  1352.       writeudrec;
  1353.       p:=p*uploadfactor;
  1354.       if p>0 then begin
  1355.         un:=lookupuser (ud.sentby);
  1356.         if un=0
  1357.           then writeln (ud.sentby,' has vanished!')
  1358.           else begin
  1359.             writeln ('Granting ',ud.sentby,' ',p,' points.');
  1360.             if un=unum then writeurec;
  1361.             seek (ufile,un);
  1362.             read (ufile,u);
  1363.             u.udpoints:=u.udpoints+p;
  1364.             seek (ufile,un);
  1365.             write (ufile,u);
  1366.             if un=unum then readurec
  1367.           end
  1368.       end
  1369.     end;
  1370.  
  1371.     procedure doarea;
  1372.     var i,advance:integer;
  1373.         done:boolean;
  1374.     begin
  1375.       fn:=1;
  1376.       advance:=0;
  1377.       while fn+advance<=numuds do begin
  1378.         fn:=fn+advance;
  1379.         advance:=1;
  1380.         seekudfile (fn);
  1381.         read (udfile,ud);
  1382.         if ud.newfile then begin
  1383.           flag:=false;
  1384.           done:=false;
  1385.           repeat
  1386.             writeln (^B^M'Filename:    ',ud.filename,
  1387.                        ^M'Path:        ',ud.path,
  1388.                        ^M'Sent by:     ',ud.sentby,
  1389.                        ^M'File size:   ',ud.filesize,
  1390.                        ^M'Description: ',ud.descrip);
  1391.             i:=menu ('Newscan','NEWSCAN','Q#_CEDRM0');
  1392.             input:=' '+strr(fn);
  1393.             if i<0
  1394.               then
  1395.                 begin
  1396.                   ratefile(-i);
  1397.                   done:=true
  1398.                 end
  1399.               else
  1400.                 case i of
  1401.                   1:begin
  1402.                       aborted:=true;
  1403.                       exit
  1404.                     end;
  1405.                   3:done:=true;
  1406.                   4:begin
  1407.                       buflen:=50;
  1408.                       writestr ('                       0        1         2         3         4         5');
  1409.                       writestr ('    50 Characters Max! 1---!----0----!----0----!----0----!----0----!----0');
  1410.                       writestr ('Enter new description:');
  1411.                       if length(input)>0 then ud.descrip:=input;
  1412.                       writeudrec
  1413.                     end;
  1414.                   5:begin
  1415.                       renamefile;
  1416.                       advance:=0
  1417.                     end;
  1418.                   6:begin
  1419.                       deletef;
  1420.                       advance:=0
  1421.                     end;
  1422.                   7:listarchive;
  1423.                   8:begin
  1424.                       movefile;
  1425.                       advance:=0
  1426.                     end;
  1427.                   9:begin
  1428.                       ratefile (0);
  1429.                       done:=true
  1430.                     end
  1431.                 end
  1432.           until done or (advance=0)
  1433.         end
  1434.       end
  1435.     end;
  1436.  
  1437.   begin
  1438.     flag:=true;
  1439.     writelog (16,1,'');
  1440.     if issysop then begin
  1441.       writestr ('Scan all areas? *');
  1442.       if yes then begin
  1443.         for a:=1 to numareas do begin
  1444.           setarea (a);
  1445.           aborted:=false;
  1446.           doarea;
  1447.           if aborted then exit
  1448.         end
  1449.       end else doarea
  1450.     end else doarea;
  1451.     if flag then writeln (^B'No new files.')
  1452.   end;
  1453.  
  1454.   procedure sysopcommands;
  1455.   var i:integer;
  1456.   begin
  1457.     if not sponsoron then begin
  1458.       reqlevel (sysoplevel);
  1459.       exit
  1460.     end;
  1461.     writelog (15,3,area.name);
  1462.     repeat
  1463.       i:=menu('File sponsor','FSYSOP','A@CDF@G@KRNSMLO@QEW@');
  1464.       case i of
  1465.         1:sysopadd;
  1466.         2:changef;
  1467.         3:deletef;
  1468.         4:directory;
  1469. {        5:generatelist; }
  1470.         6:killarea;
  1471.         7:modarea;
  1472.         8:newfiles;
  1473.         9:sortarea;
  1474.         10:movefile;
  1475.         11:listxmodem;
  1476.         12:reorderareas;
  1477.         14:renamefile;
  1478.         15:addmultiplefiles
  1479.       end
  1480.     until hungupon or (i=13)
  1481.   end;
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487. var i:integer;
  1488.     a:arearec;
  1489.     ms:boolean;
  1490. label ok,exit;
  1491. begin
  1492.   cursection:=udsysop;
  1493.   ms:=false;
  1494.   writehdr ('The File Transfer Section');
  1495.   input:='';
  1496.   assign (afile,'areadir');
  1497.   if exist ('Areadir')
  1498.     then
  1499.       begin
  1500.         reset (afile);
  1501.         if filesize (afile)>0 then goto ok
  1502.       end
  1503.     else rewrite (afile);
  1504.   writeln ('No areas have been defined!');
  1505.   area.xmodemdir:=forumdir+'XMODEM\';
  1506.   if issysop
  1507.     then if makearea
  1508.       then goto ok;
  1509.   goto exit;
  1510.   ok:
  1511.   seekafile (1);
  1512.   read (afile,a);
  1513.   if urec.udlevel<a.level then begin
  1514.     writeln ('Sorry, you can''t access the first area!');
  1515.     goto exit
  1516.   end;
  1517.   yourudstatus;
  1518.   setarea (1);
  1519.   repeat
  1520.     if withintime (xmodemclosetime,xmodemopentime) then
  1521.       if not issysop then begin
  1522.         writestr (^M^M'Sorry, the XMODEM section is closed now!');
  1523.         writeln ('The time now is: '^S,timestr(now));
  1524.         writeln ('It will open 1 minute after: '^S,xmodemopentime);
  1525.         goto exit
  1526.       end else if not ms then begin
  1527.         writeln ('(The XMODEM section is closed until ',xmodemopentime,')');
  1528.         ms:=true
  1529.       end;
  1530.     write (^B^M^M,area.name,' [',curarea,']'^B);
  1531.     i:=menu('File','FILE','UDLFYA*SQ%NVHREWXTZ');
  1532.     if hungupon then goto exit;
  1533.     case i of
  1534.       1:upload;
  1535.       2:download (0);
  1536.       3:listfiles (false);
  1537.       4:sendmailto (LookUpUser(area.sponsor),false);
  1538.       5:yourudstatus;
  1539.       6,7:getarea;
  1540.       8:searchfile;
  1541.       10:sysopcommands;
  1542.       11:newscanall;
  1543.       12:newscan;
  1544.       13:help ('Filexfer.hlp');
  1545.       14:listarchive;
  1546.       15:if exist (textfiledir+'arclist') then printfile (textfiledir+'arclist')
  1547.          else writestr ('You must first list the contents of an archive file before you can RELIST it!');
  1548.       16,17:listfiles (true);
  1549.       18:typefile;
  1550.       19 : {ZipSortArea} ;
  1551.     end
  1552.   until hungupon or (i=9);
  1553.   exit:
  1554.   close (afile);
  1555.   close (udfile);
  1556.   i:=ioresult
  1557. end;
  1558.  
  1559.  
  1560. begin
  1561. end.
  1562.  
  1563.