Revision: 75279
http://sourceforge.net/p/brlcad/code/75279
Author: starseeker
Date: 2020-04-07 01:27:56 +0000 (Tue, 07 Apr 2020)
Log Message:
-----------
check for public domain references as well
Modified Paths:
--------------
brlcad/trunk/regress/license_check.cpp
Modified: brlcad/trunk/regress/license_check.cpp
===================================================================
--- brlcad/trunk/regress/license_check.cpp 2020-04-07 01:20:45 UTC (rev
75278)
+++ brlcad/trunk/regress/license_check.cpp 2020-04-07 01:27:56 UTC (rev
75279)
@@ -54,6 +54,7 @@
{
std::regex copyright_regex(".*[Cc]opyright.*[12][0-9[0-9[0-9].*");
std::regex gov_regex(".*United[ ]States[ ]Government.*");
+ std::regex pd_regex(".*[Pp]ublic[ ][Dd]omain.*");
std::string sline;
std::ifstream fs;
fs.open(f);
@@ -64,6 +65,7 @@
int lcnt = 0;
bool gov_copyright = false;
bool other_copyright = false;
+ bool public_domain = false;
// Check the first 50 lines of the file for copyright statements
while (std::getline(fs, sline) && lcnt < 50) {
@@ -73,11 +75,19 @@
} else {
other_copyright = true;
}
+ } else {
+ if (std::regex_match(sline, pd_regex)) {
+ public_domain = true;
+ }
}
lcnt++;
}
fs.close();
+ if ((gov_copyright || other_copyright) && public_domain) {
+ std::cout << f << " has copyright and public domain references\n";
+ return 0;
+ }
if (gov_copyright && other_copyright) {
std::cout << f << " has gov and non-gov copyright\n";
return 0;
@@ -84,10 +94,15 @@
}
if (other_copyright) {
std::cout << f << " has non-gov copyright\n";
+ return 0;
}
- if (!gov_copyright && !other_copyright) {
- std::cout << f << " has no copyright info\n";
+ if (public_domain) {
+ std::cout << f << " references the public domain\n";
+ return 0;
}
+ if (!gov_copyright && !other_copyright && !public_domain) {
+ std::cout << f << " has no info\n";
+ }
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits