// Reconcile DEP-5 debian/copyright to licensecheck
//
// Copyright : 2026 P Blackman
// License   : BSD-2-clause
//
// Check if license of a LICENSE file matches a component of a dual license
// See https://bugs.debian.org/1130130

unit dual;
{$mode delphi}

interface

function CheckDual (Fname : AnsiString; Dep5,  Actual : String) : Boolean;

implementation uses SysUtils, StrUtils, options;


function CheckDual (Fname : AnsiString; Dep5, Actual : String) : Boolean;
begin
    if Dep5 = Actual then
        result := true
    else
    begin
        if StartsStr ('LICENSE', Fname)   // cater for Expat -> MIT alias
        and (ContainsText (Dep5, Actual) or (Actual = 'Expat') and ContainsStr (Dep5, 'MIT'))
        then
            result := true
        else
            result := false;
    end;
end;

end.
