home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / cdcr206a.zip / CDMAINT.CMD < prev    next >
OS/2 REXX Batch file  |  1995-10-29  |  18KB  |  51 lines

  1. /*                           CD Carousel                                   */
  2. /*                         by Bill Esposito                                */
  3. /*                              v2.06a                                     */  
  4. /*                       The Cereal Port BBS                               */
  5. /*                            1:132/152                                    */
  6. /*                          (603)899-3335                                  */
  7. /*                                                                         */
  8. /*                         Magic name 'CDCAR'                              */
  9. /*                         for latest version                              */
  10. /*                                                                         */
  11. /* *********************************************************************** */
  12. /* DISCLAIMER:  This software is provided "AS IS" without any warranty of  */
  13. /* any kind, either expressed or implied.  USE IT AT YOUR OWN RISK.        */
  14. /*                                                                         */
  15. /* Copyright 1993, 1994, 1995 by Bill Esposito.  This program is SHAREWARE.*/
  16. /* Please read the file SHAREWRE.TXT included in this archive.             */
  17. /*                                                                         */
  18. /* CD Carousel and it's support programs are not to be modified or         */
  19. /* distributed in modified form without the express written permission of  */
  20. /* The author, Bill Esposito.                                              */
  21. /* *********************************************************************** */
  22. /*                   *****    CDMAINT.CMD   *****                          */
  23. /* Utility to copy requested files to the BBS, update the files.bbs, and   */
  24. /* send an acknowlegement message to the user.                             */
  25. /***************************************************************************/
  26. Arg task me def;def1=def;config=cdcar''task'.cfg';'@echo off' ;f=1;do until lines(config)=0;  param.f=linein(config);  f=f+1;end;ok=stream(config,c,'close');parse var param.3 homedir junk;parse var param.4 maxdir junk;parse var param.5 download junk;parse var param.6 fnum junk;parse var param.7 type junk;parse var param.8 marea junk;parse var param.9 tnode junk;parse var param.10 fnode junk;parse var param.11 sysopfirst sysoplast nextname nextname2 junk;parse var param.14 private junk
  27. parse var param.15 pl junk;parse var param.17 standalone junk;parse var param.20 touch junk;parse var param.21 days junk;configcd=homedir''cdcar||task'.cfg';f=1;do until lines(configcd)=0;  if f > 24 then default.f=linein(configcd);  else scrap=linein(configcd);  f=f+1;end;cdes=f-24 ;if cdes=1 then cdes=2;ok=stream(configcd,c,'close');sys=homedir''cdcar||task'.sys';f=1;if touch=1 then plus='+ ,,';else plus='';qt=1;fi.1=''
  28. fi.2='';fi.3='';fi.4='';fi.5='';fi.6='';fi.7='';fi.8='';fi.9='';fi.10='';if left(sysopfirst,1)=';' then sysoplast='';if nextname <>'NEXTNAME' then if left(nextname,1)<>';' then sysoplast=sysoplast nextname;if left(nextname,1)<>';' then if nextname2 <>'NEXTNAME2' then if left(nextname2,1)<>'' then sysoplast=sysoplast nextname2;;angrn=''      ;anyel=''      ;anred=''      ;anblu=''      ;ancyan=''     ;anbrt=''    ;angry='
  29. anlo=''  ;;yel='ÅÄ' ;mag=''     ;grn='é'     ;cyan='â'    ;               ;uold='1time';if def=1 then tb='';call RxFuncAdd 'SysloadFuncs','RexxUtil','Sysloadfuncs';call sysloadfuncs;file=homedir'disk.lst'   ;;ok=stream(file,c,'close')     ;do until lines(file)=0;   PARSE VALUE linein(file) with priv lock disk diskdesc;   u=1;   paramno=24;   do while u < cdes;       paramno=paramno+1
  30.        parse upper var default.paramno dcd2 junk;       parse upper var disk curcd;       if dcd2=curcd then dcd=curcd;       u=u+1;   end    ;   if dcd=curcd then def=1 ;   else def=0;   if def <>1 then if def1 <> 1 then call insert;   call move;   ok=stream(file1,c,'close');   call sysfiletree file1,'stem.','F';   if def=1 then if stem.0<>0 then del homedir''disk'.d'task' >nul';   if stem.0<>0 then if def <> 1 then del homedir''disk'.r'task' >nul'; end;ok=stream(homedir'disk.lst',c,'close')     ;ok=stream(download'files.bbs',c,'close');if def <> 1 then if def1 <>1 then call default;if me=1 then call cdmenu.cmd task;exit          ;
  31. move:  ;if def=1 then file1=homedir''disk'.d'task;else file1=homedir''disk'.r'task;if def1=1 then file1=homedir''disk'.d'task;ok=stream(file1,c,'close')  ;call sysfiletree file1,'stem.','F';if stem.0<>1 then return;ok=stream(file1,c,'open')  ;do until lines(file1)=0;    parse value linein(file1) with nmi alias three four five six seven eight nine ten eleven twelve thirteen;    if alias='YES' then do;      first=three;      mid='';      last='';      priv=four;      lock=five;      directory=six;      filename=seven;      size=eight;      datee=nine
  32.       desc=ten eleven twelve thirteen;    end;    if nmi='YES' then if alias='NO' then do;      first=three;      mid='';      last=four;      priv=five;      lock=six;      directory=seven;      filename=eight;      size=nine;      datee=ten;      desc=eleven twelve thirteen;    end;    if nmi='NO' then if alias='NO' then do;      first=three;      mid=' 'four;      last=five;      priv=six;      lock=seven
  33.       directory=eight;      filename=nine;      size=ten;      datee=eleven;      desc=twelve thirteen;    end;    if nmi='NO4' then if alias='NO' then do;      first=three;      mid=' 'four;      last=five six;      priv=seven;      lock=eight;      directory=nine;      filename=ten;      size=eleven;      datee=twelve;      desc=thirteen;    end;priva=priv;locka=lock    
  34.     ;        uname = FIRST||MID LAST ;        if uold = '1time' then oldfirst=first;        if uold = '1time' then uold=uname;        if uname<>uold then call mail;        else if qt > 10 then call mail ;    oldfirst=first;  /*  uname=uold */;    cls;    if directory='' then directory=poop;    dr=homedir||disk'\names.lst';    ok=stream(dr,c,'close');    call sysfilesearch directory,dr,'good.';    if good.0<>0  then do ;      if all<>'A'then if def <> 1 then do;       if pl=0 then do ;       call status1;                  say;         say anbrt||ancyan'The file 'anblu||filename||ancyan' was requested by 'anred||FIRST||MID LAST||ancyan;         say 'The current Privilege is 'anred||priv||ancyan' and the current Lock is 'anred||lock||ancyan
  35.          say 'Do you wish to change this? (y,N,'anyel'ne'ancyan'v'anyel'er'ancyan')';         say;         say 'Enter neVer if you want to skip this question for all files. ';         say;         say'                    Select:';         call syscurpos 7, 27;         pull ans;         answer=left(ans,1);         if answer = '' then answer = 'N' ;         if answer='V' then all='A'  ;          if answer = 'Y' then do;            cls;            say;            say anblu'If a file is already online, the priv/lock will not be changed'ancyan;            say;            say ' The current Privilege is 'anred||priv||ancyan', Enter the new privilege';            say ' (T,D,L,N,W,P,F,E,C,A,S, <ENTER> for no change)';            pull newpriv;             if newpriv <>'T' then if newpriv <>'D' then if newpriv <>'L' then if newpriv <>'N' then if newpriv <>'W' then if newpriv <>'P' then if newpriv <>'F' then if newpriv <>'E' then if newpriv <>'C' then if newpriv <>'A' then if newpriv <>'S' then if newpriv <>'' then newpriv='';            say ' The current Lock is 'anred||lock||ancyan', Enter the new lock'
  36.             say ' 1,2,3,4,5,6,7,8,% for none,<ENTER> for no change)';            pull newlock;             if newlock >8 then if newlock <> '%' then if newlock <>'' then newlock = '';          end ;    if newpriv <>'' then if newpriv <>'NEWPRIV' then if answer='Y' then priv=newpriv;    if newlock <>'' then if newlock <>'NEWLOCK' then if answer='Y' then lock=newlock;    call status;      end;  if pl=1 then do;say '10' ten;say '11' eleven;say '12' twelve;say '13' thirteen;;         say;         say anbrt||ancyan'Do you want 'anblu||filename||ancyan' to be a free download for 'anred||FIRST||MID LAST||ancyan'?';         say '                   1. Free Time (/t) ';         say '                   2. Free Bytes(/b) ';         say '                   3. Both Free (/tb)';         say '                   4. Full Charge (nothing added to files.bbs)' 
  37.          say;         say ' Add an "a" to your selection if you want this for ALL files. (ex. 2a)';         say;         say'                    Select:';         pull ans;         answer=left(ans,1);         if length(ans)=2 then do;            all=right(ans,1);         end   ;           if answer=1 then tb='/t';           if answer=2 then tb='/b';           if answer=3 then tb='/tb';           if answer=4 then tb='';           if datatype(answer)<>"NUM" then tb='';           if answer <1 then if answer >4 then tb=''    ;           if all='A'then this='ALL files';               else this='this file';         bt=tb;         if tb='' then bt='nothing'      ;         say
  38.          say ' Ok, 'bt' will be added to the files.bbs for 'this;         say;end;end;end;copy:      ;   if all='A' then call status;   if def=1 then call status;if def=1 then say 'Please wait, copying files.........';   file3=download''filename;   call sysfiletree file3,'stem3.','F';;   if stem3.0=0 then do; ;      copy '/b' directory'\'filename plus||download'\'filename;      say 'Updating Files.bbs with 'filename;      call lineout homedir'request.log',uname'    'filename'    'date();      call lineout maxdir'names'task'.dl',filename uname;   end;        else rc=0
  39.    if stem3.0=1 then do;   b=1;   call sysfiletree download'files.car','stem6.','F';   if stem6.0<>0 then '@del' download'files.car >nul'     ;   ;    ok=stream(download'files.bbs',c,'close');     do until lines(download'files.bbs')=0;        bbsfile.b=linein(download'files.bbs');        if pl=0 then do;        parse var bbsfile.b priv filnamc rest;        filnams=strip filnamc;        legth=length(filnamc);        if legth < 9 then filnam=filnamc;        else filnam=right(filnamc,(legth-8));        end;        if pl=1 then parse var bbsfile.b filnam rest;        if filnam=filename then do;           bbsfiler.b=reverse(bbsfile.b);           parse var bbsfiler.b qtt rest;           qtt=reverse(qtt)+1
  40.            bbsfiler.b = strip(rest);           bbsfile.b=reverse(bbsfiler.b) qtt;      copy '/b' directory'\'filename plus||download'\'filename;           say 'Updating Files.bbs with 'filename;           call lineout homedir'request.log',uname'    'filename'    'date();           call lineout maxdir'names'task'.dl',filename uname;        end;         call lineout download'files.car', bbsfile.b;         b=b+1;       end;        end ;            ok=stream(download'files.bbs',c,'close');    ok=stream(download'files.car',c,'close')   ;  call sysfiletree download'files.car','stem4.','F';  if stem4.0<>0 then do;    '@copy' download'files.car' download'files.bbs >nul';    '@del' download'files.car >nul'     ;  end      ;;         ca=''
  41.            if rc <> 0 then if def1 <> 1 then do ;          say;          say 'Error copying file.  This usually means you have the wrong CD inserted';          say;          say 'Either correct the problem and then hit "C" for continue, or hit "A" to abort';          say 'this file';          pull ca;          if ca = 'C' then copy '/b' directory'\'filename plus||download'\'filename;          else nop;            if rc <>0 then if ca <> 'A' then if def1 <> 1 then do;              say;              say 'There is still an error, the file was not copied.';              say 'Press <enter> to continue';              pull ent;              ca='A';            end;              if rc <>0 then if ca = 'A' then do;              call lineout homedir'errors.log', disk nmi alias first mid last priva locka directory filename size datee desc ;;                ok=stream(homedir'errors.lst',c,'close')
  42.               end;         end;      if rc=0 then if stem3.0=0 then do;        attrib '-r' download''filename '>nul';        fbbs= download'files.bbs';         if pl=0 then call lineout download||files.bbs,priv||lock||yel||left(filename,13)||mag||right(size,8)||grn||right(datee,9)'  'cyan||strip(desc)' 1';        if pl=1 then  call lineout download||files.bbs,filename tb strip(desc)' 1';          end;        data=left(filename,12)'  'desc;           if ca <> 'A' then call merge;     /* end        */; /*   end  */;  end;if ca <> 'A' then call mail;    ;return;insert:;file1=homedir''disk'.r'task;ok=stream(file1,c,'close');
  43. call sysfiletree file1,'stem.','F';;if stem.0<>1 then return;cls;say;say;say;say;say'  Please insert the CD labled 'disk 'into the drive.';say;say'  Press any key when ready';pull any;uold='1time';return;;default:;cls;say;say;say
  44. say;say'  Please insert the Original CD into the drive.';say;say'  Press any key when ready';pull any;return;mail:;if def=1 then return;if standalone=1 then return;if days <> 0 then dayson='These files will remain online for 'days' days from the date of this message.' ;else dayson='';hdr='Hello 'OLDFIRST',';tail='---  Files brought to you by CD Carousel';sig='  Enjoy `em,';/* MSGAPI */;address CMD 'rxsubcom drop msgapi';address CMD 'rxsubcom register MSGAPI rxmsgapi RXMSGAPI';address CMD 'rxsubcom load MSGAPI RXMSGAPI';address MSGAPI;'OPEN_API 3 0'
  45. 'OPEN_AREA MSG 'marea' MSGAREA_NORMAL 'TYPE;'LOCK MSG';'OPEN_MSG MSGH MSG MOPEN_CREATE 0';cr = '0d'x;if fi.1 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr dayson cr cr fi.1 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.2 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.3 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.4 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.5 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.6 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.7 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr fi.7 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.8 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr fi.7 cr fi.8 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.9 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr fi.7 cr fi.8 cr fi.9 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.10 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr fi.7 cr fi.8 cr fi.9 cr fi.10 cr cr sig cr '    'sysopfirst cr cr tail cr;controla = '01'x;control = controla || 'PID RXMSGAPI';xmsg.attr = private;xmsg.from = SYSOPFIRST SYSOPLAST;xmsg.to = strip(uold);xmsg.subj = 'Your File Request'
  46. xmsg.orig = tnode;xmsg.dest = fnode;hour=time('N');date2=date('S');year=left(date2,4);month=substr(date2,5,2);day=right(date2,2);date1=year'/'month'/'day':'hour;xmsg.date_written = date1;xmsg.date_arrived = date1;xmsg.utc_ofs = 60;xmsg.replyto = 0;xmsg.replies.1 = 0;xmsg.replies.2 = 0;xmsg.replies.3 = 0;xmsg.replies.4 = 0;xmsg.replies.5 = 0;xmsg.replies.6 = 0;xmsg.replies.7 = 0;xmsg.replies.8 = 0
  47. xmsg.replies.9 = 0;xmsg.replies.10 = 0;xmsg.ftsc_date = date('N') time('N');'WRITE_MSG MSGH 0 XMSG. TEXT' length(text) length(text) length(control) 'CONTROL';'CLOSE_MSG MSGH';'UNLOCK MSG';'CLOSE_AREA MSG';'CLOSE_API';address CMD 'rxsubcom drop msgapi';call syssleep 3;fi.1='';fi.2='';fi.3='';fi.4='';fi.5='';fi.6='';fi.7='';fi.8='';fi.9='';fi.10=''
  48. qt=1;uold=uname;return;;merge:;fi.qt = data;qt=qt+1;return;;status:;if left(priv,1)='T' then priv=0;if left(priv,1)='D' then priv=1;if left(priv,1)='L' then priv=2;if left(priv,1)='N' then priv=3;if left(priv,1)='W' then priv=4;if left(priv,1)='P' then priv=5;if left(priv,1)='F' then priv=6;if left(priv,1)='E' then priv=7;if left(priv,1)='C' then priv=8;if left(priv,1)='A' then priv=9
  49. if left(priv,1)='S' then priv=10;IF priv=0 then priv ='LT';IF priv=1 then priv ='LD';IF priv=2 then priv ='LL';IF priv=3 then priv ='LN';IF priv=4 then priv ='LW';IF priv=5 then priv ='LP';IF priv=6 then priv ='LF';IF priv=7 then priv ='LE';IF priv=8 then priv ='LC';IF priv=9 then priv ='LA';IF priv=10 then priv ='LS';IF lock= 1 then lock ='kI1 ';IF lock= 2 then lock ='kI2 ';IF lock= 3 then lock ='kI3 ';IF lock= 4 then lock ='kI4 ';IF lock= 5 then lock ='kI5 ';IF lock= 6 then lock ='kI6 ';IF lock= 7 then lock ='kI7 ';IF lock= 8 then lock ='kI8 '
  50. IF lock= '%' then lock=' ';if left(lock,1)='N' then lock=' ';return;status1:;IF priv=0 then priv ='Twit';IF priv=1 then priv ='Disgrace';IF priv=2 then priv ='Limited';IF priv=3 then priv ='Normal';IF priv=4 then priv ='Worthy';IF priv=5 then priv ='Privel';IF priv=6 then priv ='Favored';IF priv=7 then priv ='Extra';IF priv=8 then priv ='Clerk';IF priv=9 then priv ='AstSysop';IF priv=10 then priv ='Sysop';IF lock= '' then lock='None';IF lock= '%' then lock='None';return;IN.524;IN.525
  51.