/**************************************************************************\
    $VER: SuperTags Update, v2.51 (4-Aug-97) by Dotoran of Frontiers!
\**************************************************************************/
options results;signal on SYNTAX;signal on ERROR;signal on IOERR
a=sourceline(2);parse var a . ", "ver" ("vdate")" .;a=random(,,time("s"))
tr=transmit;se=sendstring;gc=getchar;gu=getuser;gs=getscratch;mg=maygetchar
a="rexxsupport.library";if ~show("l",a) then if ~addlib(a,0,-30) then exit
parse source . . fp .;df=left(fp,max(lastpos('/',fp),lastpos(':',fp)))

tr "f1SuperTags, "ver" Update Filen1"

call open(f1,df"!STags.cfg","r");a=readln(f1);call close(f1)
if left(a,5)~="v2.50" then do
  se "Error: You need to be using the 2.50 version of SuperTags before "
  tr "attempting to update to v2.51!" ; exit ; end

se "   Welcome! This update script is used to modify numerous data files, "
se "so that the new ListServ `Mailing-List' subboard type can be taken into "
se "consideration. Note, however, that if you are using CNet Amiga, v3.05c "
tr "you should NOT use this update script!n1"

se "Is it OK to continue? [No]: ";gc;a=result
if a~="Y" then do;tr "No.";exit;end;else tr "Yes!"

bbsidentify bbs;a=left(word(result,3),4);cnet=(datatype(a,"n")=1&a>"4.27")+3

if cnet=3 then do
  se "Let me guess... You're one of those average SysOps who doesn't bother "
  se "to FULLY read the docs presented TO them, right?!? This update script "
  tr "should NOT be used on a v3.05 of CNet Amiga! Exiting..." ; exit ; end

se "n1Updating `!STags.cfg'..."
call open(f1,df"!STags.cfg","r")
call open(f2,df"!STags.cfg2","w")
  a=readln(f1) ; parse var a v1"|"v2 ; call writeln(f2,"v2.51|"v2)
  do i=1 to 3 ; a=readln(f1) ; call writeln(f2,a) ; end i
  a=readln(f1) ; parse var a v1"|"v2"|"v3"|"v4"|"v5
  if length(v7)=15 then do ; tr "Already updated!" ; call writeln(f2,a) ; end
  else call writeln(f2,v1"|"v2"|"v3"|"v4"|1"v5)
call close(f2)
call close(f1)
call DELETE(df"!STags.cfg");call RENAME(df"!STags.cfg2",df"!STags.cfg")
tr "done."

se "n1Updating `TagLines'..."
call open(f1,df"TagLines","r")
call open(f2,df"TagLines2","w")
  do i=1 until eof(f1) ; a=readln(f1)
    parse var a v1"|"v2"|"v3"|"v4"|"v5"|"v6"|"v7"|"j
    if length(v7)=15 then do;tr "Already updated!";exit;end
    if v1~="" then call writeln(f2,v1"|"v2"|"v3"|"v4"|"v5"|"v6"|"left(v7,2)"1"substr(v7,3)"|x")
  end i
call close(f2)
call close(f1)
call DELETE(df"TagLines");call RENAME(df"TagLines2",df"TagLines")
tr "done."

tr "n1Updating `_SuperTags' files..."
address command "list >ram:stags251 mail:users/#?/_SuperTags lformat %P%N"
tr "*0ram:stags251}"

call open(f1,"ram:stags251","r")
  do i=1 until eof(f1) ; c.i=readln(f1) ; end i ; tot=i-1
call close(f1)
if tot=0 | c.1="" then tr "I could find NO previous `_SuperTags' files in user UUCP directories."
else do
  do i=1 to tot ; se "Processing..."c.i": "
    call open(f1,c.i,"r")
      l.1=readln(f1) ; l.1=left(l.1,length(l.1)-2)"1|x"
      l.2=readln(f1) ; l.3=readln(f1) ; l.4=readln(f1)
      parse var l.4 l4"|"j ; do j=1 to l4 ; l4.j=readln(f1) ; end j
      l.5=readln(f1)
      parse var l.5 l5"|"j ; do j=1 to l5 ; l5.j=readln(f1) ; end j
    call close(f1)
    call open(f1,c.i,"w")
      do j=1 to 4 ; call writeln(f1,l.j) ; end j
      do j=1 to l4 ; call writeln(f1,l4.j) ; end j
      call writeln(f1,l.5)
      do j=1 to l5 ; call writeln(f1,l5.j) ; end j
    call close(f1)
    tr "finished!"
  end i
end

tr "n1SuperTags, v2.51 Update complete!"

exit
CHECK:;if ARG() & ARG(1)~="###PANIC" then return ARG(1)
  getcarrier;if result="TRUE" then if ARG() then return ARG(1);else return
  logentry "Lost Carrier!!";bufferflush;exit
SYNTAX:;ERROR:;IOERR:;e1="n1 Error: "rc" ("errortext(rc)")"
  e2="  Line: "left(sigl,4)"File:";c="`"fp", "ver"'";e2=e2" "c;tr e1;tr e2
  logentry e1;logentry e2;e=strip(translate(sourceline(sigl),"\{",""))
  do while e~="";e3="Source: "left(e,37);tr e3;logentry e3;e=substr(e,38);end
  bufferflush
/**************************************************************************\
\****************************************** Frontiers BBS (716)/823-9892 **/
