home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 189.img / TCS120S.ZIP / DOEXT.PAS < prev    next >
Pascal/Delphi Source File  |  1989-03-21  |  6KB  |  163 lines

  1.   function doext (mode,proto:char; uddir,fn:lstr; baud,comm:integer):integer;
  2.   var cmdline,switches,dirsave,cddir:lstr;
  3.       baudst,commst:mstr;
  4.       retcd:integer;
  5.  
  6.   function getdszfn:mstr;
  7.   begin
  8.    if exist (forumdir+'DSZ.COM') then getdszfn:='DSZ.COM'
  9.    else if exist (forumdir+'DSZ.EXE') then getdszfn:='DSZ.EXE';
  10.   end;
  11.  
  12.   function getjmodemfn:mstr;
  13.   begin
  14.    if exist (forumdir+'JMODEM.COM') then getjmodemfn:='JMODEM.COM'
  15.    else if exist (forumdir+'JMODEM.EXE') then getjmodemfn:='JMODEM.EXE';
  16.   end;
  17.  
  18.   function getlynxfn:mstr;
  19.   begin
  20.    if exist (forumdir+'LYNX.EXE') then getlynxfn:='LYNX.EXE'
  21.    else if exist (forumdir+'LYNX.COM') then getlynxfn:='LYNX.COM';
  22.   end;
  23.  
  24.   function getsuperkfn:mstr;
  25.   begin
  26.    if exist (forumdir+'SUPERK.COM') then getsuperkfn:='SUPERK.COM'
  27.    else if exist (forumdir+'SUPERK.EXE') then getsuperkfn:='SUPERK.EXE';
  28.   end;
  29.  
  30.   begin
  31.     getdir (0,dirsave);  { drive: 0 = cur. 1 = A: etc. - save cur. dir. }
  32.   { dirsave:=forumdir;
  33.     if dirsave[length(dirsave)]<>'\' then dirsave:=dirsave+'\'; }
  34.     if uddir[length(uddir)]='\'
  35.     then cddir:=copy(uddir,1,length(uddir)-1)
  36.     else cddir:=uddir;
  37.     writeln (usr,^M'[Changing Directories to '+cddir+']'^M);
  38.     chdir (cddir);
  39.   { cddir:='';
  40.     cddir:=cddir+uddir;
  41.     if uddir[length(uddir)]<>'\'then cddir:=cddir+'\';
  42.     cddir:=cddir+fn; }
  43.     str (baud:3,baudst);
  44.     str (comm:1,commst);
  45.     if mode='R' then begin
  46.       case proto of
  47.         'Z':cmdline:=dirsave+'\'+getdszfn;
  48.         'J':cmdline:=dirsave+'\'+getjmodemfn;
  49.         'L':cmdline:=dirsave+'\'+getlynxfn;
  50.         'G':cmdline:=dirsave+'\'+getdszfn;
  51.         'O':cmdline:=dirsave+'\'+getdszfn;
  52.         '1':cmdline:=dirsave+'\'+getdszfn;
  53.         'S':cmdline:=dirsave+'\'+getsuperkfn;
  54.         'K':cmdline:=dirsave+'\'+getsuperkfn;
  55.         'R':cmdline:=dirsave+'\'+getdszfn;
  56.         'P':cmdline:=dirsave+'\'+getdszfn;
  57.       end
  58.     end;
  59.     if mode='R' then begin
  60.       case proto of
  61.         'Z':switches:=' port '+strr(dszport)+' speed '+baudst+' rz '+fn;
  62.         'J':switches:=' R'+commst+' '+cddir+'\'+fn;
  63.         'L':switches:=' R /'+commst+' /'+baudst+' '+cddir;
  64.         'G':switches:=' port '+strr(dszport)+' speed '+baudst+' rb -g '+fn;
  65.         'O':switches:=' port '+strr(dszport)+' speed '+baudst+' rx -o '+fn;
  66.         '1':switches:=' port '+strr(dszport)+' speed '+baudst+' rb -o '+fn;
  67.         'S':switches:='';
  68.         'K':switches:='';
  69.         'R':switches:=' port '+strr(dszport)+' speed '+baudst+' rz -r '+fn;
  70.         'P':switches:=' port '+strr(dszport)+' speed '+baudst+' rz -w '+fn;
  71.       end
  72.     end;
  73.     if mode='S' then begin
  74.       case proto of
  75.         'Z':cmdline:=dirsave+'\'+getdszfn;
  76.         'J':cmdline:=dirsave+'\'+getjmodemfn;
  77.         'L':cmdline:=dirsave+'\'+getlynxfn;
  78.         'G':cmdline:=dirsave+'\'+getdszfn;
  79.         'O':cmdline:=dirsave+'\'+getdszfn;
  80.         '1':cmdline:=dirsave+'\'+getdszfn;
  81.         'S':cmdline:=dirsave+'\'+getsuperkfn;
  82.         'K':cmdline:=dirsave+'\'+getsuperkfn;
  83.         'R':cmdline:=dirsave+'\'+getdszfn;
  84.         'P':cmdline:=dirsave+'\'+getdszfn;
  85.       end
  86.     end;
  87.     if mode='S' then begin
  88.       case proto of
  89.         'Z':switches:=' port '+strr(dszport)+' speed '+baudst+' sz '+fn;
  90.         'J':switches:=' S'+commst+' '+fn;
  91.         'L':switches:=' S /'+commst+' /'+baudst+' '+fn;
  92.         'G':switches:=' port '+strr(dszport)+' speed '+baudst+' sb -g '+fn;
  93.         'O':switches:=' port '+strr(dszport)+' speed '+baudst+' sx -o '+fn;
  94.         '1':switches:=' port '+strr(dszport)+' speed '+baudst+' sb -o '+fn;
  95.         'S':switches:='';
  96.         'K':switches:='';
  97.         'R':switches:=' port '+strr(dszport)+' speed '+baudst+' sz -r '+fn;
  98.         'P':switches:=' port '+strr(dszport)+' speed '+baudst+' sz -w '+fn;
  99.       end
  100.     end;
  101.     write (^B);
  102.     if (proto='Z') or (proto='G') or (proto='O') or (proto='1') or (proto='R')
  103.     or (proto='P') then
  104.     begin
  105.      if (not exist (dirsave+'\DSZ.COM')) and (not exist (dirsave+'\DSZ.EXE'))
  106.      then begin
  107.       writeln;
  108.       writeln (^G^R'DSZ Protocols are not available at the moment!');
  109.       writeln ('Sysop does not have DSZ.COM or DSZ.EXE in the current directory.');
  110.       writeln ('Please notify him!');
  111.       writeln;
  112.       writeln (usr,^M'[Changing Directories back to '+dirsave+']');
  113.       chdir (dirsave);
  114.       exit;
  115.      end;
  116.     end;
  117.     if (proto='J') then begin
  118.      if not exist (dirsave+'\JMODEM.COM') then
  119.      begin
  120.       writeln;
  121.       writeln (^G^R'Jmodem Protocol is not available at the moment!');
  122.       writeln ('Sysop does not have JMODEM.COM in the current directory.');
  123.       writeln ('Please notify him!');
  124.       writeln;
  125.       writeln (usr,^M'[Changing Directories back to '+dirsave+']');
  126.       chdir (dirsave);
  127.       exit;
  128.      end;
  129.     end;
  130.     if (proto='L') then begin
  131.      if not exist (dirsave+'\LYNX.EXE') then
  132.      begin
  133.       writeln;
  134.       writeln (^G^R'Lynx Protocol is not available at the moment!');
  135.       writeln ('Sysop does not have LYNX.EXE in the current directory.');
  136.       writeln ('Please notify him!');
  137.       writeln;
  138.       writeln (usr,^M'[Changing Directories back to '+dirsave+']');
  139.       chdir (dirsave);
  140.       exit;
  141.      end;
  142.     end;
  143.     if ((proto='K') or (proto='S')) then begin
  144.      if not exist (dirsave+'\SUPERK.COM') then
  145.      begin
  146.       writeln;
  147.       writeln (^G^R'Super8k/K9Xmodem Protocol is not available at the moment!');
  148.       writeln ('Sysop does not have SUPERK.COM in the current directory.');
  149.       writeln ('Please notify him!');
  150.       writeln;
  151.       writeln (usr,^M'[Changing Directories back to '+dirsave+']');
  152.       chdir (dirsave);
  153.       exit;
  154.      end;
  155.     end;
  156.     starttimer (numminsxfer);
  157.     runext (retcd,cmdline,switches);
  158.     stoptimer (numminsxfer);
  159.     writeln (usr,^M'[Changing Directories back to '+dirsave+']');
  160.     chdir (dirsave);
  161.     doext:=retcd;
  162.     setparam (usecom,baudrate,parity);
  163.   end;