{$M 32768,0,655360}

Program FHTML;

Uses Dos;

Const MaxDepth = 32;

Procedure ScanHTML(Filesystem:String;MaxDepth:Word); Far; External;
{$L SCANHTML}

Var Syntax     : Boolean;
    Filesystem : String;
    Depth      : Word;
    Index      : Byte;
    Wrong      : Integer;

Begin
  Syntax := True;
  Filesystem := '.';
  Depth := MaxDepth;
  Index := 1;
  While Index <= ParamCount Do Begin
    If ParamStr(Index) = '-f' Then
      If Index < ParamCount Then
        Filesystem := ParamStr(Index+1)
      Else
        Syntax := False
    Else
      If ParamStr(Index) = '-d' Then
        If Index < ParamCount Then Begin
          Val(ParamStr(Index+1),Depth,Wrong);
          If Wrong <> 0 Then
            Syntax := False
          Else Begin
            If Depth > MaxDepth Then Depth := MaxDepth;
            If Depth < 1 Then Depth := 1
          End
        End Else
          Syntax := False
      Else
        Syntax := False;
    If Syntax Then
      Index := Index+2
    Else
      Index := ParamCount+1
  End;
  If Not Syntax Then
    WriteLn('Bad Parameter :-(')
  Else
    ScanHTML(Filesystem,Depth)
End.