File: dotzero.pas

package info (click to toggle)
licenserecon 6.0
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 352 kB
  • sloc: pascal: 1,378; makefile: 33; xml: 9; sh: 2
file content (37 lines) | stat: -rw-r--r-- 934 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Reconcile DEP-5 debian/copyright to licensecheck
//
// Copyright : 2024 P Blackman
// License   : BSD-2-clause
//
// Test for false positive on licences;  Apache-2.0 v Apache-2
//
// Make generic dot-zero test
//  "For SPDX compatibility, trailing dot-zeroes are considered to be equal to plainer version
//  (e.g., "2.0.0" is considered equal to "2.0" and "2")."     [Dep5 specification]


unit dotzero;
{$mode delphi}

interface

function CheckDotZero (Dep5, Actual : String) : Boolean;


implementation uses StrUtils;


// Return true if Actual good match for d/copyright
function CheckDotZero (Dep5, Actual : String) : Boolean;
begin
    if (Dep5 = Actual) then
        result := true
    else
    if  (length (Actual) - length (Dep5) = 2) and (RightStr(Actual, 2) = '.0')
    or  (length (Actual) - length (Dep5) = 4) and (RightStr(Actual, 4) = '.0.0') then
        result := true
    else
        result := false;
end;

end.