{
 $Id$
}

{flsearch.ctl}

Procedure Bbs16;
Var
  Ffile : Text;
  Tmp,
  Tmp1  : String;
  Tel   : Word;
  x     : word;

Begin
  Writeln('Converting generic flsearch.ctl file.',#10#13);

  Assign(Ffile, BbsPath + 'FLSEARCH.CTL');
  {$I-} Reset(Ffile); {$I+}
  If ioresult <> 0 then
    Begin
      Writeln('Cannot find '+bbspath+'FLSEARCH.CTL!');
      Halt;
    End;

  AddToFile(false);

  Tel := 0;
  While not eof(ffile) do
    Begin

      {$I-} Readln(Ffile,Tmp); {$I+}
      If ioresult <> 0 then
        Begin
          Writeln('Error reading '+bbspath+'FLSEARCH.CTL!');
          Halt;
        End;

      Inc(Tel);
      If (length(tmp) > 1) and (wordcnt(tmp) = 3) then
        Begin

          fillchar(bbs,sizeof(bbs),#0);

          Bbs.Name := extractwords(3,1,tmp);

          Repeat
            x := pos('_',bbs.name);
            If x <> 0 then
              begin
                tmp1 := bbs.name;
                bbs.name := first(x-1,tmp1) + ' '+ last(length(tmp1)-x,tmp1);
              end;
          Until pos('_',bbs.name) = 0;


          Bbs.Path := extractwords(1,1,tmp);

          Inc(Number);
          Bbs.on   := False;
          Bbs.nr   := Tel;

          AddToFile(saveset);
        End;
    End;
  Close(Ffile);
End;

