FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
parse.c
Go to the documentation of this file.
1 /***************************************************************
2  Copyright (C) 2006-2015 Hewlett-Packard Development Company, L.P.
3  Copyright (C) 2017-2019 Bittium Wireless Ltd.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 
18  ***************************************************************/
19 /* Equivalent to version 1.83 of Core Nomos code. */
20 #include <ctype.h>
21 
22 #include "nomos.h"
23 
24 #include "parse.h"
25 #include "list.h"
26 #include "util.h"
27 #include "nomos_regex.h"
28 #include "nomos_utils.h"
29 #include "_autodefs.h"
30 
31 /* DEBUG
32 #define DOCTOR_DEBUG 1
33 #define PROC_TRACE 1
34  DEBUG */
35 
52 #define _mGPL 0
53 #define _mLGPL 1
54 #define _mGFDL 2
55 #define _mQPL 3
56 #define _mPYTHON 4
57 #define _mPYTH_TEXT 5
58 #define _mAPACHE 6
59 #define _mHP 7
60 #define _mPHP 8
61 #define _mMIT 9
62 #define _mXOPEN 10
63 #define _mREDHAT 11
64 #define _mISC 12
65 #define _mCMU 13
66 #define _mOSF 14
67 #define _mSUN 15
68 #define _mALADDIN 16
69 #define _mCUPS 17
70 #define _fOPENLDAP 18
71 #define _fBSD 19
72 #define _fGPL 20
73 #define _mCDDL 21
74 #define _mLIBRE 22
75 #define _mGSOAP 23
76 #define _mMPL 24
77 #define _fATTRIB 25
78 #define _fREAL 26
79 #define _fIETF 27
80 #define _fDOC 28
81 #define _fMSCORP 29
82 #define _fW3C 30
83 #define _mAPTANA 31
84 #define _tOPENLDAP 32
85 #define _mNTP 33 // To avoid W3C-style detection
86 #define _fIP 34
87 #define _fANTLR 35
88 #define _fCCBY 36
89 #define _fZPL 37
90 #define _fCLA 38
91 #define _fODBL 39
92 #define _fPDDL 40
93 #define _fRUBY 41
94 #define _fSAX 42
95 #define _fAPL 43
96 #define _fARTISTIC 44
97 #define _fCITRIX 45
98 #define _fPURDUE 46
99 #define _fUNICODE 47
100 #define _fOFL 48
101 #define _mAPACHE10 49
102 #define _mAPACHE11 50
103 #define _mWORDNET 51
104 #define _fNCSA 52
105 #define _fTCL 53
106 #define _fIJG 54
107 #define _msize _fIJG+1
108 
109 
113 static struct {
114  char *base;
115  int sso;
116  int seo;
117  int index;
118 } kludge;
119 
120 
121 #ifdef PRECHECK
122 extern void preloadResults(char *filetext, char *ltsr);
123 #endif /* PRECHECK */
124 
130 int findPhrase(int, char *,int, int, int, int);
131 int famOPENLDAP(char *, int ,int, int);
132 int checkUnclassified(char *, int, int, int, int, int);
133 int checkPublicDomain(char *, int, int, int, int, int);
134 static int dbgIdxGrep(int, char *, int);
135 #ifdef LTSR_DEBUG
136 void showLTCache(char *);
137 #endif /* LTSR_DEBUG */
138 void checkCornerCases(char *, int, int, int, int, int, int, int);
139 void checkFileReferences(char *, int, int, int, int, int);
140 void addRef(char *, int);
141 #ifdef DOCTOR_DEBUG
142 void dumpMatch(char *, char *);
143 #endif /* DOCTOR_DEBUG */
144 void locateRegex(char *, item_t *, int, int, int, int);
145 void saveRegexLocation(int, int, int, int);
146 void saveUnclBufLocation(int);
147 void saveLicenseParagraph(char *, int , int , int);
148 char *cplVersion(char *, int, int, int);
149 static char *gplVersion(char *, int, int, int);
150 char *lgplVersion(char *, int, int, int);
151 char *agplVersion(char *, int, int, int);
152 char *gfdlVersion(char *, int, int, int);
153 char *lpplVersion(char *, int, int, int);
154 char *mplNplVersion(char *, int, int, int);
155 char *pythonVersion(char *, int, int, int);
156 static char *realVersion(char *, int, int, int, int);
157 static char *sisslVersion(char *, int, int, int);
158 char *aslVersion(char *, int, int, int);
159 char *cddlVersion(char *, int, int, int);
160 char *ccVersion(char *, int, int, int);
161 char *oslVersion(char *, int, int, int);
162 char *aflVersion(char *, int, int, int);
163 static int match3(int, char *, int, int, int, int);
164 void spdxReference(char *, int, int, int);
165 void copyleftExceptions(char *, int, int, int);
167 
176 static char licStr[myBUFSIZ];
177 
178 static char ltsr[NFOOTPRINTS];
180 static char name[256];
181 static char lmem[_msize];
182 static list_t searchList;
183 static list_t whereList;
184 static list_t whCacheList;
185 static int refOffset;
186 static int maxInterest;
187 static int pd;
189 static int crCheck;
190 static int checknw;
191 static int lDebug = 0;
192 static int lDiags = 0;
194 
200 #define PARSE_ARGS filetext, size, isML, isPS
201 #define LVAL(x) (ltsr[x] & LTSR_RMASK)
202 #define SEEN(x) (ltsr[x] & LTSR_SMASK)
203 #define INFILE(x) fileHasPatt(x, PARSE_ARGS, 0)
204 #define NOT_INFILE(x) !( fileHasPatt(x, PARSE_ARGS, 0) && clearLastElementOfLicenceBuffer() )
205 #define RM_INFILE(x) fileHasPatt(x, PARSE_ARGS, 1)
206 #define GPL_INFILE(x) fileHasPatt(x, PARSE_ARGS, 2)
207 #define PERL_INFILE(x) fileHasPatt(x, PARSE_ARGS, 3)
208 #define NY_INFILE(x) fileHasPatt(x, PARSE_ARGS, 4)
209 #define X_INFILE(x, y) fileHasPatt(x, PARSE_ARGS, y)
210 #define DEBUG_INFILE(x) printf(" Regex[%d] = \"%s\"\nINFILE(%d) = %d\n", x, _REGEX(x), x, INFILE(x));
211 #define HASREGEX(x, cp) idxGrep(x, cp, REG_ICASE|REG_EXTENDED)
212 #define HASREGEX_RI(x, cp) idxGrep_recordIndex(x, cp, REG_ICASE|REG_EXTENDED)
213 #define HASTEXT(x, fl) idxGrep_recordIndex(x, filetext, REG_ICASE|fl)
214 #define URL_INFILE(x) (INFILE(x) || fileHasPatt(x, PARSE_ARGS, -1))
215 #define CANSKIP(i,x,y,z) ((i >= y) && (i <= z) && !(kwbm & (1 << (x - _KW_first))))
216 #define HASKW(x, y) (x & (1 << (y - _KW_first)))
217 #define TRYGROUP(x) x(PARSE_ARGS)
218 #define LOWINTEREST(x) addRef(x, IL_LOW)
219 #define MEDINTEREST(x) addRef(x, IL_MED)
220 //#define INTERESTING(x) printf("INTERESTING: %s, %d, %s\n", __FILE__, __LINE__, x);addRef(x, IL_HIGH)
221 #define INTERESTING(x) addRef(x, IL_HIGH)
222 #define ASLVERS() aslVersion(PARSE_ARGS)
223 #define CCVERS() ccVersion(PARSE_ARGS)
224 #define AFLVERS() aflVersion(PARSE_ARGS)
225 #define OSLVERS() oslVersion(PARSE_ARGS)
226 #define CPLVERS() cplVersion(PARSE_ARGS)
227 #define GPLVERS() gplVersion(PARSE_ARGS)
228 #define LGPLVERS() lgplVersion(PARSE_ARGS)
229 #define AGPLVERS() agplVersion(PARSE_ARGS)
230 #define GFDLVERS() gfdlVersion(PARSE_ARGS)
231 #define CDDLVERS() cddlVersion(PARSE_ARGS)
232 #define LPPLVERS() lpplVersion(PARSE_ARGS)
233 #define MPLVERS() mplNplVersion(PARSE_ARGS)
234 #define PYTHVERS() pythonVersion(PARSE_ARGS)
235 #define SISSLVERS() sisslVersion(PARSE_ARGS)
236 #define REALVERS(x) realVersion(PARSE_ARGS, x)
237 #define PR_REGEX(x) printf("check %d = %s\n", x, _REGEX(x));
238 #define mCR_CMU() (INFILE(_CR_CMU_1) || INFILE(_CR_CMU_2))
239 #define mCR_EDIN() (INFILE(_CR_EDINBURGH_1) || INFILE(_CR_EDINBURGH_2))
240 #define mCR_FSF() (INFILE(_CR_FSF1) || INFILE(_CR_FSF2))
241 #define mCR_HP() (INFILE(_CR_HP_1)|| INFILE(_CR_HP_2) || INFILE(_CR_DEC) || INFILE(_CR_EDS))
242 #define mCR_IETF() (INFILE(_CR_IETF_1) || INFILE(_CR_IETF_2))
243 #define mCR_MIT() (INFILE(_CR_MIT1) || INFILE(_CR_MIT2))
244 #define mCR_X11() (INFILE(_CR_X11) || INFILE(_CR_XFREE86))
245 #define mCR_IPTC() (INFILE(_CR_IPTC1) || INFILE(_CR_IPTC2))
246 #define SPDXREF() spdxReference(PARSE_ARGS)
247 #define EXCEPTIONS() copyleftExceptions(PARSE_ARGS)
248 
249 
260 static int fileHasPatt(int licTextIdx, char *filetext, int size,
261  int isML, int isPS, int qType)
262 {
263  int ret = 0;
264  int show = 0;
265  item_t *ip;
266 
267 #ifdef PROC_TRACE
268  traceFunc("== fileHasPatt(size=%d, isML=%d, isPS=%d, qType=%d, idx=%d)\n",
269  size, isML, isPS, qType, licTextIdx);
270 
271 #endif /* PROC_TRACE */
272 
273  /*
274  * If qType is negative, then we should call idxGrep to look at the
275  * raw text of the file; non-negative value means look in the doctored
276  * text buffers...
277  */
278  if ((qType >= 0) && (qType & FL_SHOWMATCH)) {
279  qType &= ~FL_SHOWMATCH;
280  show = FL_SHOWMATCH;
281  }
282  if (qType < 0) {
283  ret = idxGrep_recordPosition(licTextIdx, filetext, REG_ICASE | REG_EXTENDED | show);
284  if (lDiags && ret) {
285 #ifdef DOCTOR_DEBUG
286  dumpMatch(filetext, "RAW-Text");
287 #endif /* DEBUG */
288  printRegexMatch(licTextIdx, NO);
289  saveRegexLocation(licTextIdx, cur.regm.rm_so,
290  cur.regm.rm_eo - cur.regm.rm_so, YES);
291 #ifdef DEBUG
292  printf("WINDOW-RAW: offset %d, length %d\n",
293  cur.regm.rm_so, cur.regm.rm_eo - cur.regm.rm_so);
294 #endif /* DEBUG */
295  }
296  return(ret);
297  }
298  if (SEEN(licTextIdx)) {
299 #ifdef LTSR_DEBUG
300  printf("Cache hit: ltsr[%d] = 0x%x\n", licTextIdx, ltsr[licTextIdx]);
301 #endif /* LTSR_DEBUG */
302  if (lDiags && (ltsr[licTextIdx] & LTSR_YES) == LTSR_YES) {
303  printRegexMatch(licTextIdx, YES);
304  (void) sprintf(name, "reg%04d", licTextIdx);
305  ip = listGetItem(&whCacheList, name);
306  if (ip->bIndex != licTextIdx) {
307  listDump(&whCacheList, NO);
308  LOG_FATAL("Offset-cache (\"%s\") == %d, not %d!", name, ip->bIndex, licTextIdx)
309  Bail(-__LINE__);
310  }
311  saveRegexLocation(licTextIdx, ip->bStart, ip->bLen, NO);
312  }
313  return(ltsr[licTextIdx] & LTSR_RMASK);
314  }
315  return(findPhrase(licTextIdx, PARSE_ARGS, qType));
316 }
317 
328 static int dbgIdxGrep(int licTextIdx, char *buf, int show)
329 {
330  int ret;
331  int flags = REG_ICASE|REG_EXTENDED;
332 
333  if (SEEN(licTextIdx)) {
334  return(ltsr[licTextIdx] & LTSR_RMASK);
335  }
336 
337  if (show) {
338  flags |= FL_SHOWMATCH;
339  }
340  ret = idxGrep(licTextIdx, buf, flags);
341  if (lDiags && ret) {
342  printRegexMatch(licTextIdx, NO);
343  saveRegexLocation(licTextIdx, cur.regm.rm_so,
344  cur.regm.rm_eo - cur.regm.rm_so, YES);
345  }
346  ltsr[licTextIdx] |= ret;
347  return ret;
348 }
349 
371 char *parseLicenses(char *filetext, int size, scanres_t *scp,
372  int isML, int isPS)
373 {
374  static int first = 1;
375  char *cp;
376  int i;
377  int j;
378  int nw = 0;
379  int score = scp->score;
380  int kwbm = scp->kwbm;
381 #ifdef PRECHECK
382  extern void preloadResults(char *, char *);
383 #endif /* PRECHECK */
384 
385 #if defined(PROC_TRACE) || defined(DOCTOR_DEBUG)
386  traceFunc("== parseLicenses(%p, %d, [%d, 0x%x], %d, %d)\n",
387  filetext, size, score, kwbm, isML, isPS );
388 #endif /* PROC_TRACE || DOCTOR_DEBUG */
389 
390  if (size == 0) {
391  LOWINTEREST("Empty-file-no-data!");
392  return(licStr+1);
393  }
394 
395  if (first) {
396  if (optionIsSet(OPTS_DEBUG)) {
397  lDebug = 1;
398  lDiags = 1;
399  }
400  listInit(&searchList, 0, "pattern-search list");
401  listInit(&whereList, 0, "regex-match locations list");
402  listInit(&whCacheList, 0, "regex-cache-match list");
403  first = 0;
404  }
405  crCheck = 0;
406  kludge.base = NULL_STR;
407  /*
408  * Interestingly enough, the headers for Nomos-generated file (e.g., the
409  * page containing the keywords found, file attributes and file text, etc.)
410  * contain enough data to confuse the parser in multiple ways... in the
411  * rare event we encounter a data file we generated, skip the header.
412  *****
413  * AND, not all nomos-created files have the same header(s).
414  */
415  pd = -1; /* unchecked */
416  cp = filetext;
417  maxInterest = IL_INIT;
418  cur.licPara = NULL_STR; /* unclassified license data */
419  gl.flags &= ~FL_FRAGMENT;
420 #ifdef FLAG_NO_COPYRIGHT
421  gl.flags &= ~FL_NOCOPYRIGHT;
422 #endif /* FLAG_NO_COPYRIGHT */
423  if (scp->dataOffset && lDiags) {
424  LOG_NOTICE("%s-generated link, ignore header (%d bytes)!",
425  gl.progName, scp->dataOffset);
426  }
427 
428  /*
429  * It's been observed over time that the file-magic() stuff doesn't always
430  * identify everything correctly. One case in particular is PostScript files
431  * when the "%%PS" directive isn't the first line in a file... but the rest
432  * of the data really IS PostScript
433  */
434  if (!isPS && (strncasecmp(filetext, "%%page:", 7) == 0 || strncasecmp(filetext, "{\\rtf", 5) == 0)) {
435 #if defined(DEBUG) || defined(DOCTOR_DEBUG)
436  printf("File is really postscript, %s filetext !\n", filetext);
437 #endif /* DEBUG || DOCTOR_DEBUG */
438  isPS = 1;
439  }
440 
441  *licStr = NULL_CHAR;
442  refOffset = 0;
443  (void) memset(ltsr, 0, sizeof(ltsr));
444  (void) memset(lmem, 0, sizeof(lmem));
445 #if defined(DEBUG) && defined(LTSR_DEBUG)
446  showLTCache("LTSR-results START:");
447 #endif /* DEBUG && LTSR_DEBUG */
448 #ifdef PRECHECK
449  preloadResults(/*PARSE_ARGS*/filetext, ltsr);
450 #endif /* PRECHECK */
451 #ifdef MEMSTATS
452  memStats("parseLicenses: BOP");
453 #endif /* MEMSTATS */
454  lmem[_mPYTH_TEXT] = HASTEXT(_TEXT_PYTHON, 0);
455  lmem[_tOPENLDAP] = HASTEXT(_TEXT_OPENLDAP, 0);
456  (void) INFILE(_TEXT_GNU_LIC_INFO);
457 #ifdef LTSR_DEBUG
458  showLTCache("LTSR-results INIT-SCAN:");
459 #endif /* LTSR_DEBUG */
460  /*
461  * MySQL.FLOSS exception
462  */
463  if (INFILE(_LT_MYSQL_EXCEPT) || INFILE(_PHR_FREE_LIBRE)) {
464  if (INFILE(_TITLE_ALFRESCO)) {
465  INTERESTING("Alfresco-FLOSS");
466  }
467  else if (HASTEXT(_TEXT_ALFRESCO, 0)) {
468  INTERESTING("Alfresco");
469  }
470  else if (INFILE(_CR_MYSQL) || INFILE(_TITLE_mysql_floss_exception)) {
471  if (INFILE(_TITLE_MYSQL_V03)) {
472  INTERESTING("MySQL-0.3");
473  }
474  else {
475  INTERESTING("mysql-floss-exception");
476  }
477  }
478  else {
479  INTERESTING("MySQL-style");
480  }
481  lmem[_mLIBRE] = 1;
482  }
483  /*
484  * Some RealNetworks licenses included a list of "compatible" licenses that
485  * can confuse the license-detection algorithms within. Look for these early
486  * in the process, and ignore the known (false) matches when we detect the
487  * RPSL/RCSL licenses.
488  */
489  if (HASTEXT(_TEXT_REALNET, REG_EXTENDED)) {
490  /*
491  * List of other licenses should be excluded only if full license text is found
492  */
493  if (INFILE(_LT_RPSL_COMPATIBLE)) {
494  lmem[_fREAL] = 1;
495  }
496  if (INFILE(_LT_REAL_RPSL)) {
497  cp = REALVERS(_TITLE_RPSL);
498  INTERESTING(lDebug ? "RPSL" : cp);
499  }
500  else if (INFILE(_LT_REAL_RPSLref)) {
501  cp = REALVERS(_TITLE_RPSL);
502  INTERESTING(lDebug ? "Real-RPSL(ref)" : cp);
503  }
504  if (INFILE(_LT_REAL_RCSL)) {
505  cp = REALVERS(_TITLE_RCSL);
506  INTERESTING(lDebug ? "RCSL" : cp);
507  }
508  else if (INFILE(_LT_REAL_RCSLref)) {
509  cp = REALVERS(_TITLE_RCSL);
510  INTERESTING(lDebug ? "Real-RCSL(ref)" : cp);
511  }
512  if (INFILE(_TITLE_REAL_EULA)) {
513  INTERESTING("RealNetworks-EULA");
514  }
515  else if (INFILE(_LT_HELIX_TITLE)) {
516  INTERESTING("Helix.RealNetworks-EULA");
517  }
518  }
520  /*
521  * Zope - this license is explicitly listed (by title) in several other
522  * licenses...
523  */
524  if (!lmem[_mLIBRE] && !lmem[_fREAL] && INFILE(_TITLE_ZOPE)) {
525  if (INFILE(_TITLE_ZOPE_V21)) {
526  INTERESTING("ZPL-2.1");
527  lmem[_fZPL] = 1;
528  }
529  else if (INFILE(_TITLE_ZOPE_V20)) {
530  INTERESTING("ZPL-2.0");
531  lmem[_fZPL] = 1;
532  }
533  else if (INFILE(_TITLE_ZOPE_V10)) {
534  INTERESTING("ZPL-1.0");
535  lmem[_fZPL] = 1;
536  }
537  else if (INFILE(_TITLE_ZOPE_V11)) {
538  INTERESTING("ZPL-1.1");
539  lmem[_fZPL] = 1;
540  }
541  else if (INFILE(_SPDX_ZPL_11)) {
542  INTERESTING("ZPL-1.1");
543  lmem[_fZPL] = 1;
544  }
545  else if (INFILE(_SPDX_ZPL_20)) {
546  INTERESTING("ZPL-2.0");
547  lmem[_fZPL] = 1;
548  }
549  else if (INFILE(_SPDX_ZPL_21)) {
550  INTERESTING("ZPL-2.1");
551  lmem[_fZPL] = 1;
552  }
553  else if (INFILE(_TITLE_ZIMBRA_13)) {
554  INTERESTING("Zimbra-1.3");
555  }
556  else if (INFILE(_TITLE_ZIMBRA_12)) {
557  INTERESTING("Zimbra-1.2");
558  }
559  else {
560  INTERESTING(lDebug ? "Zope(ref)" : "ZPL");
561  lmem[_fZPL] = 1;
562  }
563  }
565  /*
566  * Check Apache licenses before BSD
567  */
568  if (HASTEXT(_PHR_Apache_ref0, REG_EXTENDED) || INFILE(_PHR_Apache_ref7)) {
569  cp = ASLVERS();
570  INTERESTING(cp);
571  }
573  /*
574  * BSD and all the variant 'flavors'. BSD licenses are kind of like
575  * the cooking concept of 'the mother sauces' -- MANY things are derived
576  * from the wordings of these licenses. There are still many more, for
577  * certain, but LOTS of licenses are based on ~10 originally-BSD-phrases.
578  */
579  if (INFILE(_LT_BSD_1)) {
580  if (INFILE(_TITLE_PHP301)) {
581  INTERESTING(lDebug ? "PHP(v3.01#1)" : "PHP-3.01");
582  lmem[_mPHP] = 1;
583  }
584  else if (INFILE(_TITLE_PHP30)) {
585  INTERESTING(lDebug ? "PHP(v3.0#1)" : "PHP-3.0");
586  lmem[_mPHP] = 1;
587  }
588  else if (INFILE(_TITLE_PHP202)) {
589  INTERESTING(lDebug ? "PHP(v2.0.2#1)" : "PHP-2.0.2");
590  lmem[_mPHP] = 1;
591  }
592  else if (INFILE(_CR_VOVIDA) || INFILE(_TITLE_VOVIDA)) {
593  INTERESTING("VSL-1.0");
594  lmem[_fBSD] = 1;
595  }
596  else if (INFILE(_CR_NAUMEN) || INFILE(_TITLE_NAUMEN)) {
597  INTERESTING("Naumen");
598  }
599  else if (INFILE(_CR_ENTESSA) || INFILE(_TITLE_ENTESSA)) {
600  INTERESTING("Entessa");
601  }
602  else if (INFILE(_LT_ATTRIB) || INFILE(_TITLE_ATTRIBUTION)) {
603  INTERESTING("AAL");
604  lmem[_fATTRIB] = 1;
605  }
606  else if (INFILE(_CR_ZOPE)) {
607  INTERESTING(lDebug ? "Zope(bsd)" : "ZPL");
608  }
609  else if (INFILE(_LT_Oracle_Berkeley_DB)) {
610  INTERESTING("Oracle-Berkeley-DB");
611  }
612  else if (INFILE(_CR_SLEEPYCAT) || INFILE(_LT_SLEEPYCAT_1)) {
613  MEDINTEREST(lDebug ? "Sleepycat(1)" : "Sleepycat");
614  }
615  else if (INFILE(_TITLE_PHP202)) {
616  INTERESTING(lDebug ? "PHP(v2.0.2#2)" : "PHP-2.0.2");
617  lmem[_mPHP] = 1;
618  }
619  else if (INFILE(_TITLE_ZEND_V20)) {
620  INTERESTING("Zend-2.0");
621  }
622  else if (!lmem[_fOPENLDAP] && !TRYGROUP(famOPENLDAP)) {
623  if (HASTEXT(_LT_OPENSSLref5, REG_EXTENDED)) {
624  INTERESTING(lDebug ? "OpenSSL(ref)" : "OpenSSL");
625  }
626  else if (INFILE(_LT_BSD_CLAUSE_0) && INFILE(_LT_BSD_CLAUSE_1) && INFILE(_LT_BSD_CLAUSE_2)) {
627  if (INFILE(_LT_BSD_CLAUSE_3) && (INFILE(_LT_BSD_CLAUSE_4) || INFILE(_LT_BSD_CLAUSE_4_LONG)) && INFILE(_LT_UC)) {
628  INTERESTING("BSD-4-Clause-UC");
629  }
630  else if (INFILE(_LT_BSD_CLAUSE_3) && (INFILE(_LT_BSD_CLAUSE_4) || INFILE(_LT_BSD_CLAUSE_4_LONG))) {
631  INTERESTING("BSD-4-Clause");
632  }
633  else if (INFILE(_LT_BSD_CLAUSE_4) && INFILE(_LT_BSD_CLAUSE_CLEAR)) {
634  INTERESTING("BSD-3-Clause-Clear");
635  }
636  else if (INFILE(_LT_BSD_CLAUSE_4) && HASTEXT(_KW_severability, REG_EXTENDED)) {
637  INTERESTING("BSD-3-Clause-Severability");
638  }
639  else if (INFILE(_LT_XML_DB_V10)) {
640  INTERESTING("XMLDB-1.0");
641  }
642  else if (INFILE(_LT_BSD_CLAUSE_4) && INFILE(_LT_ANT_BSD_RESTRICTION)) {
643  INTERESTING("ANT+SharedSource");
644  }
645  else if (!lmem[_mAPACHE11] && INFILE(_LT_Apache_11_CLAUSE_3) && INFILE(_LT_Apache_11_CLAUSE_4) && INFILE(_LT_Apache_11_CLAUSE_5)) {
646  INTERESTING(lDebug ? "BSD(Apache-1.1)" : "Apache-1.1-style");
647  }
648  else if(HASTEXT(_LT_Sendmail_823_title, 0)) {
649  INTERESTING("Sendmail-8.23");
650  }
651  else if (!lmem[_mAPACHE10] && !lmem[_mAPACHE11] && INFILE(_LT_BSD_CLAUSE_ATTRIBUTION)) {
652  INTERESTING("BSD-3-Clause-Attribution");
653  }
654  else if (!lmem[_mAPACHE10] && !lmem[_mAPACHE11] && INFILE(_LT_BSD_CLAUSE_4)) {
655  INTERESTING("BSD-3-Clause");
656  }
657  else if (INFILE(_LT_SSLEAY)) {
658  INTERESTING("SSLeay");
659  }
660  else if (INFILE(_LT_TMATE)) {
661  INTERESTING("TMate");
662  }
663  else if (INFILE(_LT_MUP)) {
664  INTERESTING("Mup");
665  }
666  else if (INFILE(_LT_FREE_BSD)) {
667  INTERESTING("BSD-2-Clause-FreeBSD");
668  }
669  else if (INFILE(_LT_BSD_CLAUSE_PATENT)) {
670  INTERESTING("BSD-2-Clause-Patent");
671  }
672  else if (INFILE(_CR_NETBSD)) {
673  INTERESTING("BSD-2-Clause-NetBSD");
674  }
675  else if (INFILE(_LT_MIT_0)) {
676  lmem[_mMIT] = 1;
677  INTERESTING("Linux-OpenIB");
678  }
679  else if (!lmem[_mAPACHE10] && !lmem[_mAPACHE11]) {
680  INTERESTING("BSD-2-Clause");
681  }
682  }
683  else if (INFILE(_CR_CRYPTOGAMS)) {
684  INTERESTING("Cryptogams");
685  }
686  else if (INFILE(_CR_BSDCAL)) {
687  INTERESTING(lDebug ? "BSD(1)" : "BSD");
688  }
689  else if (HASTEXT(_TEXT_ALTERED_SOURCE, REG_EXTENDED) && HASTEXT(_TEXT_ORIGIN, 0)) {
690  if (INFILE(_PHR_BZIP2_3)) {
691  INTERESTING("bzip2-1.0.5");
692  }
693  else if (HASTEXT(_PHR_BZIP2_4, REG_EXTENDED)) {
694  INTERESTING("bzip2-1.0.6");
695  }
696  else {
697  INTERESTING("bzip2");
698  }
699  }
700  else if (mCR_CMU()) {
701  INTERESTING(lDebug ? "CMU(BSD-ish)" : "CMU");
702  }
703  else if (INFILE(_LT_MTLL)) {
704  INTERESTING("MTLL");
705  }
706  else if (INFILE(_LT_BSD_CLAUSE_1_DISCLAIMER)) {
707  INTERESTING("BSD-1-Clause");
708  }
709  else if (!lmem[_fZPL]) {
710  INTERESTING(lDebug ? "BSD-style(1)" : "BSD-style");
711  }
712  }
713  lmem[_fBSD] = 1;
714  }
715  else if (INFILE(_LT_BSD_CLEAR_CLAUSE_0) && INFILE(_LT_BSD_CLAUSE_1) && INFILE(_LT_BSD_CLAUSE_2)) {
716  INTERESTING("BSD-3-Clause-Clear");
717  }
718  else if (INFILE(_PHR_Linux_OpenIB)) {
719  INTERESTING("Linux-OpenIB");
720  }
721  else if (INFILE(_LT_BSD_2)) {
722  /*
723  * Python, OSF, SecretLabs, some universities, some vendors, etc., have
724  * variants here.
725  */
726  if (INFILE(_CR_PYTHON) || INFILE(_TITLE_PYTHON)) {
727  cp = PYTHVERS();
728  INTERESTING(lDebug ? "Python(3)" : cp);
729  lmem[_mPYTHON] = 1;
730  }
731  else if (INFILE(_CR_OSF)) {
732  INTERESTING(lDebug ? "OSF(1)" : "OSF");
733  lmem[_mOSF] = 1;
734  }
735  else if (INFILE(_CR_UI)) {
736  INTERESTING(lDebug ? "UI(1)" : "Unix-Intl");
737  }
738  else if (INFILE(_CR_XOPEN)) {
739  INTERESTING(lDebug ? "XOpen(1)" : "X/Open");
740  lmem[_mXOPEN] = 1;
741  }
742  else if (INFILE(_PHR_HISTORICAL)) {
743  INTERESTING("HPND");
744  }
745  else if (INFILE(_LT_CMU_7)) {
746  if (INFILE(_CR_CMU_1) || INFILE(_CR_CMU_2) || INFILE(_CR_BSDCAL)) {
747  INTERESTING("MIT-CMU");
748  }
749  else {
750  INTERESTING("MIT-CMU-style");
751  }
752  lmem[_mCMU] = 1;
753  }
754  else if (INFILE(_CR_BSDCAL)) {
755  INTERESTING(lDebug ? "BSD(2)" : "BSD");
756  }
757  else if (INFILE(_LT_NTP)) {
758  INTERESTING("NTP");
759  }
760  else if (INFILE(_LT_WORDNET))
761  {
762  INTERESTING("WordNet-3.0");
763  lmem[_mMIT] = 1;
764  }
765  else if (INFILE(_LT_NOT_ADVERTISING)) {
766  INTERESTING(lDebug ? "BSD-style(2)" : "BSD-style");
767  }
768  else if (INFILE(_PHR_NO_WARRANTY_12)) {
769  INTERESTING(lDebug ? "ISC(BSD-style)" : "ISC-style");
770  }
771  else {
772  INTERESTING(lDebug ? "BSD-style(2)-MIT" : "MIT-style");
773  }
774  lmem[_fBSD] = 1;
775  }
776  else if (INFILE(_LT_BSD_3) && NOT_INFILE(_TITLE_OPENLDAP)) {
777  if (INFILE(_LT_AMPAS)) {
778  INTERESTING("AMPAS");
779  }
780  else if (INFILE(_CR_BSDCAL)) {
781  INTERESTING(lDebug ? "BSD(3)" : "BSD");
782  }
783  else if (INFILE(_TITLE_OZPLB_10)) {
784  INTERESTING("OZPLB-1.0");
785  }
786  else if (NOT_INFILE(_CR_XFREE86) && NOT_INFILE(_TITLE_NCSA) && NOT_INFILE(_TITLE_INNERNET200)) {
787  INTERESTING(lDebug ? "BSD-style(3)" : "BSD-style");
788  }
789  lmem[_fBSD] = 1;
790  }
791  else if (INFILE(_LT_BSD_4)) {
792  if (INFILE(_CR_BSDCAL)) {
793  INTERESTING(lDebug ? "BSD(4)" : "BSD");
794  }
795  else {
796  INTERESTING(lDebug ? "BSD-style(4)" : "BSD-style");
797  }
798  lmem[_fBSD] = 1;
799  }
800  /*
801  * FIX-ME: this license text explicitly mentions "for no-profit", and as
802  * such it should list it in the license-summary, yes?
803  */
804  else if (INFILE(_LT_BSD_5)) {
805  if (!lmem[_mPYTHON] && INFILE(_CR_PYTHON)) {
806  INTERESTING(lDebug ? "Python(2)" : "Python");
807  lmem[_mPYTHON] = 1;
808  }
809  else if (INFILE(_CR_USL_EUR)) {
810  INTERESTING(lDebug ? "USLE(1)" : "USL-Europe");
811  }
812  else if (INFILE(_CR_BSDCAL)) {
813  INTERESTING(lDebug ? "BSD(5)" : "BSD");
814  }
815  else {
816  INTERESTING(lDebug ? "BSD-style(5)" : "BSD-style");
817  }
818  lmem[_fBSD] = 1;
819  }
820  else if (INFILE(_LT_BSD_6)) {
821  if (INFILE(_CR_BSDCAL)) {
822  INTERESTING(lDebug ? "BSD(6)" : "BSD");
823  }
824  else {
825  INTERESTING(lDebug ? "BSD-style(6)" : "BSD-style");
826  }
827  lmem[_fBSD] = 1;
828  }
829  else if (INFILE(_LT_BSD_7)) {
830  if (HASTEXT(_LT_MAKEINDEX_1, 0) && HASTEXT(_LT_MAKEINDEX_2, 0)) {
831  INTERESTING("MakeIndex");
832  }
833  else if (INFILE(_CR_BSDCAL)) {
834  INTERESTING(lDebug ? "BSD(7)" : "BSD");
835  }
836  else {
837  INTERESTING(lDebug ? "BSD-style(7)" : "BSD-style");
838  }
839  lmem[_fBSD] = 1;
840  }
841  else if (INFILE(_LT_BSD_8)) {
842  if (INFILE(_CR_BSDCAL)) {
843  INTERESTING(lDebug ? "BSD(8)" : "BSD");
844  }
845  else {
846  INTERESTING(lDebug ? "BSD-style(8)" : "BSD-style");
847  }
848  lmem[_fBSD] = 1;
849  }
850  else if (INFILE(_LT_BSD_9)) {
851  if (INFILE(_CR_BSDCAL)) {
852  INTERESTING(lDebug ? "BSD(9)" : "BSD");
853  }
854  else {
855  INTERESTING(lDebug ? "BSD-style(8)" : "BSD-style");
856  }
857  lmem[_fBSD] = 1;
858  }
859  else if (INFILE(_LT_BSD_10)) {
860  if (INFILE(_CR_BSDCAL)) {
861  INTERESTING(lDebug ? "BSD(10)" : "BSD");
862  }
863  else {
864  INTERESTING(lDebug ? "BSD-style(9)" : "BSD-style");
865  }
866  lmem[_fBSD] = 1;
867  }
868  else if (INFILE(_LT_BSD_11)) {
869  if (INFILE(_CR_BSDCAL)) {
870  INTERESTING(lDebug ? "BSD(11)" : "BSD");
871  }
872  else {
873  INTERESTING(lDebug ? "BSD-style(10)" : "BSD-style");
874  }
875  lmem[_fBSD] = 1;
876  }
877  else if (INFILE(_LT_BSD_12)) {
878  if (INFILE(_CR_BSDCAL)) {
879  INTERESTING(lDebug ? "BSD(12)" : "BSD");
880  }
881  else {
882  INTERESTING(lDebug ? "BSD-style(11)" : "BSD-style");
883  }
884  lmem[_fBSD] = 1;
885  }
886  else if (INFILE(_LT_BSD_13)) {
887  if (INFILE(_CR_BSDCAL)) {
888  INTERESTING(lDebug ? "BSD(13)" : "BSD");
889  }
890  else {
891  INTERESTING(lDebug ? "BSD-style(12)" : "BSD-style");
892  }
893  lmem[_fBSD] = 1;
894  }
895  else if (INFILE(_LT_BSD_NONC)) {
896  if (INFILE(_CR_BSDCAL)) {
897  INTERESTING(lDebug ? "BSD(NonC)" : "BSD.non-commercial");
898  }
899  else {
900  INTERESTING(lDebug ? "BSD-style(NonC)" : "Non-commercial");
901  }
902  lmem[_fBSD] = 1;
903  }
904  else if (INFILE(_SPDX_BSD_3_Clause_Clear)) {
905  INTERESTING("BSD-3-Clause-Clear");
906  }
907  else if (INFILE(_SPDX_BSD_3_Clause_No_Nuclear_License_2014)) {
908  INTERESTING("BSD-3-Clause-No-Nuclear-License-2014");
909  }
910  else if (INFILE(_SPDX_BSD_3_Clause_No_Nuclear_License)) {
911  INTERESTING("BSD-3-Clause-No-Nuclear-License");
912  }
913  else if (INFILE(_SPDX_BSD_3_Clause_No_Nuclear_Warranty)) {
914  INTERESTING("BSD-3-Clause-No-Nuclear-Warranty");
915  }
916  else if (INFILE(_SPDX_BSD_3_Clause_Attribution)) {
917  INTERESTING("BSD-3-Clause-Attribution");
918  }
919  else if (INFILE(_SPDX_BSD_3_Clause_LBNL)) {
920  INTERESTING("BSD-3-Clause-LBNL");
921  }
922  else if (INFILE(_SPDX_BSD_3_Clause)) {
923  INTERESTING("BSD-3-Clause");
924  }
925  else if (INFILE(_PHR_BSD_3_CLAUSE_1) || INFILE(_PHR_BSD_3_CLAUSE_2) || INFILE(_PHR_BSD_3_CLAUSE_3) || INFILE(_PHR_BSD_3_CLAUSE_4)) {
926  INTERESTING(lDebug ? "BSD(phr1/2)" : "BSD-3-Clause");
927  }
928  else if (INFILE(_SPDX_BSD_2_Clause_FreeBSD)) {
929  INTERESTING("BSD-2-Clause-FreeBSD");
930  }
931  else if (INFILE(_SPDX_BSD_2_Clause_NetBSD)) {
932  INTERESTING("BSD-2-Clause-NetBSD");
933  }
934  else if (INFILE(_SPDX_BSD_2_Clause_Patent)) {
935  INTERESTING("BSD-2-Clause-Patent");
936  }
937  else if (INFILE(_SPDX_BSD_2_Clause_1)) {
938  INTERESTING("BSD-2-Clause");
939  }
940  else if (INFILE(_SPDX_BSD_2_Clause_2)) {
941  INTERESTING("BSD-2-Clause");
942  }
943  else if (INFILE(_PHR_BSD_2_CLAUSE_1)
944  || INFILE(_PHR_BSD_2_CLAUSE_2)
945  || INFILE(_PHR_BSD_2_CLAUSE_3)
946  || INFILE(_PHR_BSD_2_CLAUSE_4)
947  || INFILE(_PHR_BSD_2_CLAUSE_5)
948  || INFILE(_PHR_BSD_2_CLAUSE_6)) {
949  INTERESTING(lDebug ? "BSD(phr1/2/3/4/5/6)" : "BSD-2-Clause");
950  }
951  else if (INFILE(_SPDX_BSD_4_Clause_UC)) {
952  INTERESTING("BSD-4-Clause-UC");
953  }
954  else if (INFILE(_SPDX_BSD_4_Clause)) {
955  INTERESTING("BSD-4-Clause");
956  }
957  else if (INFILE(_PHR_BSD_4_CLAUSE_1)) {
958  INTERESTING(lDebug ? "BSD-4-Clause(phr1)" : "BSD-4-Clause");
959  }
960  else if (INFILE(_PHR_BSD_CLEAR_1)) {
961  INTERESTING(lDebug ? "BSD-Clear(phr1)" : "BSD-3-Clause-Clear");
962  }
963  else if (INFILE(_PHR_BSD_3_CLAUSE_LBNL)) {
964  INTERESTING("BSD-3-Clause-LBNL");
965  }
966  else if (INFILE(_SPDX_BSD_Protection)) {
967  INTERESTING("BSD-Protection");
968  }
969  else if (INFILE(_SPDX_BSD_Source_Code)) {
970  INTERESTING("BSD-Source-Code");
971  }
972  else if (INFILE(_SPDX_BSD_1_Clause)) {
973  INTERESTING("BSD-1-Clause");
974  }
975  else if (INFILE(_LT_BSDref1)) {
976  INTERESTING(lDebug ? "BSD(ref1)" : "BSD");
977  }
978  else if (INFILE(_LT_BSDref2)) {
979  INTERESTING(lDebug ? "BSD(ref2)" : "BSD");
980  }
981  else if (INFILE(_LT_BSDref3)) {
982  INTERESTING(lDebug ? "BSD(ref3)" : "BSD");
983  }
984  else if (INFILE(_LT_BSDref4)) {
985  INTERESTING(lDebug ? "BSD(ref4)" : "BSD");
986  }
987  else if (INFILE(_LT_BSDref5)) {
988  INTERESTING(lDebug ? "BSD(ref5)" : "BSD");
989  }
990  else if (INFILE(_LT_BSDref6)) {
991  INTERESTING(lDebug ? "BSD(ref6)" : "BSD");
992  }
993  else if (INFILE(_LT_BSDref7)) {
994  INTERESTING(lDebug ? "BSD(ref7)" : "BSD");
995  }
996  else if (INFILE(_LT_BSDref8)) {
997  INTERESTING(lDebug ? "BSD(ref8)" : "BSD");
998  }
999  else if (INFILE(_LT_BSDref9)) {
1000  INTERESTING(lDebug ? "BSD(ref9)" : "BSD");
1001  }
1002  else if (INFILE(_LT_BSDref10)) {
1003  INTERESTING(lDebug ? "BSD(ref10)" : "BSD");
1004  }
1005  else if (INFILE(_LT_BSDref11)) {
1006  INTERESTING(lDebug ? "BSD(ref11)" : "BSD");
1007  }
1008  else if (INFILE(_LT_BSDref12) || HASTEXT(_LT_BSDref13, REG_EXTENDED)) {
1009  INTERESTING(lDebug ? "BSD(ref12)" : "BSD-3-Clause");
1010  }
1011  else if (URL_INFILE(_URL_BSD_1) || URL_INFILE(_URL_BSD_2)) {
1012  INTERESTING(lDebug ? "BSD(url)" : "BSD");
1013  lmem[_fBSD] = 1;
1014  }
1015  else if (INFILE(_LT_BSDref14)) {
1016  INTERESTING(lDebug ? "BSD(ref14)" : "BSD");
1017  lmem[_fBSD] = 1;
1018  }
1019  else if (INFILE(_LT_BSDSTYLEref1)) {
1020  INTERESTING(lDebug ? "BSD-st(1)" : "BSD-style");
1021  lmem[_fBSD] = 1;
1022  }
1023  else if (INFILE(_LT_BSDSTYLEref2)) {
1024  INTERESTING(lDebug ? "BSD-st(2)" : "BSD-style");
1025  lmem[_fBSD] = 1;
1026  }
1027  else if (INFILE(_LT_BSDSTYLEref4)) {
1028  INTERESTING(lDebug ? "BSD-st(4)" : "BSD-style");
1029  lmem[_fBSD] = 1;
1030  }
1031  else if (INFILE(_LT_BSDSTYLEref3)) {
1032  INTERESTING(lDebug ? "BSD-st(3)" : "BSD-style");
1033  lmem[_fBSD] = 1;
1034  }
1035  else if (INFILE(_LT_BSD_HTMLAREA_1) || INFILE(_LT_BSD_HTMLAREA_2)) {
1036  INTERESTING(lDebug ? "BSD-htmlArea" : "BSD-3-Clause");
1037  lmem[_fBSD] = 1;
1038  }
1039  else if (INFILE(_FILE_BSD1) || INFILE(_FILE_BSD2)) {
1040  INTERESTING(lDebug ? "BSD(deb)" : "BSD");
1041  }
1043  /*
1044  * Aptana public license (based on MPL)
1045  */
1046  if (INFILE(_LT_APTANA)) {
1047  if (INFILE(_TITLE_APTANA_V10)) {
1048  INTERESTING("Aptana-1.0");
1049  }
1050  else {
1051  INTERESTING("Aptana");
1052  }
1053  lmem[_mMPL] = 1;
1054  lmem[_mAPTANA] = 1;
1055  }
1056  /*
1057  * PHP variants
1058  */
1059  if (!lmem[_mPHP] && INFILE(_LT_PHP)) {
1060  if (INFILE(_TITLE_PHP301)) {
1061  INTERESTING(lDebug ? "PHP(v3.01#2)" : "PHP-3.01");
1062  }
1063  else if (INFILE(_TITLE_PHP30)) {
1064  INTERESTING(lDebug ? "PHP(v3.0#2)" : "PHP-3.0");
1065  }
1066  else if (INFILE(_TITLE_PHP202)) {
1067  INTERESTING(lDebug ? "PHP(v2.0.2#3)" : "PHP-2.0.2");
1068  }
1069  else if (INFILE(_CR_PHP)) {
1070  INTERESTING(lDebug ? "PHP(1)" : "PHP");
1071  }
1072  else {
1073  INTERESTING("PHP-style");
1074  }
1075  lmem[_mPHP] = 1;
1076  }
1077  else if (!lmem[_mPHP] && INFILE(_LT_PHP_V30_1)) {
1078  INTERESTING("PHP-3.0");
1079  lmem[_mPHP] = 1;
1080  }
1081  else if (!lmem[_mPHP] && INFILE(_LT_PHP_V30_2)) {
1082  INTERESTING("PHP-3.0");
1083  lmem[_mPHP] = 1;
1084  }
1085  else if (!lmem[_mPHP] && INFILE(_LT_PHPref1)) {
1086  if (INFILE(_PHR_PHP_V301)) {
1087  INTERESTING(lDebug ? "PHP(ref-3.01)" : "PHP-3.01");
1088  }
1089  else if (INFILE(_PHR_PHP_V20)) {
1090  INTERESTING(lDebug ? "PHP(ref-2.0)" : "PHP-2.0");
1091  }
1092  else {
1093  INTERESTING(lDebug ? "PHP(ref)" : "PHP");
1094  }
1095  lmem[_mPHP] = 1;
1096  }
1097  else if (!lmem[_mPHP] && URL_INFILE(_URL_PHP)) {
1098  INTERESTING(lDebug ? "PHP(url)" : "PHP");
1099  lmem[_mPHP] = 1;
1100  }
1101  else if (INFILE(_LT_PHP_ref)) {
1102  INTERESTING(lDebug ? "PHP(2)" : "PHP");
1103  lmem[_mPHP] = 1;
1104  }
1106  /*
1107  * Licenses between here and all the GPL/LGPL/GFDL/FSF checks (below) MUST
1108  * be tested PRIOR to checking GPL/FSF and friends
1109  */
1110  if ((INFILE(_CR_EASYSW) || INFILE(_TITLE_CUPS)) && INFILE(_LT_CUPS)) {
1111  if (INFILE(_LT_CUPS_COMMERCIAL)) {
1112  INTERESTING("CUPS-EULA");
1113  }
1114  else {
1115  INTERESTING("CUPS");
1116  }
1117  lmem[_mCUPS] = 1;
1118  }
1120  if (INFILE(_LT_HACKTIVISMO)) {
1121  INTERESTING("Hacktivismo");
1122  lmem[_mGPL] = 1; /* don't look for GPL references */
1123  }
1125  if (INFILE(_LT_NESSUS) && INFILE(_TITLE_NESSUS)) {
1126  INTERESTING("NESSUS-EULA");
1127  lmem[_mLGPL] = 1; /* don't look for LGPL references */
1128  lmem[_mGPL] = 1;
1129  }
1131  /*
1132  * Oracle
1133  */
1134  if (INFILE(_LT_ORACLE_PROTO) && INFILE(_TITLE_ORACLE_PROTO)) {
1135  INTERESTING(lDebug ? "Oracle(proto)" : "Oracle-EULA");
1136  lmem[_mGPL] = 1;
1137  }
1138  else if (INFILE(_LT_ORACLE_DEVEL) && INFILE(_TITLE_ORACLE_DEVEL)) {
1139  INTERESTING(lDebug ? "Oracle(dev)" : "Oracle-Dev");
1140  }
1141  else if (URL_INFILE(_URL_ORACLE_BERKELEY_DB)) {
1142  INTERESTING(lDebug ? "URL_ORACLE_BERKELEY_DB" : "Oracle-Berkeley-DB");
1143  }
1145  /*
1146  * CeCILL
1147  * According to digikam-0.9.4/digikam/libs/greycstoration/CImg.h:
1148  * The CeCILL-C (C_V1) license is close to the GNU LGPL
1149  * The CeCILL (V2.0) license is compatible with the GNU GPL
1150  */
1151  if (INFILE(_TITLE_CECILL_V11_2) || INFILE(_SPDX_CECILL_11)) {
1152  INTERESTING(lDebug ? "CeCILL_v1.1(#2)" : "CECILL-1.1");
1153  lmem[_mGPL] = lmem[_mLGPL] = 1;
1154  }
1155  else if (INFILE(_TITLE_CECILL_B) || INFILE(_TITLE_CECILL_B1) || INFILE(_SPDX_CECILL_B)) {
1156  INTERESTING("CECILL-B");
1157  }
1158  else if (INFILE(_TITLE_CECILL_C) || INFILE(_TITLE_CECILL_C1) || INFILE(_SPDX_CECILL_C)) {
1159  INTERESTING("CECILL-C");
1160  }
1161  else if (INFILE(_LT_CECILL_DUALref)) {
1162  INTERESTING("CECILL(dual)");
1163  lmem[_mGPL] = lmem[_mLGPL] = 1;
1164  }
1165  else if (INFILE(_SPDX_CECILL_10)) {
1166  INTERESTING("CECILL-1.0");
1167  }
1168  else if (INFILE(_SPDX_CECILL_21)) {
1169  INTERESTING("CECILL-2.1");
1170  }
1171  else if (INFILE(_LT_CECILL_2_ref) || INFILE(_SPDX_CECILL_20)) {
1172  INTERESTING("CECILL-2.0");
1173  }
1174  else if (INFILE(_LT_CECILL_ref2)) {
1175  INTERESTING("CECILL");
1176  }
1177  else if (INFILE(_LT_CECILL_B_ref)) {
1178  INTERESTING("CECILL-B");
1179  }
1180  else if (INFILE(_LT_CECILL_ref) || INFILE(_LT_CECILL_ref1)) {
1181  if (URL_INFILE(_URL_CECILL_C_V11)) {
1182  INTERESTING(lDebug ? "CeCILL_v1.1(url)" : "CECILL-1.1");
1183  }
1184  else if (URL_INFILE(_URL_CECILL_C_V1)) {
1185  INTERESTING(lDebug ? "CeCILL_v1(url)" : "CECILL-1.0");
1186  }
1187  else if (URL_INFILE(_URL_CECILL_V2)) {
1188  INTERESTING(lDebug ? "CeCILL_v2(url)" : "CECILL-2.0");
1189  }
1190  else if (URL_INFILE(_URL_CECILL)) {
1191  INTERESTING(lDebug ? "CeCILL(url)" : "CECILL");
1192  }
1193  else {
1194  INTERESTING(lDebug ? "CeCILL(#3)" : "CECILL");
1195  }
1196  lmem[_mGPL] = 1;
1197  }
1198  else if (INFILE(_LT_CECILL_1)) {
1199  if (INFILE(_TITLE_CECILL_V10)) {
1200  INTERESTING(lDebug ? "CeCILL_v1.0(#1)" : "CECILL-1.0");
1201  }
1202  else if (INFILE(_TITLE_CECILL_V20)) {
1203  INTERESTING(lDebug ? "CeCILL_v2.0(#1)" : "CECILL-2.0");
1204  }
1205  lmem[_mGPL] = 1;
1206  }
1207  else if (INFILE(_LT_CECILL_2) || INFILE(_TITLE_CECILL1) || INFILE(_TITLE_CECILL2)) {
1208  if (INFILE(_TITLE_CECILL_V10)) {
1209  INTERESTING(lDebug ? "CeCILL_v1.0(#2)" : "CECILL-1.0");
1210  }
1211  else if (INFILE(_TITLE_CECILL_V11)) {
1212  INTERESTING(lDebug ? "CeCILL_v1.1(#1)" : "CECILL-1.1");
1213  }
1214  else if (INFILE(_TITLE_CECILL_V20)) {
1215  INTERESTING(lDebug ? "CeCILL_v2.0(#2)" : "CECILL-2.0");
1216  }
1217  else {
1218  INTERESTING(lDebug ? "CeCILL(#2)" : "CECILL");
1219  }
1220  lmem[_mGPL] = 1;
1221  }
1223  /*
1224  * Monash University
1225  */
1226  if (INFILE(_CR_UMONASH) && INFILE(_LT_UMONASH)) {
1227  INTERESTING("U-Monash");
1228  if (INFILE(_PHR_GPL_NO_MORE)) {
1229  lmem[_mGPL] = 1;
1230  }
1231  }
1233  /* Open Font License */
1234  if (INFILE(_LT_OPEN_FONT_V10) || INFILE(_LT_OPEN_FONT_V10_1))
1235  {
1236  INTERESTING("OFL-1.0");
1237  lmem[_fOFL] = 1;
1238  }
1239  else if (INFILE(_PHR_OPEN_FONT_V10_1) || INFILE(_PHR_OPEN_FONT_V10_2))
1240  {
1241  INTERESTING("OFL-1.0");
1242  lmem[_fOFL] = 1;
1243  }
1244  else if (INFILE(_LT_OPEN_FONT_V11) || INFILE(_LT_OPEN_FONT_V11_1))
1245  {
1246  INTERESTING("OFL-1.1");
1247  lmem[_fOFL] = 1;
1248  }
1249  else if (INFILE(_PHR_OPEN_FONT_V11_1) || INFILE(_PHR_OPEN_FONT_V11_2))
1250  {
1251  INTERESTING("OFL-1.1");
1252  lmem[_fOFL] = 1;
1253  }
1255  /* Simple Public License 2.0 */
1256  if (INFILE(_TITLE_SimPL_V2)) {
1257  INTERESTING("SimPL-2.0");
1258  lmem[_mGPL] = 1;
1259  }
1261  /* Leptonica license */
1262  if (INFILE(_TITLE_LEPTONICA) && INFILE(_LT_GNU_3)) {
1263  INTERESTING("Leptonica");
1264  }
1266  /* copyleft-next license
1267  * It has to be checked before GPL because the license has the reference
1268  * to GPL license which gives a false positive GPL finding.
1269  */
1270  if (INFILE(_TITLE_COPYLEFT_NEXT_030) && INFILE(_PHR_COPYLEFT_NEXT_PARA1) && INFILE(_PHR_COPYLEFT_NEXT_PARA3)) {
1271  INTERESTING("copyleft-next-0.3.0");
1272  lmem[_mGPL] = 1;
1273  }
1274  else if (INFILE(_TITLE_COPYLEFT_NEXT_031) && INFILE(_PHR_COPYLEFT_NEXT_PARA1) && INFILE(_PHR_COPYLEFT_NEXT_PARA3)) {
1275  INTERESTING("copyleft-next-0.3.1");
1276  lmem[_mGPL] = 1;
1277  }
1278  else if (INFILE(_PHR_COPYLEFT_NEXT_030) || INFILE(_SPDX_copyleft_next_030)) {
1279  INTERESTING("copyleft-next-0.3.0");
1280  }
1281  else if (INFILE(_PHR_COPYLEFT_NEXT_031) || INFILE(_SPDX_copyleft_next_031)) {
1282  INTERESTING("copyleft-next-0.3.1");
1283  }
1285  /*
1286  * GPL, LGPL, GFDL
1287  * QUESTION: do we need to check for the FSF copyright since we also
1288  * check for "GNU" or "free"?
1289  */
1290  if ((NOT_INFILE(_LT_FORMER_GNU) && (mCR_FSF() ||
1291  HASTEXT(_TEXT_GNUTERMS, REG_EXTENDED)))) {
1292  /*
1293  * Affero
1294  */
1295  if (INFILE(_PHR_AGPL) && NOT_INFILE(_LT_GPL3ref4)) {
1296  if (INFILE(_LT_AGPL1) || INFILE(_LT_AGPL2) ||
1297  INFILE(_LT_AGPL3)) {
1298  cp = AGPLVERS();
1299  INTERESTING(lDebug ? "Affero(#1)" : cp);
1300  lmem[_mGPL] = 1;
1301  }
1302  else if (INFILE(_LT_AGPLref1)) {
1303  cp = AGPLVERS();
1304  INTERESTING(lDebug ? "Affero(#2)" : cp);
1305  lmem[_mGPL] = 1;
1306  }
1307  else if (INFILE(_LT_AGPLref2) && NOT_INFILE(_LT_NOT_AGPLref1)) {
1308  cp = AGPLVERS();
1309  INTERESTING(lDebug ? "Affero(#3)" : cp);
1310  lmem[_mGPL] = 1;
1311  }
1312  else if (mCR_FSF() && NOT_INFILE(_LT_GPL3_NOT_AGPL)) {
1313  cp = AGPLVERS();
1314  INTERESTING(lDebug ? "Affero(CR)" : cp);
1315  lmem[_mGPL] = 1;
1316  }
1317  }
1318  else if (INFILE(_LT_AGPL_NAMED)) {
1319  cp = AGPLVERS();
1320  INTERESTING(lDebug ? "AGPL(named)" : cp);
1321  lmem[_mGPL] = 1;
1322  }
1323 
1324  /*
1325  * Some packages have a single file containing both a GPL and an LGPL
1326  * license. Therefore, these checks should NOT be exclusive.
1327  */
1328  /* * The Nethack General Public License (NGPL) */
1329  else if (INFILE(_TITLE_NGPL)) {
1330  INTERESTING("NGPL");
1331  lmem[_mGPL] = 1;
1332  }
1333  else if (INFILE(_LT_GPL_V1)) {
1334  INTERESTING("GPL-1.0");
1335  lmem[_mGPL] = 1;
1336  }
1337  else if (INFILE(_LT_GPL_1) && !HASTEXT(_LT_GPL_EXCEPT_0, REG_EXTENDED)) {
1338  if (INFILE(_PHR_GPL2_OR_LATER_1) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1339  {
1340  INTERESTING(lDebug ? "PHR(GPL2_OR_LATER#1)" : "GPL-2.0+");
1341  lmem[_mGPL] = 1;
1342  }
1343  else if (INFILE(_TITLE_GPL2)) {
1344  INTERESTING(lDebug ? "Title(GPL-2.0)" : "GPL-2.0");
1345  lmem[_mGPL] = 1;
1346  }
1347  else if (INFILE(_PHR_GPL1_OR_LATER) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1348  {
1349  INTERESTING("GPL-1.0+");
1350  lmem[_mGPL] = 1;
1351  }
1352  else if (INFILE(_TITLE_GPL1)) {
1353  INTERESTING("GPL-1.0");
1354  lmem[_mGPL] = 1;
1355  }
1356  else {
1357  INTERESTING("GPL");
1358  lmem[_mGPL] = 1;
1359  }
1360  }
1361  else if ((INFILE(_LT_GPL_V2) || INFILE(_LT_GPL_V2_ref) || INFILE(_LT_GPL_V2_ref1) || INFILE(_LT_GPL_V2_ref2)) && !HASTEXT(_LT_GPL_EXCEPT_0, REG_EXTENDED)) {
1362  if (INFILE(_PHR_GPL2_OR_LATER_1) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1363  {
1364  INTERESTING(lDebug ? "PHR(GPL2_OR_LATER#2)" : "GPL-2.0+");
1365  lmem[_mGPL] = 1;
1366  }
1367  else {
1368  INTERESTING(lDebug ? "LT(GPL-V2)" : "GPL-2.0");
1369  lmem[_mGPL] = 1;
1370  }
1371  }
1372  else if (INFILE(_PHR_GPL2_OR_LATER_2))
1373  {
1374  INTERESTING(lDebug ? "PHR(GPL2_OR_LATER#2)" : "GPL-2.0+");
1375  lmem[_mGPL] = 1;
1376  }
1377  else if (INFILE(_LT_GPL3_PATENTS)) {
1378  if (INFILE(_TITLE_GPL3)) {
1379  INTERESTING(lDebug ? "GPL_v3(#1)" : "GPL-3.0");
1380  lmem[_mGPL] = 1;
1381  }
1382  else {
1383  INTERESTING("GPL-3.0-possibility");
1384  lmem[_mGPL] = 1;
1385  }
1386  }
1387  else if (INFILE(_TITLE_GPL3_ref3_later)) {
1388  INTERESTING("GPL-3.0+");
1389  lmem[_mGPL] = 1;
1390  }
1391  else if (INFILE(_TITLE_GPL3_ref4_later)) {
1392  INTERESTING("GPL-3.0+");
1393  lmem[_mGPL] = 1;
1394  }
1395  else if (INFILE(_TITLE_GPL3_ref3)) {
1396  INTERESTING("GPL-3.0");
1397  lmem[_mGPL] = 1;
1398  }
1399  if (INFILE(_LT_LGPL_1) || INFILE(_LT_LGPL_2)) {
1400  if (INFILE(_PHR_LGPL21_OR_LATER_1) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1401  {
1402  INTERESTING("LGPL-2.1+");
1403  lmem[_mLGPL] = 1;
1404  }
1405  else if (INFILE(_PHR_LGPL2_OR_LATER) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1406  {
1407  INTERESTING("LGPL-2.0+");
1408  lmem[_mLGPL] = 1;
1409  }
1410  else if (INFILE(_TITLE_LGPLV21)) {
1411  INTERESTING("LGPL-2.1");
1412  lmem[_mLGPL] = 1;
1413  }
1414  else if (INFILE(_TITLE_LGPLV2)) {
1415  INTERESTING("LGPL-2.0");
1416  lmem[_mLGPL] = 1;
1417  }
1418  else {
1419  INTERESTING("LGPL");
1420  lmem[_mLGPL] = 1;
1421  }
1422  }
1423  else if (INFILE(_LT_LGPL_3)) {
1424  if ((INFILE(_PHR_LGPL3_OR_LATER)
1425  || INFILE(_PHR_LGPL3_OR_LATER_ref1)
1426  || INFILE(_PHR_LGPL3_OR_LATER_ref2))
1427  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1428  {
1429  INTERESTING("LGPL-3.0+");
1430  lmem[_mLGPL] = 1;
1431  }
1432  else if (INFILE(_TITLE_LGPL3)) {
1433  INTERESTING("LGPL-3.0");
1434  lmem[_mLGPL] = 1;
1435  }
1436  else {
1437  INTERESTING("LGPL-3.0-possibility");
1438  lmem[_mLGPL] = 1;
1439  }
1440  }
1441  if (INFILE(_LT_GFDL)) {
1442  cp = GFDLVERS();
1443  INTERESTING(lDebug ? "GFDL(#1)" : cp);
1444  lmem[_mGFDL] = 1;
1445  }
1446  if (!lmem[_mLGPL] && NOT_INFILE(_LT_MPL_SECONDARY)) { /* no FSF/GPL-like match yet */
1447  /*
1448  NOTE: search for LGPL before GPL; the latter matches
1449  occurrences of former
1450  */
1451  if (INFILE(_LT_GPL_FONT1) && INFILE(_LT_GPL_FONT2)) {
1452  INTERESTING(lDebug ? "GPL(fonts)" : "GPL-exception");
1453  lmem[_mGPL] = 1;
1454  }
1455  else if (INFILE(_LT_LGPL_ALT)) {
1456  cp = LGPLVERS();
1457  INTERESTING(lDebug ? "LGPL(alternate)" : cp);
1458  lmem[_mLGPL] = 1;
1459  }
1460  else if (INFILE(_LT_LGPL3_ref_later)) {
1461  INTERESTING("LGPL-3.0+");
1462  lmem[_mLGPL] = 1;
1463  }
1464  else if (INFILE(_LT_LGPLref1)) {
1465  cp = LGPLVERS();
1466  INTERESTING(lDebug ? "LGPL(ref1)" : cp);
1467  lmem[_mLGPL] = 1;
1468  }
1469  else if (INFILE(_LT_LGPLref2) &&
1470  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1471  cp = LGPLVERS();
1472  INTERESTING(lDebug ? "LGPL(ref2#1)" : cp);
1473  lmem[_mLGPL] = 1;
1474  }
1475  else if (INFILE(_LT_LGPLref3)) {
1476  cp = LGPLVERS();
1477  INTERESTING(lDebug ? "LGPL(ref3)" : cp);
1478  lmem[_mLGPL] = 1;
1479  }
1480  else if (INFILE(_LT_LGPLref4)) {
1481  cp = LGPLVERS();
1482  INTERESTING(lDebug ? "LGPL(ref4)" : cp);
1483  lmem[_mLGPL] = 1;
1484  }
1485  else if (INFILE(_LT_LGPLref5)) {
1486  cp = LGPLVERS();
1487  INTERESTING(lDebug ? "LGPL(ref5)" : cp);
1488  lmem[_mLGPL] = 1;
1489  }
1490  else if (INFILE(_LT_LGPLref6)) {
1491  cp = LGPLVERS();
1492  INTERESTING(lDebug ? "LGPL(ref6)" : cp);
1493  lmem[_mLGPL] = 1;
1494  }
1495  else if (!lmem[_mLIBRE] && !lmem[_fREAL] &&
1496  INFILE(_LT_LGPLref7) &&
1497  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1498  cp = LGPLVERS();
1499  INTERESTING(lDebug ? "LGPL(ref7)" : cp);
1500  lmem[_mLGPL] = 1;
1501  }
1502  else if (!lmem[_fREAL] && !lmem[_mAPTANA] &&
1503  !LVAL(_TEXT_GNU_LIC_INFO) && INFILE(_LT_LGPLref8) &&
1504  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1505  cp = LGPLVERS();
1506  INTERESTING(lDebug ? "LGPL(ref8)" : cp);
1507  lmem[_mLGPL] = 1;
1508  }
1509  else if (INFILE(_LT_LGPLref9) &&
1510  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1511  cp = LGPLVERS();
1512  INTERESTING(lDebug ? "LGPL(ref9)" : cp);
1513  lmem[_mLGPL] = 1;
1514  }
1515  else if (INFILE(_LT_LGPLref10) &&
1516  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1517  cp = LGPLVERS();
1518  INTERESTING(lDebug ? "LGPL(ref10)" : cp);
1519  lmem[_mLGPL] = 1;
1520  }
1521  else if (INFILE(_LT_LGPLref11)) {
1522  cp = LGPLVERS();
1523  INTERESTING(lDebug ? "LGPL(ref11)" : cp);
1524  lmem[_mLGPL] = 1;
1525  }
1526  else if (INFILE(_FILE_LGPL1) || INFILE(_FILE_LGPL2)) {
1527  cp = LGPLVERS();
1528  INTERESTING(lDebug ? "LGPL(deb)" : cp);
1529  lmem[_mLGPL] = 1;
1530  }
1531  else if (!LVAL(_TEXT_GNU_LIC_INFO) &&
1532  (URL_INFILE(_URL_LGPL_1) ||
1533  URL_INFILE(_URL_LGPL_2))) {
1534  cp = LGPLVERS();
1535  INTERESTING(lDebug ? "LGPL(url)" : cp);
1536  lmem[_mLGPL] = 1;
1537  }
1538  else if (lmem[_fREAL] && !LVAL(_TEXT_GNU_LIC_INFO) &&
1539  GPL_INFILE(_LT_LGPL_OR)) {
1540  cp = LGPLVERS();
1541  INTERESTING(lDebug ? "LGPL(or)" : cp);
1542  lmem[_mLGPL] = 1;
1543  }
1544  else if (INFILE(_PHR_LGPL21_OR_LATER_2)) {
1545  INTERESTING(lDebug ? "LGPL-2.1+(_LATER_2)" : "LGPL-2.1+");
1546  lmem[_mLGPL] = 1;
1547  }
1548  else if (INFILE(_PHR_LGPL21_ONLY_ref) || INFILE(_TITLE_LGPLV21_2)) {
1549  INTERESTING("LGPL-2.1");
1550  lmem[_mLGPL] = 1;
1551  }
1552  }
1553  if (!lmem[_mGPL] && !HASTEXT(_TEXT_GCC, REG_EXTENDED)) {
1554  if (GPL_INFILE(_LT_GPL_ALT) && !INFILE(_LT_LGPL_ALT)) {
1555  cp = GPLVERS();
1556  INTERESTING(lDebug ? "GPL(alternate)" : cp);
1557  lmem[_mGPL] = 1;
1558  }
1559  else if ((GPL_INFILE(_LT_GPL3ref2) || GPL_INFILE(_PHR_GPL3_OR_LATER)
1560  || GPL_INFILE(_PHR_GPL3_OR_LATER_ref1) || GPL_INFILE(_PHR_GPL3_OR_LATER_ref2))
1561  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
1562  {
1563  INTERESTING("GPL-3.0+");
1564  lmem[_mGPL] = 1;
1565  }
1566  else if (GPL_INFILE(_LT_GPL3ref)) {
1567  INTERESTING(lDebug ? "GPL_v3(#2)" : "GPL-3.0");
1568  lmem[_mGPL] = 1;
1569  }
1570  else if (GPL_INFILE(_LT_GPL3ref3) && NOT_INFILE(_TITLE_LGPL3)) {
1571  INTERESTING("GPL-3.0");
1572  lmem[_mGPL] = 1;
1573  }
1574  else if (!lmem[_mLIBRE] && GPL_INFILE(_LT_GPLref1)
1575  && NOT_INFILE(_PHR_NOT_UNDER_GPL)
1576  && NOT_INFILE(_LT_LGPLref2)
1577  && NOT_INFILE(_PHR_GPL_COMPAT_3)) {
1578  /*
1579  * Special exceptions:
1580  * (1) LaTeX uses the following phrase:
1581  * "... why distributing LaTeX under the GNU General Public License (GPL)
1582  * was considered inappropriate".
1583  * (2) Python uses the following phrases:
1584  * "GPL-compatible doesn't mean that we're distributing Python under the GPL"
1585  * AND, "GPL-compatible licenses make it possible to combine Python with
1586  * other software that is released under the GPL.
1587  *****
1588  * These MUST be filtered. Do so by marking the GPL flag but don't assign
1589  * a license component (e.g., ignore GPL for this file)
1590  */
1591  if (INFILE(_PHR_LATEX_GPL_INAPPROPRIATE) ||
1592  INFILE(_PHR_PYTHON_NOTGPL_1) ||
1593  INFILE(_PHR_PYTHON_NOTGPL_2)) {
1594  lmem[_mGPL] = 1;
1595  }
1596  else if (!HASTEXT(_TEXT_GCC, REG_EXTENDED)
1597  && NOT_INFILE(_TITLE_D_FSL_10)){
1598  cp = GPLVERS();
1599  INTERESTING(cp);
1600  lmem[_mGPL] = 1;
1601  }
1602  }
1603  else if (INFILE(_LT_GPL_FSF)) {
1604  cp = GPLVERS();
1605  INTERESTING(lDebug ? "GPL(FSF)" : cp);
1606  lmem[_mGPL] = 1;
1607  }
1608  else if (GPL_INFILE(_LT_GPLref2)) {
1609  cp = GPLVERS();
1610  INTERESTING(lDebug ? "GPL(ref2)" : cp);
1611  lmem[_mGPL] = 1;
1612  }
1613  else if (GPL_INFILE(_LT_GPLref3)) {
1614  cp = GPLVERS();
1615  INTERESTING(lDebug ? "GPL(ref3)" : cp);
1616  lmem[_mGPL] = 1;
1617  }
1618  else if (INFILE(_LT_GPLref4)) {
1619  cp = GPLVERS();
1620  INTERESTING(lDebug ? "GPL(ref4)" : cp);
1621  lmem[_mGPL] = 1;
1622  }
1623  else if (GPL_INFILE(_LT_GPLref5)) {
1624  cp = GPLVERS();
1625  INTERESTING(lDebug ? "GPL(ref5)" : cp);
1626  lmem[_mGPL] = 1;
1627  }
1628  else if (GPL_INFILE(_LT_GPLref6)) {
1629  cp = GPLVERS();
1630  INTERESTING(lDebug ? "GPL(ref6)" : cp);
1631  lmem[_mGPL] = 1;
1632  }
1633  else if (GPL_INFILE(_LT_GPLref7)) {
1634  cp = GPLVERS();
1635  INTERESTING(lDebug ? "GPL(ref7)" : cp);
1636  lmem[_mGPL] = 1;
1637  }
1638  else if (GPL_INFILE(_LT_GPLref8)) {
1639  cp = GPLVERS();
1640  INTERESTING(lDebug ? "GPL(ref8)" : cp);
1641  lmem[_mGPL] = 1;
1642  }
1643  else if (INFILE(_LT_GPLref9)) {
1644  cp = GPLVERS();
1645  INTERESTING(lDebug ? "GPL(ref9)" : cp);
1646  lmem[_mGPL] = 1;
1647  }
1648  else if (GPL_INFILE(_LT_GPLref10)) {
1649  cp = GPLVERS();
1650  INTERESTING(lDebug ? "GPL(ref10)" : cp);
1651  lmem[_mGPL] = 1;
1652  }
1653  else if (INFILE(_LT_GPLref11)) {
1654  cp = GPLVERS();
1655  INTERESTING(lDebug ? "GPL(ref11)" : cp);
1656  lmem[_mGPL] = 1;
1657  }
1658  else if (INFILE(_LT_GPLref12)) {
1659  cp = GPLVERS();
1660  INTERESTING(lDebug ? "GPL(ref12)" : cp);
1661  lmem[_mGPL] = 1;
1662  }
1663  else if (GPL_INFILE(_LT_GPLref13)) {
1664  cp = GPLVERS();
1665  INTERESTING(lDebug ? "GPL(ref13)" : cp);
1666  lmem[_mGPL] = 1;
1667  }
1668  else if (GPL_INFILE(_LT_GPLref14) &&
1669  NOT_INFILE(_LT_LGPLref2)) {
1670  cp = GPLVERS();
1671  INTERESTING(lDebug ? "GPL(ref14)" : cp);
1672  lmem[_mGPL] = 1;
1673  }
1674  else if (INFILE(_LT_GPLref16)) {
1675  cp = GPLVERS();
1676  INTERESTING(lDebug ? "GPL(ref16)" : cp);
1677  lmem[_mGPL] = 1;
1678  }
1679  else if (INFILE(_LT_GPLref18)) {
1680  cp = GPLVERS();
1681  INTERESTING(lDebug ? "GPL(ref18)" : cp);
1682  lmem[_mGPL] = 1;
1683  }
1684  else if (INFILE(_LT_GPLref19)) {
1685  cp = GPLVERS();
1686  INTERESTING(lDebug ? "GPL(ref19)" : cp);
1687  lmem[_mGPL] = 1;
1688  }
1689  else if (INFILE(_LT_GPLref20)) {
1690  cp = GPLVERS();
1691  INTERESTING(lDebug ? "GPL(ref20)" : cp);
1692  lmem[_mGPL] = 1;
1693  }
1694  else if (!LVAL(_TEXT_GNU_LIC_INFO) && NOT_INFILE(_LT_INTEL_7) &&
1695  (URL_INFILE(_URL_GPL_1) ||
1696  URL_INFILE(_URL_GPL_2) ||
1697  URL_INFILE(_URL_GPL_3))) {
1698  cp = GPLVERS();
1699  INTERESTING(lDebug ? "GPL(url)" : cp);
1700  lmem[_mGPL] = 1;
1701  }
1702  else if (URL_INFILE(_URL_AGPL)) {
1703  cp = AGPLVERS();
1704  INTERESTING(lDebug ? "Affero(url)" : cp);
1705  lmem[_mGPL] = 1;
1706  }
1707  else if (!ltsr[_LT_LGPL_3] && INFILE(_LT_GPL_OR)) {
1708  cp = GPLVERS();
1709  INTERESTING(lDebug ? "GPL(or)" : cp);
1710  lmem[_mGPL] = 1;
1711  }
1712  else if (!lmem[_mGPL] && !lmem[_mLGPL] &&
1713  (INFILE(_LT_GNU_1) + INFILE(_LT_GNU_2) +
1714  INFILE(_LT_GNU_3) + INFILE(_LT_GNU_4) > 2)) {
1715  cp = GPLVERS();
1716  INTERESTING(lDebug ? "GPL(GNU)" : cp);
1717  lmem[_mGPL] = 1;
1718  }
1719  else if (!lmem[_mGPL] && !lmem[_mLGPL] &&
1720  INFILE(_LT_SEE_GPL) && INFILE(_LT_RECV_GPL)) {
1721  cp = GPLVERS();
1722  INTERESTING(lDebug ? "GPL(see)" : cp);
1723  lmem[_mGPL] = 1;
1724  }
1725  else if (!lmem[_mGPL] && !lmem[_mLGPL] &&
1726  INFILE(_LT_SEE_LGPL) && INFILE(_LT_RECV_LGPL)) {
1727  cp = LGPLVERS();
1728  INTERESTING(lDebug ? "LGPL(see)" : cp);
1729  lmem[_mLGPL] = 1;
1730  }
1731  }
1732  if (!lmem[_mGFDL] && (INFILE(_LT_GFDLref1) ||
1733  INFILE(_TITLE_GFDL))) {
1734  cp = GFDLVERS();
1735  INTERESTING(lDebug ? "GFDL(#2)" : cp);
1736  lmem[_mGFDL] = 1;
1737  }
1738  /*
1739  * Listed _explictly_ as an exception to the GPL -- this is NOT an 'else'
1740  * clause!
1741  */
1742  if (!lmem[_mGPL] && INFILE(_PHR_GPL_DESCRIPTIONS)) {
1743  INTERESTING(lDebug ? "GPL-kinda" : "GPL");
1744  lmem[_mGPL] = 1;
1745  }
1746  /* checking for FSF */
1747  if (INFILE(_LT_FSF_1)) {
1748  INTERESTING(lDebug ? "FSF(1)" : "FSF");
1749  lmem[_mLGPL] = 1;
1750  }
1751  else if (INFILE(_LT_FSF_2)) {
1752  INTERESTING(lDebug ? "FSF(2)" : "FSF");
1753  }
1754  else if (INFILE(_LT_FSF_3)) {
1755  INTERESTING(lDebug ? "FSF(3)" : "FSF");
1756  }
1757  else if (mCR_FSF() && INFILE(_LT_FSF_4)) {
1758  INTERESTING(lDebug ? "FSF(4)" : "FSF");
1759  }
1760  else if (!lmem[_mGPL] && mCR_FSF() && INFILE(_LT_FSF_5)) {
1761  INTERESTING(lDebug ? "FSF(5)" : "FSF");
1762  }
1763  else if (!lmem[_mGPL] && NOT_INFILE(_LT_Autoconf_exception_20) && INFILE(_LT_FSFref1)) {
1764  INTERESTING(lDebug ? "FSF(ref1)" : "FSF");
1765  }
1766  else if (INFILE(_LT_FSFref2)) {
1767  INTERESTING(lDebug ? "FSF(ref2)" : "FSF");
1768  }
1769  else if (INFILE(_LT_LGPLrefFSF) &&
1770  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1771  INTERESTING(lDebug ? "LGPL(FSF)" : "LGPL");
1772  lmem[_mLGPL] = 1;
1773  }
1774  if (!lmem[_mGPL] && !lmem[_mLGPL] && !lmem[_mGFDL]) {
1775  /*
1776  * Check these patterns AFTER checking for FSF and GFDL, and only if the
1777  * CUPS license isn't present.
1778  */
1779  if (!lmem[_mCUPS] ) {
1780  if (GPL_INFILE(_LT_GPLpatt1) &&
1781  NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
1782  cp = GPLVERS();
1783  INTERESTING(lDebug ? "GPL(patt1)" : cp);
1784  lmem[_mGPL] = 1;
1785  }
1786  else if (GPL_INFILE(_LT_GPLpatt2)) {
1787  cp = GPLVERS();
1788  INTERESTING(lDebug ? "GPL(patt2)" : cp);
1789  lmem[_mGPL] = 1;
1790  }
1791  else if (INFILE(_CR_rms) && INFILE(_LT_GPL_2)) {
1792  INTERESTING("GPL(rms)");
1793  lmem[_mGPL] = 1;
1794  }
1795  else if (INFILE(_PHR_GPLISH_SAMPLE)) {
1796  INTERESTING(lDebug ? "GPLISH" : "GPL-possibility");
1797  INTERESTING(lDebug ? "GPLISH" : "LGPL-possibility");
1798  lmem[_mLGPL] = lmem[_mGPL] = 1;
1799  }
1800  }
1801  }
1802  else if (INFILE(_LT_GNU_COPYLEFT)) {
1803  INTERESTING("GNU-copyleft");
1804  lmem[_fGPL] = 1;
1805  }
1806  lmem[_fGPL] = lmem[_mLGPL]+lmem[_mGPL]+lmem[_mGFDL];
1807  }
1809  if (!lmem[_mGPL] && INFILE(_LT_GNU_PROJECTS)) {
1810  cp = GPLVERS();
1811  INTERESTING(lDebug ? "GPL(proj)" : cp);
1812  lmem[_mGPL] = 1;
1813  }
1815  if (HASTEXT(_LT_GPL_V2_NAMED_later, REG_EXTENDED) || HASTEXT(_TITLE_GPL2_ref1_later, REG_EXTENDED))
1816  {
1817  INTERESTING(lDebug ? "GPLV2+(named)" : "GPL-2.0+");
1818  lmem[_mGPL] = 1;
1819  }
1820  else if (INFILE(_LT_TAPJOY) || INFILE(_LT_TAPJOY_ref1)) {
1821  INTERESTING("Tapjoy");
1822  lmem[_fGPL] = 1;
1823  lmem[_mMIT] = 1;
1824  }
1825  else if (!lmem[_mGPL] && !lmem[_mGFDL] && !lmem[_mLGPL] && !lmem[_fZPL]
1826  && (INFILE(_LT_GPL_NAMED)
1827  || INFILE(_LT_GPL_NAMED2)
1828  || HASTEXT(_LT_GPL_NAMED3, REG_EXTENDED))
1829  && !HASTEXT(_PHR_GPL_GHOSTSCRIPT, REG_EXTENDED)
1830  && NOT_INFILE(_LT_MPL_SECONDARY)
1831  && NOT_INFILE(_TEXT_NOT_GPL)
1832  && NOT_INFILE(_TEXT_NOT_GPL2)
1833  && NOT_INFILE(_LT_CNRI_PYTHON_GPL)
1834  && NOT_INFILE(_LT_W3Cref4)
1835  && NOT_INFILE(_LT_GPL_NAMED3_EXHIBIT)
1836  && NOT_INFILE(_LT_GPL_NAMED_COMPATIBLE)
1837  && !HASTEXT(_LT_GPL_NAMED_COMPATIBLE_1, REG_EXTENDED)
1838  && NOT_INFILE(_LT_GPL_NAMED_EXHIBIT)
1839  && NOT_INFILE(_TITLE_D_FSL_10)
1840  && NOT_INFILE(_LT_INTEL_7)
1841  && NOT_INFILE(_PHR_GPL_COMPAT_3)) {
1842  cp = GPLVERS();
1843  INTERESTING(lDebug ? "GPL(named)" : cp);
1844  lmem[_mGPL] = 1;
1845  }
1846  else if ( !lmem[_mGPL] && !INFILE(_TITLE_MIROS) && (INFILE(_LT_GPL_V2_NAMED) || INFILE(_LT_GPL_V2_NAMED_ref1)))
1847  {
1848  INTERESTING(lDebug ? "GPLV2(named)" : "GPL-2.0");
1849  lmem[_mGPL] = 1;
1850  }
1851  else if (!lmem[_mGPL] && INFILE(_LT_GPL_V3_NAMED_later))
1852  {
1853  INTERESTING(lDebug ? "GPLV3(named_later)" : "GPL-3.0+");
1854  }
1855  else if (!lmem[_mGPL] && INFILE(_LT_GPL_V3_NAMED))
1856  {
1857  INTERESTING(lDebug ? "GPLV3(named)" : "GPL-3.0");
1858  }
1860  if (!lmem[_mLGPL] && (INFILE(_LT_LGPL_NAMED)
1861  || INFILE(_LT_LGPL_NAMED2)) && NOT_INFILE(_LT_GPL_NAMED_EXHIBIT)
1862  && NOT_INFILE(_LT_PHP_V30_2)) {
1863  cp = LGPLVERS();
1864  INTERESTING(lDebug ? "LGPL(named)" : cp);
1865  }
1866 
1868  /*
1869  * MIT, X11, Open Group, NEC -- text is very long, search in 2 parts
1870  */
1871  if (INFILE(_LT_JSON) && INFILE(_LT_MIT_NO_EVIL)) { // JSON license
1872  INTERESTING("JSON");
1873  lmem[_mMIT] = 1;
1874  }
1876  if (!lmem[_mWORDNET] && INFILE(_TITLE_WORDNET))
1877  {
1878  INTERESTING("WordNet-3.0");
1879  }
1881  if (INFILE(_CR_XFREE86_V10) || INFILE(_LT_XFREE86_V10)) {
1882  INTERESTING("XFree86-1.0");
1883  lmem[_mMIT] = 1;
1884  }
1885  else if (INFILE(_CR_XFREE86_V11) || INFILE(_LT_XFREE86_V11)) {
1886  INTERESTING("XFree86-1.1");
1887  lmem[_mMIT] = 1;
1888  }
1889  else if (INFILE(_LT_XFREE86)) {
1890  INTERESTING(lDebug ? "XFree86(1)" : "XFree86");
1891  lmem[_mMIT] = 1;
1892  }
1893  else if (HASTEXT(_LT_BSD_OR_MIT, REG_EXTENDED)) {
1894  INTERESTING("MIT");
1895  INTERESTING("BSD");
1896  lmem[_mMIT] = 1;
1897  }
1898  else if (HASTEXT(_LT_BSD_AND_MIT, REG_EXTENDED)) {
1899  INTERESTING("BSD");
1900  INTERESTING("MIT");
1901  lmem[_mMIT] = 1;
1902  }
1903  /*
1904  * MIT search order changed. First MIT license explicit phrases and references are checked .
1905  */
1906  else if (!lmem[_mMIT] && NOT_INFILE(_TITLE_MIT_EXHIBIT) && NOT_INFILE(_TITLE_SGI) &&
1907  (INFILE(_LT_MIT_1) || INFILE(_TITLE_MIT))) {
1908  if(INFILE(_LT_MIT_NO_EVIL)) {
1909  INTERESTING(lDebug ? "MIT-style(no evil)" : "JSON");
1910  lmem[_mMIT] = 1;
1911  }
1912  else if (INFILE(_LT_MIT_2)) {
1913  if (mCR_MIT() || INFILE(_TITLE_MIT)) {
1914  INTERESTING(lDebug ? "MIT(1)" : "MIT");
1915  lmem[_mMIT] = 1;
1916  }
1917  else if (INFILE(_TITLE_XNET)) {
1918  INTERESTING("Xnet");
1919  lmem[_mMIT] = 1;
1920  }
1921  else if (INFILE(_CR_X11) || INFILE(_TITLE_X11)) {
1922  INTERESTING(lDebug ? "X11(1)" : "X11");
1923  lmem[_mMIT] = 1;
1924  }
1925  else if (INFILE(_CR_XFREE86)) {
1926  INTERESTING(lDebug ? "XFree86(2)" : "XFree86");
1927  lmem[_mMIT] = 1;
1928  }
1929  /* MIT-advertising License */
1930  else if (INFILE(_LT_MIT_ADVERTISING)) {
1931  INTERESTING("MIT-advertising");
1932  lmem[_mMIT] = 1;
1933  }
1934  /* MIT-enna License */
1935  else if (INFILE(_LT_MIT_ENNA)) {
1936  INTERESTING("MIT-enna");
1937  lmem[_mMIT] = 1;
1938  }
1939  /* MIT-feh License */
1940  else if (INFILE(_LT_MIT_FEH)) {
1941  INTERESTING("MIT-feh");
1942  lmem[_mMIT] = 1;
1943  }
1944  /* MITNFA License */
1945  else if (HASTEXT(_LT_MITNFA, 0)) {
1946  INTERESTING("MITNFA");
1947  lmem[_mMIT] = 1;
1948  }
1949  /* Imlib2 License */
1950  else if (INFILE(_LT_Imlib2)) {
1951  INTERESTING("Imlib2");
1952  lmem[_mMIT] = 1;
1953  }
1954  else if (INFILE(_LT_MIT_13)) {
1955  INTERESTING(lDebug ? "MIT(14)" : "MIT");
1956  lmem[_mMIT] = 1;
1957  }
1958  /* NCSA */
1959  else if (INFILE(_TITLE_NCSA) && NOT_INFILE(_TITLE_NCSA_EXHIBIT)) {
1960  INTERESTING(lDebug ? "NCSA(1)" : "NCSA");
1961  lmem[_mMIT] = 1;
1962  lmem[_fNCSA] = 1;
1963  }
1964  else if (INFILE(_LT_MIT_0)) {
1965  INTERESTING("MIT-0");
1966  lmem[_mMIT] = 1;
1967  }
1968  else if (NOT_INFILE(_LT_INTEL_7)) {
1969  INTERESTING(lDebug ? "MIT-style(1)" : "MIT-style");
1970  lmem[_mMIT] = 1;
1971  }
1972  }
1973  else if (INFILE(_LT_BITSTREAM_1)) {
1974  INTERESTING(lDebug ? "Bitstream(1)" : "Bitstream");
1975  lmem[_mMIT] = 1;
1976  }
1977  else if (mCR_X11()) {
1978  INTERESTING(lDebug ? "X11(2)" : "X11");
1979  }
1980  else if (!lmem[_mMPL] && INFILE(_LT_MPL_1)) {
1981  cp = MPLVERS(); /* NPL, too */
1982  INTERESTING(lDebug ? "MPL/NPL#5" : cp);
1983  lmem[_mMPL] = 1;
1984  }
1985  else if (!lmem[_mMIT] && (mCR_MIT() || INFILE(_TITLE_MIT)) && NOT_INFILE(_TITLE_MIT_EXHIBIT)) {
1986  INTERESTING(lDebug ? "MIT(2)" : "MIT");
1987  lmem[_mMIT] = 1;
1988  }
1989  /*
1990  * BOOST (relatively new, circa August 2003)
1991  * hmm, some references have a Copyright Notre Dame, some don't
1992  */
1993  else if (INFILE(_LT_BOOST_1)) {
1994  if (INFILE(_TITLE_BOOST10)) {
1995  INTERESTING("BSL-1.0");
1996  }
1997  else if (INFILE(_CR_NOTREDAME)) {
1998  INTERESTING(lDebug ? "Boost(ND)" : "BSL-1.0");
1999  }
2000  else if (INFILE(_TITLE_BOOST)) {
2001  INTERESTING("BSL-1.0");
2002  }
2003  else {
2004  INTERESTING("BSL-style");
2005  }
2006  }
2007  else if (mCR_MIT()) {
2008  INTERESTING(lDebug ? "MIT(3)" : "MIT");
2009  lmem[_mMIT] = 1;
2010  }
2011  else if (INFILE(_TITLE_ICU) || HASTEXT(_URL_ICU, REG_EXTENDED)) {
2012  INTERESTING(lDebug ? "MIT-style(ICU)" : "ICU");
2013  lmem[_mMIT] = 1;
2014  }
2015  else if (INFILE(_LT_ICU_2) && (INFILE(_CR_IBM_1) || INFILE(_CR_IBM_1))) {
2016  INTERESTING(lDebug ? "MIT-style(ICU)" : "ICU");
2017  lmem[_mMIT] = 1;
2018  }
2019  else if (INFILE(_TITLE_JasPer_20)) {
2020  INTERESTING(lDebug ? "JasPer(title)" : "JasPer-2.0");
2021  lmem[_mMIT] = 1;
2022  }
2023  else if (INFILE(_LT_UNICODE_4)) {
2024  INTERESTING(lDebug ? "MIT-style(Unicode)" : "Unicode");
2025  lmem[_fUNICODE] = 1;
2026  lmem[_mMIT] = 1;
2027  }
2028  /*
2029  * Adobe-Glyph
2030  */
2031  else if (HASTEXT(_LT_ADOBE_GLYPH_1, REG_EXTENDED) && INFILE(_LT_ADOBE_GLYPH_2)) {
2032  INTERESTING("Adobe-Glyph");
2033  }
2034  /*
2035  * Ubuntu Font
2036  */
2037  else if (INFILE(_LT_UBUNTU_FONT)) {
2038  INTERESTING("ubuntu-font-1.0");
2039  }
2040  /*
2041  * OFL license text has MIT license warranty claims which is identifed as MIT-style
2042  */
2043  else if (!lmem[_fOFL]) {
2044  INTERESTING(lDebug ? "MIT-style(2)" : "MIT-style");
2045  lmem[_mMIT] = 1;
2046  }
2047  }
2048  /*
2049  * Secondly X11 and MIT style phrases are checked.
2050  */
2051  else if (INFILE(_LT_MIT_0) && (INFILE(_LT_MIT_2) || INFILE(_LT_MIT_3) || INFILE(_LT_MIT_4) ||
2052  INFILE(_LT_MIT_5) || INFILE(_LT_MIT_6) || INFILE(_LT_MIT_7))) {
2053  if(INFILE(_LT_MIT_NO_EVIL)) {
2054  INTERESTING(lDebug ? "MIT-style(no evil)" : "JSON");
2055  lmem[_mMIT] = 1;
2056  }
2057  else if (INFILE(_LT_X11_5)) {
2058  if (INFILE(_CR_XFREE86)) {
2059  INTERESTING(lDebug ? "XFree86(3)" : "XFree86");
2060  }
2061  else {
2062  INTERESTING(lDebug ? "X11(3)" : "X11");
2063  }
2064  lmem[_mMIT] = 1;
2065  }
2066  else if (INFILE(_LT_Xnet_STYLE)) {
2067  INTERESTING("Xnet");
2068  lmem[_mMIT] = 1;
2069  }
2070  else if (INFILE(_LT_TAPJOY)) {
2071  INTERESTING("Tapjoy");
2072  lmem[_mMIT] = 1;
2073  }
2074  else {
2075  /*
2076  * SPDX defines curl license. It has very typical MIT-style text. The only way to
2077  * identify it is to use copyright or copyright reference.
2078  */
2079  if (INFILE(_CR_CURL)) {
2080  INTERESTING("curl");
2081  }
2082  else {
2083  INTERESTING(lDebug ? "MIT-style(7)" : "MIT-style");
2084  }
2085  lmem[_mMIT] = 1;
2086  }
2087  }
2088  else if (INFILE(_LT_MIT_5)) {
2089  if (mCR_MIT()) {
2090  INTERESTING(lDebug ? "MIT(4)" : "MIT");
2091  }
2092  else {
2093  INTERESTING(lDebug ? "MIT-style(3)" : "MIT-style");
2094  }
2095  lmem[_mMIT] = 1;
2096  }
2098  /*
2099  * Open Group, NEC, MIT use the same text in licenses
2100  */
2101  if (INFILE(_LT_MIT_6)) {
2102  if (!lmem[_mMIT] && INFILE(_CR_OpenGroup)) {
2103  INTERESTING(lDebug ? "OpenGroup(1)" : "OpenGroup");
2104  lmem[_mMIT] = 1;
2105  }
2106  else if (!lmem[_mCMU] && mCR_CMU()) {
2107  INTERESTING(lDebug ? "CMU(2)" : "CMU");
2108  lmem[_mCMU] = 1;
2109  }
2110  else if (!lmem[_mMIT] && mCR_MIT()) {
2111  INTERESTING(lDebug ? "MIT(6)" : "MIT");
2112  lmem[_mMIT] = 1;
2113  }
2114  /*
2115  * _LT_MIT_6 is very similar to _LT_BSD_2 where MIT-CMU licenses
2116  * are also detected. Following else if is the copy from there.
2117  */
2118  else if (!lmem[_mMIT] && INFILE(_LT_CMU_7)) {
2119  if (INFILE(_CR_CMU_1) || INFILE(_CR_CMU_2) || INFILE(_CR_BSDCAL)) {
2120  INTERESTING("MIT-CMU");
2121  }
2122  else {
2123  INTERESTING("MIT-CMU-style");
2124  }
2125  lmem[_mCMU] = 1;
2126  }
2127  else if (!lmem[_mMIT]) {
2128  INTERESTING(lDebug ? "MIT-style(4)" : "MIT-style");
2129  lmem[_mMIT] = 1;
2130  }
2131  }
2132  else if (INFILE(_SPDX_MIT_0)) {
2133  INTERESTING("MIT-0");
2134  }
2135  else if (INFILE(_SPDX_MIT_advertising)) {
2136  INTERESTING("MIT-advertising");
2137  }
2138  else if (INFILE(_SPDX_MIT_enna)) {
2139  INTERESTING("MIT-enna");
2140  }
2141  else if (INFILE(_SPDX_MIT_feh)) {
2142  INTERESTING("MIT-feh");
2143  }
2144  else if (!lmem[_mMIT] && INFILE(_LT_MIT_7)) {
2145  if (INFILE(_CR_OpenGroup)) {
2146  INTERESTING(lDebug ? "OpenGroup(2)" : "OpenGroup");
2147  }
2148  else if (!lmem[_mMIT] && mCR_MIT()) {
2149  INTERESTING(lDebug ? "MIT(7)" : "MIT");
2150  lmem[_mMIT] = 1;
2151  }
2152  else {
2153  INTERESTING(lDebug ? "MIT-style(5)" : "MIT-style");
2154  lmem[_mMIT] = 1;
2155  }
2156  }
2157  else if ((!lmem[_mMIT] || mCR_MIT()) && INFILE(_LT_MITref1)) {
2158  INTERESTING(lDebug ? "MIT(ref1)" : "MIT");
2159  lmem[_mMIT] = 1;
2160  }
2161  else if (!lmem[_mMIT] && INFILE(_LT_MITref2)) {
2162  INTERESTING(lDebug ? "MIT(ref2)" : "MIT");
2163  lmem[_mMIT] = 1;
2164  }
2165  else if (!lmem[_mMIT] && INFILE(_LT_MITref6)) {
2166  INTERESTING(lDebug ? "MIT(ref6)" : "MIT");
2167  lmem[_mMIT] = 1;
2168  }
2169  else if (!lmem[_mMIT] && INFILE(_LT_MITref3)) {
2170  INTERESTING(lDebug ? "MIT(ref3)" : "MIT-style");
2171  lmem[_mMIT] = 1;
2172  }
2173  else if (!lmem[_mMIT] && INFILE(_LT_MITref4)) {
2174  INTERESTING(lDebug ? "MIT(ref4)" : "MIT");
2175  lmem[_mMIT] = 1;
2176  }
2177  else if (!lmem[_mMIT] && (INFILE(_LT_MITref5) || INFILE(_LT_MITref9))) {
2178  INTERESTING(lDebug ? "MIT(ref5)" : "MIT");
2179  lmem[_mMIT] = 1;
2180  }
2181  else if (INFILE(_SPDX_MIT_CMU)) {
2182  INTERESTING("MIT-CMU");
2183  }
2184  else if (!lmem[_fREAL] && (INFILE(_SPDX_MIT))) {
2185  INTERESTING(lDebug ? "MIT(SPDX)" : "MIT");
2186  }
2187  else if (!lmem[_mMIT] && !lmem[_fREAL] && INFILE(_LT_MITref7)) {
2188  INTERESTING(lDebug ? "MIT(ref7)" : "MIT");
2189  lmem[_mMIT] = 1;
2190  }
2191  else if (!lmem[_mMIT] && INFILE(_LT_MITref8)) {
2192  INTERESTING(lDebug ? "MIT(ref8/9)" : "MIT");
2193  lmem[_mMIT] = 1;
2194  }
2195  else if (INFILE(_LT_OpenGroup_1)) {
2196  if (INFILE(_CR_OpenGroup)) {
2197  INTERESTING(lDebug ? "OpenGroup(3)" : "OpenGroup");
2198  }
2199  else {
2200  INTERESTING(lDebug ? "OG-style(3)" : "OpenGroup-style");
2201  }
2202  }
2203  else if (INFILE(_LT_OpenGroup_3)) {
2204  if (INFILE(_CR_OpenGroup)) {
2205  INTERESTING(lDebug ? "OpenGroup(5)" : "OpenGroup");
2206  }
2207  else {
2208  INTERESTING(lDebug ? "OG-style(5)" : "OpenGroup-style");
2209  }
2210  }
2211  else if (INFILE(_LT_OpenGroup_PROP)) {
2212  if (!lmem[_mXOPEN] && INFILE(_CR_XOPEN)) {
2213  INTERESTING("XOPEN-EULA");
2214  lmem[_mXOPEN] = 1;
2215  }
2216  else if (INFILE(_CR_OpenGroup)) {
2217  INTERESTING("OpenGroup-Proprietary");
2218  }
2219  else {
2220  INTERESTING("Proprietary");
2221  }
2222  }
2223  else if (INFILE(_LT_X11_1)) {
2224  if (mCR_X11()) {
2225  INTERESTING(lDebug ? "X11(4)" : "X11");
2226  }
2227  else {
2228  INTERESTING(lDebug ? "X11-style(2)" : "X11-style");
2229  }
2230  }
2231  else if (INFILE(_LT_X11_2)) {
2232  if (mCR_X11()) {
2233  INTERESTING(lDebug ? "X11(5)" : "X11");
2234  }
2235  else {
2236  INTERESTING(lDebug ? "X11-style(3)" : "X11-style");
2237  }
2238  }
2239  else if (INFILE(_LT_X11_3)) {
2240  if (mCR_X11()) {
2241  INTERESTING(lDebug ? "X11(6)" : "X11");
2242  }
2243  /*
2244  * Unix System Laboratories
2245  */
2246  else if (INFILE(_CR_USL_EUR)) {
2247  INTERESTING(lDebug ? "USLE(2)" : "USL-Europe");
2248  }
2249  else {
2250  INTERESTING(lDebug ? "X11-style(4)" : "X11-style");
2251  }
2252  }
2253  else if (INFILE(_LT_X11_4)) {
2254  if (mCR_X11()) {
2255  INTERESTING(lDebug ? "X11(7)" : "X11");
2256  }
2257  else {
2258  INTERESTING(lDebug ? "X11-style(5)" : "X11-style");
2259  }
2260  }
2261  else if (INFILE(_PHR_X11_1) || INFILE(_PHR_X11_2)) {
2262  INTERESTING(lDebug ? "PHR(X11)" : "X11");
2263  }
2264  else if (INFILE(_LT_X11_STYLE)) {
2265  INTERESTING(lDebug ? "X11-style(6)" : "X11-style");
2266  }
2267  /*
2268  * ISC License
2269  */
2270  if (INFILE(_PHR_ISC_1) || INFILE(_PHR_ISC_2) || HASTEXT(_URL_ISC, 0)) {
2271  INTERESTING(lDebug ? "PHR(ISC)" : "ISC");
2272  lmem[_mISC] = 1;
2273  }
2274  else if (INFILE(_LT_MIT_4) && INFILE(_PHR_NO_WARRANTY_12)) {
2275  INTERESTING(lDebug ? "ISC(MIT-style(4))" : "ISC");
2276  lmem[_mISC] = 1;
2277  }
2278  else if (INFILE(_LT_MIT_8) && INFILE(_CR_ISC)) {
2279  INTERESTING(lDebug ? "ISC(MIT-style(8))" : "ISC");
2280  lmem[_mISC] = 1;
2281  }
2283  /*
2284  * NTP License, note that NTP license text is detected with _LT_BSD_2
2285  */
2286  if (INFILE(_TITLE_NTP)) {
2287  INTERESTING("NTP");
2288  lmem[_mNTP] = 1;
2289  }
2291  /* MirOS License (MirOS) */
2292  if (INFILE(_TITLE_MIROS)) {
2293  INTERESTING("MirOS");
2294  lmem[_mMIT] = 1;
2295  }
2297  /* Libpng license */
2298  if (INFILE(_TITLE_LIBPNG)) {
2299  INTERESTING("Libpng");
2300  }
2301  else if (INFILE(_LT_W3C_1)) {
2302  if (INFILE(_CR_W3C)) {
2303  INTERESTING(lDebug ? "W3C(1)" : "W3C");
2304  }
2305  else {
2306  INTERESTING(lDebug ? "W3C-style(1)" : "W3C-style");
2307  }
2308  lmem[_fW3C] = 1;
2309  }
2310  else if (!lmem[_mNTP] && !lmem[_mPYTHON] && !lmem[_fBSD] && INFILE(_LT_W3C_2)) {
2311  if (INFILE(_CR_W3C)) {
2312  INTERESTING(lDebug ? "W3C(2)" : "W3C");
2313  }
2314  else {
2315  INTERESTING(lDebug ? "W3C-style(2)" : "W3C-style");
2316  }
2317  lmem[_fW3C] = 1;
2318  }
2319  else if (INFILE(_LT_W3C_3)) {
2320  if (INFILE(_CR_W3C)) {
2321  INTERESTING(lDebug ? "W3C(3)" : "W3C");
2322  }
2323  if (INFILE(_LT_W3Cref4)) {
2324  INTERESTING(lDebug ? "W3C(ref4)" : "W3C");
2325  }
2326  else {
2327  INTERESTING(lDebug ? "W3C-style(3)" : "W3C-style");
2328  }
2329  lmem[_fW3C] = 1;
2330  }
2331  else if (INFILE(_LT_W3C_4) && NOT_INFILE(_LT_PNG_ZLIB_2)) {
2332  if (INFILE(_CR_W3C)) {
2333  INTERESTING(lDebug ? "W3C(4)" : "W3C");
2334  }
2335  else {
2336  INTERESTING(lDebug ? "W3C-style(4)" : "W3C-style");
2337  }
2338  lmem[_fW3C] = 1;
2339  }
2340  else if (INFILE(_LT_W3C_5)) {
2341  if (INFILE(_CR_W3C)) {
2342  INTERESTING(lDebug ? "W3C(5)" : "W3C");
2343  }
2344  else {
2345  INTERESTING(lDebug ? "W3C-style(5)" : "W3C-style");
2346  }
2347  lmem[_fW3C] = 1;
2348  }
2349  else if (INFILE(_LT_W3C_6)) {
2350  if (INFILE(_CR_W3C)) {
2351  INTERESTING(lDebug ? "W3C(6)" : "W3C");
2352  }
2353  else {
2354  INTERESTING(lDebug ? "W3C-style(6)" : "W3C-style");
2355  }
2356  lmem[_fW3C] = 1;
2357  }
2358  else if (INFILE(_LT_W3C_7)) {
2359  if (INFILE(_CR_W3C)) {
2360  INTERESTING(lDebug ? "W3C(7)" : "W3C");
2361  }
2362  else {
2363  INTERESTING(lDebug ? "W3C-style(7)" : "W3C-style");
2364  }
2365  lmem[_fW3C] = 1;
2366  }
2367  else if (INFILE(_LT_W3Cref1)) {
2368  INTERESTING(lDebug ? "W3C(ref1)" : "W3C");
2369  lmem[_fW3C] = 1;
2370  }
2371  else if (INFILE(_LT_W3Cref2)) {
2372  INTERESTING(lDebug ? "W3C(ref2)" : "W3C");
2373  lmem[_fW3C] = 1;
2374  }
2375  else if (INFILE(_LT_W3Cref3)) {
2376  INTERESTING(lDebug ? "W3C(ref3)" : "W3C");
2377  lmem[_fW3C] = 1;
2378  }
2379  else if (INFILE(_LT_W3Cref4)) {
2380  INTERESTING(lDebug ? "W3C(ref4)" : "W3C");
2381  lmem[_fW3C] = 1;
2382  }
2383  else if (URL_INFILE(_URL_W3C_20021231)) {
2384  INTERESTING(lDebug ? "W3C-20021231(url)" : "W3C");
2385  lmem[_fW3C] = 1;
2386  }
2387  else if (URL_INFILE(_URL_W3C_IP)) {
2388  INTERESTING(lDebug ? "W3C-IP(url)" : "W3C-IP");
2389  lmem[_fW3C] = 1;
2390  }
2391  else if (URL_INFILE(_URL_W3C)) {
2392  INTERESTING(lDebug ? "W3C(url)" : "W3C");
2393  lmem[_fW3C] = 1;
2394  }
2395  else if (!lmem[_mMIT] && INFILE(_LT_MIT_3)) {
2396  if (mCR_MIT()) {
2397  INTERESTING(lDebug ? "MIT(8)" : "MIT");
2398  }
2399  else {
2400  INTERESTING(lDebug ? "MIT-style(6)" : "MIT-style");
2401  }
2402  lmem[_mMIT] = 1;
2403  }
2404  else if (!lmem[_mMIT] && INFILE(_LT_MIT_4)) {
2405  if (mCR_MIT()) {
2406  INTERESTING(lDebug ? "MIT(9)" : "MIT");
2407  }
2408  else if (!lmem[_mISC] && mCR_FSF()) {
2409  INTERESTING(lDebug ? "FSF(7)" : "FSF");
2410  }
2411  else if (!lmem[_mISC]) {
2412  INTERESTING(lDebug ? "MIT-style(13)" : "MIT-style");
2413  }
2414  lmem[_mMIT] = 1;
2415  }
2416  else if (!lmem[_mMIT] && INFILE(_LT_MIT_8)) {
2417  if (INFILE(_CR_VIXIE)) {
2418  INTERESTING("Vixie");
2419  }
2420  else if (INFILE(_LT_0BSD)) {
2421  INTERESTING("0BSD");
2422  }
2423  else if (mCR_MIT()) {
2424  INTERESTING(lDebug ? "MIT(10)" : "MIT");
2425  }
2426  else if (HASTEXT(_TEXT_TU_BERLIN, 0) && HASTEXT(_LT_FREE_87,0)) {
2427  INTERESTING("TU-Berlin-2.0");
2428  }
2429  else {
2430  INTERESTING(lDebug ? "MIT-style(8)" : "MIT-style");
2431  }
2432  lmem[_mMIT] = 1;
2433  }
2434  else if (INFILE(_LT_MIT_9)) {
2435  if (INFILE(_CR_SLEEPYCAT)) {
2436  MEDINTEREST(lDebug ? "Sleepycat(2)" : "Sleepycat");
2437  }
2438  else if (INFILE(_CR_BSDCAL)) {
2439  INTERESTING(lDebug ? "BSD(mit)" : "BSD");
2440  lmem[_fBSD] = 1;
2441  }
2442  else if (INFILE(_CR_SUN)) {
2443  INTERESTING(lDebug ? "SUN(mit)" : "SUN");
2444  lmem[_fBSD] = 1;
2445  }
2446  else if (!lmem[_mMIT] && mCR_MIT()) {
2447  INTERESTING(lDebug ? "MIT(11)" : "MIT");
2448  lmem[_mMIT] = 1;
2449  }
2450  else if (!lmem[_mMIT]) {
2451  /*
2452  * Tcl/Tk license has MIT phrase
2453  */
2454  if (INFILE(_LT_TCL)) {
2455  INTERESTING("TCL");
2456  lmem[_fTCL] = 1;
2457  }
2458  else {
2459  INTERESTING(lDebug ? "MIT-style(9)" : "MIT-style");
2460  lmem[_mMIT] = 1;
2461  }
2462  }
2463  }
2464  else if (INFILE(_LT_MIT_10)) {
2465  if (!lmem[_mMIT] && mCR_MIT()) {
2466  INTERESTING(lDebug ? "MIT(12)" : "MIT");
2467  lmem[_mMIT] = 1;
2468  }
2469  else {
2470  INTERESTING(lDebug ? "MIT-style(10)" : "MIT-style");
2471  lmem[_mMIT] = 1;
2472  }
2473  }
2474  else if ((INFILE(_LT_MIROS_PREAMBLE) || INFILE(_TITLE_MIROS)) && INFILE(_LT_MIT_11)) {
2475  INTERESTING(lDebug ? "MIT-style(MirOS)" : "MirOS");
2476  lmem[_mMIT] = 1;
2477  }
2478  else if (INFILE(_LT_MIT_11)) {
2479  INTERESTING(lDebug ? "MIT-style(11)" : "MIT-style");
2480  lmem[_mMIT] = 1;
2481  }
2482  else if (!lmem[_mMIT] && INFILE(_LT_MITDOC)) {
2483  if (mCR_MIT()) {
2484  INTERESTING(lDebug ? "MIT(13)" : "MIT");
2485  }
2486  else {
2487  INTERESTING(lDebug ? "MIT-style(12)" : "MIT-style");
2488  }
2489  lmem[_mMIT] = 1;
2490  }
2491  else if (!lmem[_mMIT] && INFILE(_LT_MIT_0) && NOT_INFILE(_LT_ECL)) {
2492  INTERESTING(lDebug ? "MIT(0)" : "MIT-style");
2493  lmem[_mMIT] = 1;
2494  }
2495  else if (INFILE(_LT_MIT_14)) {
2496  INTERESTING(lDebug ? "MIT-style(14)" : "MIT-style");
2497  lmem[_mMIT] = 1;
2498  }
2499  else if (INFILE(_LT_MIT_15)) {
2500  INTERESTING(lDebug ? "MIT-style(15)" : "ISC-style");
2501  lmem[_mMIT] = 1;
2502  }
2503  else if (INFILE(_LT_MPL_OR_MITX)) {
2504  if (!lmem[_mMPL]) {
2505  cp = MPLVERS();
2506  INTERESTING(lDebug ? "MPL(with-MIT)" : cp);
2507  lmem[_mMPL] = 1;
2508  }
2509  if (!lmem[_mMIT]) {
2510  INTERESTING(lDebug ? "MIT(with-MPL)" : "MIT");
2511  lmem[_mMIT] = 1;
2512  }
2513  }
2514  else if (!lmem[_mMIT] && (URL_INFILE(_URL_MIT) || URL_INFILE(_URL_MIT_ROCK))) {
2515  INTERESTING(lDebug ? "MIT(url)" : "MIT");
2516  lmem[_mMIT] = 1;
2517  }
2518  else if (HASTEXT(_TEXT_TU_BERLIN, 0) && HASTEXT(_LT_FREE_87,0)) {
2519  INTERESTING("TU-Berlin-1.0");
2520  }
2522  /*
2523  * Generic CopyLeft licenses
2524  */
2525  if (INFILE(_LT_COPYLEFT_1)) {
2526  INTERESTING("CopyLeft[1]");
2527  }
2528  else if (INFILE(_LT_COPYLEFT_2)) {
2529  INTERESTING("CopyLeft[2]");
2530  }
2532  /*
2533  * OpenContent license
2534  */
2535  if (INFILE(_LT_OPENCONTENT)) {
2536  if (INFILE(_TITLE_OPENCL10)) {
2537  INTERESTING("OCL-1.0");
2538  }
2539  else if (INFILE(_TITLE_OPENCL)) {
2540  INTERESTING("OCL");
2541  }
2542  else {
2543  INTERESTING("OCL-style");
2544  }
2545  }
2547  /*
2548  * jpeg/netpbm and png/zlib and others...
2549  */
2550  if (INFILE(_TITLE_ZLIB)) {
2551  INTERESTING("Zlib");
2552  }
2553  else if (INFILE (_LT_TRUECRYPT_30)) {
2554  INTERESTING("TrueCrypt-3.0");
2555  }
2556  else if (INFILE(_TITLE_LIBPNG)) {
2557  INTERESTING("Libpng");
2558  }
2559  /* IJG */
2560  else if (INFILE(_LT_JPEG_1)) {
2561  INTERESTING(lDebug ? "JPEG(1)" : "IJG");
2562  lmem[_fIJG] = 1;
2563  }
2564  else if (INFILE(_LT_JPEG_2) && HASTEXT(_TITLE_IJG_2, 0)) {
2565  INTERESTING(lDebug ? "JPEG(2)" : "IJG");
2566  lmem[_fIJG] = 1;
2567  }
2568  /* Zlib */
2569  else if (INFILE(_SPDX_zlib_acknowledgement)) {
2570  INTERESTING("zlib-acknowledgement");
2571  }
2572  else if (!lmem[_fREAL] && (INFILE(_SPDX_Zlib))) {
2573  INTERESTING("Zlib");
2574  }
2575  else if (INFILE(_LT_PNG_ZLIB_1) && HASTEXT(_LT_PNG_ZLIB_CLAUSE_1, 0) && HASTEXT(_LT_PNG_ZLIB_CLAUSE_2, REG_EXTENDED) && HASTEXT(_LT_PNG_ZLIB_CLAUSE_3, 0)) {
2576  INTERESTING(lDebug ? "ZLIB(1)" : "Zlib");
2577  }
2578  else if (INFILE(_LT_PNG_ZLIBref4) && NOT_INFILE(_LT_PNG_ZLIBref4_EXHIBIT)) {
2579  INTERESTING(lDebug ? "ZLIB(6)" : "Zlib");
2580  }
2581  else if (!lmem[_fW3C] && INFILE(_LT_PNG_ZLIB_2)) {
2582  if (INFILE(_LT_libmng_2007_Clause_1)) {
2583  INTERESTING("libmng-2007");
2584  }
2585  else {
2586  INTERESTING(lDebug ? "PNG/ZLIB(2)" : "Libpng");
2587  }
2588  }
2589  else if (INFILE(_LT_PNG_ZLIBref1)) {
2590  INTERESTING(lDebug ? "ZLIB(3)" : "Zlib");
2591  }
2592  else if (INFILE(_LT_PNG_ZLIBref2)) {
2593  INTERESTING(lDebug ? "ZLIB(4)" : "Zlib");
2594  }
2595  else if (INFILE(_LT_PNG_ZLIBref3)) { /* might be zlib/libpng license, not sure */
2596  INTERESTING(lDebug ? "ZLIB(5)" : "Zlib-possibility");
2597  }
2598  else if (!LVAL(_TEXT_GNU_LIC_INFO) && (URL_INFILE(_URL_ZLIB_1) || URL_INFILE(_URL_ZLIB_2))) {
2599  INTERESTING(lDebug ? "ZLIB(url)" : "Zlib");
2600  }
2601 
2602  if (INFILE(_LT_INFO_ZIP) || URL_INFILE(_URL_INFO_ZIP)) {
2603  INTERESTING("Info-ZIP");
2604  }
2606  /*
2607  * IETF (primarily docs, RFCs, and protocol/standard proposals) . This
2608  * one is a little strange as text-formatters that print this license
2609  * will occasionally split the text across a page boundary. Here we
2610  * look for 2 separate footprints.
2611  */
2612  if (INFILE(_LT_IETF_1) || INFILE(_LT_IETF_2) || INFILE(_LT_IETF_3) ||
2613  INFILE(_LT_IETF_4)) {
2614  if (mCR_IETF()) {
2615  INTERESTING("IETF");
2616  }
2617  else if (INFILE(_LT_IETF_5)) {
2618  INTERESTING("IETF");
2619  }
2620  else if (HASTEXT(_LT_IETF_7, 0)) {
2621  INTERESTING("IETF");
2622  }
2623  else if (INFILE(_CR_OASIS)) {
2624  INTERESTING("OASIS");
2625  }
2626  else {
2627  INTERESTING("IETF-style");
2628  }
2629  }
2630  /*
2631  * IETF Trust's Legal Provisions
2632  */
2633  else if (INFILE(_LT_IETF_6)) {
2634  INTERESTING("IETF");
2635  }
2636  /*
2637  * Contributions to IETF Standard Process
2638  */
2639  else if (INFILE(_LT_IETF_7)) {
2640  INTERESTING("IETF-contribution");
2641  }
2643  /*
2644  * CDDL
2645  */
2646  if (INFILE(_PHR_CDDL_1) || HASTEXT(_PHR_CDDL_2, REG_EXTENDED)) {
2647  cp = CDDLVERS();
2648  INTERESTING(cp);
2649  lmem[_mCDDL] = 1;
2650  }
2652  /*
2653  * MPL (Mozilla)
2654  * ... Sun SISSL and one Mozilla licensing derivative share wording
2655  */
2656  if (!lmem[_fREAL] && NOT_INFILE(_LT_CPALref) && NOT_INFILE(_TITLE_GSOAP) &&
2657  (INFILE(_LT_MPL_OR) || INFILE(_TITLE_MPL_ref))) {
2658  cp = MPLVERS(); /* NPL, too */
2659  INTERESTING(lDebug ? "MPL/NPL#2" : cp);
2660  lmem[_mMPL] = 1;
2661  }
2662  if (INFILE(_LT_CPALref)) {
2663  if (INFILE(_TITLE_CPAL10)) {
2664  INTERESTING(lDebug ? "CPAL_v1.0(#2)" : "CPAL-1.0");
2665  lmem[_mMPL] = 1;
2666  lmem[_fATTRIB] = 1;
2667  }
2668  else if (INFILE(_TITLE_CPAL)) {
2669  INTERESTING(lDebug ? "CPAL(#2)" : "CPAL");
2670  lmem[_mMPL] = 1;
2671  lmem[_fATTRIB] = 1;
2672  }
2673  }
2674  else if (INFILE(_LT_CPAL_V1_ref)) {
2675  INTERESTING(lDebug ? "CPAL_v1.0(#3)" : "CPAL-1.0");
2676  lmem[_mMPL] = 1;
2677  lmem[_fATTRIB] = 1;
2678  }
2679  if (!lmem[_mMPL] && INFILE(_LT_MPL_2)) {
2680  if (INFILE(_TITLE_SISSL)) {
2681  cp = SISSLVERS();
2682  INTERESTING(lDebug ? "SISSL(MPL)" : cp);
2683  lmem[_mSUN] = 1;
2684  }
2685  else if (INFILE(_TITLE_SUN_PL10)) {
2686  INTERESTING("SPL-1.0");
2687  lmem[_mSUN] = 1;
2688  }
2689  else if (INFILE(_TITLE_SUN_PL)) {
2690  INTERESTING("SPL");
2691  lmem[_mSUN] = 1;
2692  }
2693  else if (INFILE(_TITLE_IDPL_V10)) {
2694  INTERESTING("IDPL-1.0");
2695  lmem[_mMPL] = 1;
2696  }
2697  else if (INFILE(_TITLE_IDPL)) {
2698  INTERESTING("IDPL");
2699  lmem[_mMPL] = 1;
2700  }
2701  else if (INFILE(_TITLE_INTERBASE)) {
2702  INTERESTING("Interbase-1.0");
2703  lmem[_mMPL] = 1;
2704  }
2705  else if (INFILE(_TITLE_NETIZEN_V10)) {
2706  INTERESTING("NOSL-1.0");
2707  lmem[_mMPL] = 1;
2708  }
2709  else if (INFILE(_TITLE_NETIZEN)) {
2710  INTERESTING(lDebug ? "NOSL(#1)" : "NOSL");
2711  lmem[_mMPL] = 1;
2712  }
2713  else if (INFILE(_TITLE_TPL10)) {
2714  INTERESTING(lDebug ? "TPL(v1.0#1)" : "MPL.TPL-1.0");
2715  lmem[_mMPL] = 1;
2716  }
2717  else if (INFILE(_TITLE_TPL)) {
2718  INTERESTING(lDebug ? "TPL(#1)" : "MPL.TPL");
2719  lmem[_mMPL] = 1;
2720  }
2721  else if (INFILE(_TITLE_GSOAP_V13)) {
2722  INTERESTING("gSOAP-1.3b");
2723  lmem[_mGSOAP] = 1;
2724  }
2725  else if (INFILE(_TITLE_GSOAP)) {
2726  INTERESTING("gSOAP");
2727  lmem[_mGSOAP] = 1;
2728  }
2729  else if (INFILE(_TITLE_FLASH2XML10)) {
2730  INTERESTING("Flash2xml-1.0");
2731  }
2732  else if (INFILE(_TITLE_NOKIA10A)) {
2733  INTERESTING("Nokia");
2734  lmem[_mMPL] = 1;
2735  }
2736  else if (INFILE(_LT_NOKIA)) {
2737  INTERESTING("Nokia");
2738  lmem[_mMPL] = 1;
2739  }
2740  else if (INFILE(_TITLE_OPENPL10)) {
2741  INTERESTING("OPL-1.0");
2742  }
2743  else if (INFILE(_TITLE_SNIA_V11)) {
2744  INTERESTING("SNIA-1.1");
2745  }
2746  else if (INFILE(_TITLE_SNIA_V10)) {
2747  INTERESTING("SNIA-1.0");
2748  }
2749  else if (INFILE(_TITLE_CPAL10)) {
2750  INTERESTING(lDebug ? "CPAL_v1.0(#1)" : "CPAL-1.0");
2751  lmem[_mMPL] = 1;
2752  lmem[_fATTRIB] = 1;
2753  }
2754  else if (INFILE(_TITLE_CPAL)) {
2755  INTERESTING(lDebug ? "CPAL(#1)" : "CPAL");
2756  lmem[_mMPL] = 1;
2757  lmem[_fATTRIB] = 1;
2758  }
2759  else if (HASTEXT(_TEXT_MOZNET, REG_EXTENDED)) {
2760  if (INFILE(_TITLE_SUGARCRM_PL)) {
2761  INTERESTING("SugarCRM-1.1.3");
2762  lmem[_mMPL] = 1;
2763  lmem[_fATTRIB] = 1;
2764  }
2765  else if (!lmem[_mMPL] && !lmem[_fREAL] && INFILE(_TITLE_MOZNET_PL)) {
2766  cp = MPLVERS(); /* NPL, too */
2767  INTERESTING(lDebug ? "MPL/NPL#1" : cp);
2768  lmem[_mMPL] = 1;
2769  }
2770  }
2771  else if (INFILE(_TITLE_RHeCos_V11)) {
2772  INTERESTING("RHeCos-1.1");
2773  }
2774  else if (INFILE(_TITLE_CYGNUS_ECOS_V10)) {
2775  INTERESTING("Cygnus-eCos-1.0");
2776  }
2777  else if (INFILE(_TITLE_H2_V10)) {
2778  INTERESTING("H2-1.0");
2779  }
2780  else {
2781  if (!lmem[_mCDDL]) {
2782  INTERESTING("MPL-style");
2783  lmem[_mMPL] = 1;
2784  }
2785  }
2786  }
2787  else if (!lmem[_mMPL] && (INFILE(_LT_NPLref) || INFILE(_LT_NPL_1))) {
2788  cp = MPLVERS(); /* NPL, too */
2789  INTERESTING(lDebug ? "MPL/NPL#3" : cp);
2790  lmem[_mMPL] = 1;
2791  }
2792  else if (!lmem[_mMPL] && INFILE(_LT_MPLref1)) {
2793  cp = MPLVERS(); /* NPL, too */
2794  INTERESTING(lDebug ? "MPL/NPL-ref#1" : cp);
2795  lmem[_mMPL] = 1;
2796  }
2797  else if (!lmem[_mMPL] && INFILE(_LT_IDPLref)) {
2798  if (INFILE(_TITLE_IDPL_V10)) {
2799  INTERESTING(lDebug ? "IDPL-v1(ref)" : "IDPL-1.0");
2800  }
2801  else {
2802  INTERESTING(lDebug ? "IDPL(ref)" : "IDPL");
2803  }
2804  lmem[_mMPL] = 1;
2805  }
2806  else if (!lmem[_mMPL] && !lmem[_mLIBRE] && !lmem[_fREAL] &&
2807  !LVAL(_TEXT_GNU_LIC_INFO) && INFILE(_LT_MPLref2)) {
2808  cp = MPLVERS(); /* NPL, too */
2809  INTERESTING(lDebug ? "MPL/NPL-ref#2" : cp);
2810  lmem[_mMPL] = 1;
2811  }
2812  else if (!lmem[_mMPL] && !lmem[_mLIBRE] && !lmem[_fREAL] &&
2813  !LVAL(_TEXT_GNU_LIC_INFO) && INFILE(_TITLE_MOZNET_PL)) {
2814  cp = MPLVERS(); /* NPL, too */
2815  INTERESTING(lDebug ? "MPL/NPL#4" : cp);
2816  lmem[_mMPL] = 1;
2817  }
2818  else if (!lmem[_mMPL] && INFILE(_TITLE_NETSCAPE_EULA)) {
2819  INTERESTING("NPL-EULA");
2820  lmem[_mMPL] = 0;
2821  }
2822  else if (INFILE(_LT_NPL_2)) {
2823  INTERESTING(lDebug ? "NPL(#1)" : "NPL");
2824  lmem[_mMPL] = 0;
2825  }
2826  else if (INFILE(_TITLE_OPENPL)) {
2827  INTERESTING(lDebug ? "OPL(title)" : "OPL-style");
2828  }
2830  /*
2831  * Microsoft licenses: open and proprietary/EULA
2832  */
2833  if (INFILE(_LT_MSCORP_SSLref)) {
2834  INTERESTING(lDebug ? "MS-SSL(ref)" : "MS-SSL");
2835  lmem[_fMSCORP] = 1;
2836  }
2837  if (INFILE(_LT_MSCORP_PL)) {
2838  int ms_l = INFILE(_LT_MSCORP_LIMITED);
2839  int ms_r = INFILE(_LT_MSCORP_RL);
2840  if (ms_r && ms_l) {
2841  INTERESTING("MS-LRL");
2842  }
2843  else if (ms_r) {
2844  INTERESTING(lDebug ? "MS-RL(#1)" : "MS-RL");
2845  }
2846  else if (ms_l) {
2847  INTERESTING("MS-LPL");
2848  }
2849  else {
2850  INTERESTING(lDebug ? "MS-PL(#1)" : "MS-PL");
2851  }
2852  }
2853  else if (INFILE(_LT_MSCORP_LIMITEDref1)) {
2854  INTERESTING("MS-LPL");
2855  lmem[_fMSCORP] = 1;
2856  }
2857 
2858  if (INFILE(_TEXT_MICROSOFT)) {
2859  if (INFILE(_LT_MSCORP_INDEMNIFY)) {
2860  INTERESTING("MS-indemnity");
2861  lmem[_fMSCORP] = 1;
2862  }
2863  else if (INFILE(_LT_MSCORP_IP_1)) {
2864  INTERESTING(lDebug ? "MS-IP(1)" : "MS-IP");
2865  lmem[_fMSCORP] = 1;
2866  }
2867  else if (INFILE(_LT_MSCORP_IP_2)) {
2868  INTERESTING(lDebug ? "MS-IP(2)" : "MS-IP");
2869  lmem[_fMSCORP] = 1;
2870  }
2871  else if (INFILE(_LT_MSCORP_PLref1)) {
2872  INTERESTING(lDebug ? "MS-PL(ref1)" : "MS-PL");
2873  lmem[_fMSCORP] = 1;
2874  }
2875  else if (INFILE(_LT_MSCORP_PLref2)) {
2876  INTERESTING(lDebug ? "MS-PL(ref2)" : "MS-PL");
2877  lmem[_fMSCORP] = 1;
2878  }
2879  else if (INFILE(_LT_MSCORP_PLref3)) {
2880  INTERESTING(lDebug ? "MS-PL(ref3)" : "MS-PL");
2881  lmem[_fMSCORP] = 1;
2882  }
2883  else if (INFILE(_LT_MSCORP_RLref)) {
2884  INTERESTING(lDebug ? "MS-RL(ref)" : "MS-RL");
2885  lmem[_fMSCORP] = 1;
2886  }
2887  else if (INFILE(_LT_MSCORP_REFLIC)) {
2888  INTERESTING("MRL");
2889  lmem[_fMSCORP] = 1;
2890  }
2891  else if (INFILE(_LT_MSCORP_EULA_1) ||
2892  INFILE(_TITLE_MSCORP_EULA)) {
2893  INTERESTING(lDebug ? "MS-EULA(1)" : "MS-EULA");
2894  lmem[_fMSCORP] = 1;
2895  }
2896  else if (INFILE(_LT_MSCORP_EULA_2)) {
2897  INTERESTING(lDebug ? "MS-EULA(2)" : "MS-EULA");
2898  lmem[_fMSCORP] = 1;
2899  }
2900  else if (INFILE(_LT_MSCORP_EULA_3)) {
2901  INTERESTING(lDebug ? "MS-EULA(3)" : "MS-EULA");
2902  lmem[_fMSCORP] = 1;
2903  }
2904  else if (INFILE(_LT_MSCORP_EULA_4)) {
2905  INTERESTING(lDebug ? "MS-EULA(4)" : "MS-EULA");
2906  lmem[_fMSCORP] = 1;
2907  }
2908  else if (INFILE(_LT_MSCORP_EULA_5)) {
2909  INTERESTING(lDebug ? "MS-EULA(5)" : "MS-EULA");
2910  lmem[_fMSCORP] = 1;
2911  }
2912  else if (INFILE(_LT_MSCORP_EULA_6)) {
2913  INTERESTING(lDebug ? "MS-EULA(6)" : "MS-EULA");
2914  lmem[_fMSCORP] = 1;
2915  }
2916  else if (INFILE(_LT_MSCORP_1)) {
2917  INTERESTING(lDebug ? "MS(1)" : "Microsoft");
2918  lmem[_fMSCORP] = 1;
2919  }
2920  else if (INFILE(_LT_MSCORP_2)) {
2921  INTERESTING(lDebug ? "MS(2)" : "Microsoft");
2922  lmem[_fMSCORP] = 1;
2923  }
2924  else if (INFILE(_LT_MSCORP_3)) {
2925  INTERESTING(lDebug ? "MS(3)" : "Microsoft");
2926  lmem[_fMSCORP] = 1;
2927  }
2928  else if (INFILE(_LT_MSCORP_4)) {
2929  INTERESTING(lDebug ? "MS(4)" : "Microsoft");
2930  lmem[_fMSCORP] = 1;
2931  }
2932  else if (INFILE(_LT_MSCORP_5)) {
2933  INTERESTING(lDebug ? "MS(5)" : "Microsoft");
2934  lmem[_fMSCORP] = 1;
2935  }
2936  else if (INFILE(_LT_MSCORPref1)) {
2937  INTERESTING("Microsoft");
2938  lmem[_fMSCORP] = 1;
2939  }
2940  }
2942  /*
2943  * Santa Cruz Operation (SCO)
2944  */
2945  if (INFILE(_LT_SCO_COMM) && INFILE(_CR_SCO)) {
2946  INTERESTING("SCO.commercial");
2947  }
2949  /*
2950  * Zonealarm
2951  */
2952  if (INFILE(_LT_ZONEALARM) && INFILE(_TITLE_ZONEALARM_EULA)) {
2953  INTERESTING("ZoneAlarm-EULA");
2954  }
2956  /*
2957  * Ximian
2958  */
2959  if (HASTEXT(_TEXT_XIMIAN, 0)) {
2960  if (INFILE(_CR_XIMIAN)) {
2961  if (INFILE(_LT_XIMIAN)) {
2962  if (INFILE(_TITLE_XIMIANLOGO10)) {
2963  INTERESTING("Ximian-1.0");
2964  }
2965  else if (INFILE(_TITLE_XIMIANLOGO)) {
2966  INTERESTING("Ximian");
2967  }
2968  }
2969  }
2970  }
2972  /*
2973  * Xerox
2974  */
2975  if (HASTEXT(_TEXT_XEROX, 0)) {
2976  if (INFILE(_LT_XEROX_1) || INFILE(_LT_XEROX_2)) {
2977  if (INFILE(_CR_XEROX_1) || INFILE(_CR_XEROX_2)) {
2978  INTERESTING("Xerox");
2979  }
2980  else {
2981  INTERESTING("Xerox-style");
2982  }
2983  }
2984  }
2986  /*
2987  * Artifex Software
2988  */
2989  if (INFILE(_LT_ARTIFEX) && INFILE(_CR_ARTIFEX)) {
2990  INTERESTING("Artifex");
2991  }
2993  /*
2994  * AGE logic
2995  */
2996  if (INFILE(_LT_AGE) && INFILE(_CR_AGE)) {
2997  INTERESTING("AGE-Logic");
2998  }
3000  /*
3001  * OpenSSL
3002  */
3003  if (INFILE(_LT_OPENSSLref1) || INFILE(_LT_OPENSSLref2) ||
3004  INFILE(_LT_OPENSSLref3) || INFILE(_LT_OPENSSLref4) ||
3005  INFILE(_LT_OPENSSLref6) || INFILE(_LT_OPENSSLref7) ||
3006  INFILE(_LT_OPENSSLref8) ) {
3007  INTERESTING(lDebug ? "OpenSSL(ref)" : "OpenSSL");
3008  }
3009  else if (INFILE(_SPDX_OpenSSL) || INFILE(_URL_OPENSSL)) {
3010  INTERESTING(lDebug ? "OpenSSL(phr)" : "OpenSSL");
3011  }
3013  /*
3014  * Dual OpenSSL SSLeay
3015  */
3016  if (INFILE(_LT_COMBINED_OPENSSL_SSLEAY)) {
3017  INTERESTING("OpenSSL");
3018  INTERESTING("SSLeay");
3019  }
3021  /*
3022  * Ruby. Ruby is a dual license which allows distribution also under GPL.
3023  * GPL was earlier recognized beside Ruby here but GPL was not identified
3024  * in all Ruby cases. Therefore GPL statements have bee removed.
3025  */
3026  if (INFILE(_LT_RUBY)) {
3027  INTERESTING("Ruby");
3028  lmem[_fRUBY] = 1;
3029  }
3030  else if (INFILE(_LT_RUBYref1)) {
3031  INTERESTING(lDebug ? "Ruby(ref1)" : "Ruby");
3032  }
3033  else if (INFILE(_LT_RUBYref2)) {
3034  INTERESTING(lDebug ? "Ruby(ref2)" : "Ruby");
3035  }
3036  else if (INFILE(_LT_RUBYref3)) {
3037  INTERESTING(lDebug ? "Ruby(ref3)" : "Ruby");
3038  }
3039  else if (INFILE(_LT_RUBYref4)) {
3040  INTERESTING(lDebug ? "Ruby(ref4)" : "Ruby");
3041  }
3042  else if (INFILE(_LT_RUBYref5)) {
3043  INTERESTING(lDebug ? "Ruby(ref5)" : "Ruby");
3044  }
3045  else if (INFILE(_LT_RUBYref6)) {
3046  INTERESTING(lDebug ? "Ruby(ref6)" : "Ruby");
3047  }
3049  /*
3050  * Python and EGenix.com look a bit alike
3051  * Q: should all these Python rhecks be a family-check like OpenLDAP?
3052  */
3053  if (INFILE(_LT_EGENIX_COM)) {
3054  INTERESTING("eGenix");
3055  }
3056  else if (INFILE(_LT_PYTHON_4)) {
3057  INTERESTING("Python");
3058  lmem[_mPYTHON] = 1;
3059  }
3060  else if (!lmem[_mPYTHON] && lmem[_mPYTH_TEXT]) {
3061  if (INFILE(_LT_PYTHON_1) || INFILE(_LT_PYTHON_2)) {
3062  if (INFILE(_LT_CNRI_PYTHON_GPL)) {
3063  INTERESTING("CNRI-Python-GPL-Compatible");
3064  lmem[_mGPL] = 1;
3065  }
3066  else if (INFILE(_CR_PYTHON) || INFILE(_TITLE_PYTHON)) {
3067  cp = PYTHVERS();
3068  INTERESTING(lDebug ? "Python(1)" : cp);
3069  }
3070  else if (INFILE(_LT_CNRI_PYTHON_1)) {
3071  INTERESTING("CNRI-Python");
3072  }
3073  else if (INFILE(_LT_CNRI_JYTHON)) {
3074  INTERESTING("CNRI-Jython");
3075  }
3076  else {
3077  INTERESTING("Python-style");
3078  }
3079  lmem[_mPYTHON] = 1;
3080  }
3081  else if (INFILE(_SPDX_CNRI_Python_GPL_Compatible)) {
3082  INTERESTING("CNRI-Python-GPL-Compatible");
3083  }
3084  else if (INFILE(_SPDX_CNRI_Python)) {
3085  INTERESTING("CNRI-Python");
3086  }
3087  else if (INFILE(_LT_CNRI_PYTHON_2)) {
3088  INTERESTING("CNRI-Python");
3089  }
3090  else if (INFILE(_LT_PYTHON_3)) {
3091  cp = PYTHVERS();
3092  INTERESTING(lDebug ? "Python(4)" : cp);
3093  lmem[_mPYTHON] = 1;
3094  }
3095  else if (INFILE(_LT_PYTHONSTYLEref)) {
3096  cp = PYTHVERS();
3097  INTERESTING(lDebug ? "Python(ref1)" : "Python-style");
3098  lmem[_mPYTHON] = 1;
3099  }
3100  else if (!lmem[_mLIBRE] && (INFILE(_LT_PYTHONref1) ||
3101  INFILE(_LT_PYTHONref2))) {
3102  cp = PYTHVERS();
3103  INTERESTING(lDebug ? "Python(ref2)" : cp);
3104  lmem[_mPYTHON] = 1;
3105  }
3106  else if (!lmem[_mLIBRE] && !lmem[_fREAL] &&
3107  !LVAL(_TEXT_GNU_LIC_INFO) && INFILE(_LT_PYTHONref3)) {
3108  cp = PYTHVERS();
3109  INTERESTING(lDebug ? "Python(ref3)" : cp);
3110  lmem[_mPYTHON] = 1;
3111  }
3112  else if (!lmem[_mPYTHON] && URL_INFILE(_URL_PYTHON)) {
3113  cp = PYTHVERS();
3114  INTERESTING(lDebug ? "Python(url)" : cp);
3115  lmem[_mPYTHON] = 1;
3116  }
3117  else if (!lmem[_mPYTHON] && INFILE(_LT_PYTHON22ref)) {
3118  INTERESTING(lDebug ? "Python(22ref)" : "Python-2.2");
3119  lmem[_mPYTHON] = 1;
3120  }
3121  }
3123  /*
3124  * Intel
3125  */
3126  if (INFILE(_LT_INTEL) && NOT_INFILE(_LT_REAL_RPSL)) {
3127  INTERESTING(lDebug ? "Intel(8)" : "Intel");
3128  }
3129  else if (INFILE(_LT_INTEL_6)) {
3130  INTERESTING(lDebug ? "Intel(9)" : "Intel-other");
3131  }
3132  else if (INFILE(_LT_INTEL_7)) {
3133  INTERESTING(lDebug ? "Intel(10)" : "Intel-other");
3134  }
3135  else if (INFILE(_LT_INTEL_WLAN)) {
3136  INTERESTING("Intel-WLAN");
3137  }
3138  else if (INFILE(_LT_INTEL_ACPI)) {
3139  INTERESTING("Intel-ACPI");
3140  }
3141  else if (INFILE(_SPDX_Intel_ACPI)) {
3142  INTERESTING("Intel-ACPI");
3143  }
3144  else if (!lmem[_fREAL] && INFILE(_SPDX_Intel)) {
3145  INTERESTING("Intel");
3146  }
3147  else if (HASTEXT(_TEXT_INTELCORP, 0)) {
3148  if (INFILE(_LT_INTEL_1)) {
3149  if (INFILE(_LT_INTEL_FW)) {
3150  INTERESTING(lDebug ? "Intel(2)" : "Intel-only-FW");
3151  }
3152  else {
3153  INTERESTING(lDebug ? "Intel(3)" : "Intel");
3154  }
3155  }
3156  else if (INFILE(_LT_INTEL_2)) {
3157  INTERESTING(lDebug ? "Intel(4)" : "Intel");
3158  }
3159  else if (INFILE(_LT_INTEL_3)) {
3160  INTERESTING(lDebug ? "Intel(5)" : "Intel");
3161  }
3162  else if (INFILE(_LT_INTEL_4)) {
3163  INTERESTING(lDebug ? "Intel(6)" : "Intel");
3164  }
3165  else if (INFILE(_LT_INTEL_RESTRICT)) {
3166  INTERESTING("Intel.RESTRICTED");
3167  }
3168  }
3169  else if (INFILE(_LT_INTEL_5)) {
3170  INTERESTING(lDebug ? "CPL(Intel)" : "CPL");
3171  INTERESTING(lDebug ? "Intel(7)" : "Intel");
3172  }
3173  else if (INFILE(_LT_INTEL_EULA)) {
3174  INTERESTING("Intel-EULA");
3175  }
3177  /*
3178  * Bellcore
3179  */
3180  if (INFILE(_LT_BELLCORE)) {
3181  if (INFILE(_CR_BELLCORE)) {
3182  INTERESTING("Bellcore");
3183  }
3184  else {
3185  INTERESTING("Bellcore-style");
3186  }
3187  }
3189  /*
3190  * Purdue
3191  */
3192  if (INFILE(_LT_PURDUE) && INFILE(_CR_PURDUE) && HASTEXT(_TEXT_ALTERED_SOURCE, REG_EXTENDED) && HASTEXT(_TEXT_ORIGIN, 0)) {
3193  INTERESTING("Purdue");
3194  /* flag is set to avoid Cisco-style detection */
3195  lmem[_fPURDUE] = 1;
3196  }
3198  /*
3199  * Cisco systems
3200  */
3201  if (!lmem[_fPURDUE] && INFILE(_LT_CISCO)) {
3202  if (INFILE(_CR_CISCO)) {
3203  INTERESTING("Cisco");
3204  }
3205  else {
3206  if (HASTEXT(_LT_PNG_ZLIB_CLAUSE_1, 0) && HASTEXT(_LT_PNG_ZLIB_CLAUSE_2, REG_EXTENDED) && HASTEXT(_LT_PNG_ZLIB_CLAUSE_3, 0)) {
3207  INTERESTING("Zlib-style");
3208  }
3209  else {
3210  INTERESTING("Cisco-style");
3211  }
3212  }
3213  }
3215  /*
3216  * HP
3217  */
3218  if (INFILE(_LT_HP_DEC)) {
3219  if (mCR_HP()) {
3220  INTERESTING(lDebug ? "HP(8)" : "HP");
3221  }
3222  else if (INFILE(_CR_ADOBE)) {
3223  INTERESTING(lDebug ? "Adobe(8)" : "Adobe");
3224  }
3225  else if (INFILE(_LT_GNUPLOT_1) && INFILE(_LT_GNUPLOT_2)) {
3226  INTERESTING("gnuplot");
3227  }
3228  else {
3229  INTERESTING(lDebug ? "HP-DEC-style(1)" : "HP-DEC-style");
3230  }
3231  }
3232  else if (HASTEXT(_TEXT_HP, REG_EXTENDED)) {
3233  if (INFILE(_LT_HP_1)) {
3234  INTERESTING(lDebug ? "HP(2)" : "HP");
3235  }
3236  else if (INFILE(_LT_HP_3) && INFILE(_LT_HP_snmp_pp)) {
3237  INTERESTING(lDebug ? "HP(3)" : "hp-snmp-pp");
3238  }
3239  else if (INFILE(_LT_HP_4)) {
3240  INTERESTING(lDebug ? "HP(4)" : "HP");
3241  }
3242  else if (INFILE(_LT_HP_5)) {
3243  INTERESTING(lDebug ? "HP(5)" : "HP");
3244  }
3245  else if (INFILE(_LT_HP_6)) {
3246  INTERESTING(lDebug ? "HP(6)" : "HP");
3247  }
3248  else if (INFILE(_LT_HP_7)) {
3249  INTERESTING(lDebug ? "HP(7)" : "HP");
3250  }
3251  else if (INFILE(_LT_COMPAQ_1)) {
3252  INTERESTING(lDebug ? "Compaq(1)" : "HP-Compaq");
3253  }
3254  else if (INFILE(_LT_HP_EULA1)) {
3255  INTERESTING(lDebug ? "HP-EULA(1)" : "HP-EULA");
3256  }
3257  else if (INFILE(_LT_HP_EULA2)) {
3258  INTERESTING(lDebug ? "HP-EULA(2)" : "HP-EULA");
3259  }
3260  else if (INFILE(_LT_HP_EULA3)) {
3261  INTERESTING(lDebug ? "HP-EULA(3)" : "HP-EULA");
3262  }
3263  else if (INFILE(_LT_HP_EULA4)) {
3264  INTERESTING(lDebug ? "HP-EULA(4)" : "HP-EULA");
3265  }
3266  else if (INFILE(_LT_COMPAQ_EULA)) {
3267  INTERESTING(lDebug ? "Compaq(EULA)" : "HP-Compaq");
3268  }
3269  else if (INFILE(_LT_HP_PROPRIETARY_1)) {
3270  INTERESTING(lDebug ? "HP-prop(1)" : "HP-Proprietary");
3271  }
3272  else if (INFILE(_LT_HP_PROPRIETARY_2)) {
3273  INTERESTING(lDebug ? "HP-prop(2)" : "HP-Proprietary");
3274  }
3275  else if (INFILE(_LT_HP_PROPRIETARY_3)) {
3276  INTERESTING(lDebug ? "HP-prop(3)" : "HP-Proprietary");
3277  }
3278  else if (INFILE(_LT_HP_IBM_1)) {
3279  INTERESTING(lDebug ? "HP+IBM(1)" : "HP+IBM");
3280  }
3281  else if (INFILE(_LT_HP_IBM_2)) {
3282  INTERESTING(lDebug ? "HP+IBM(2)" : "HP+IBM");
3283  }
3284  else if (!lmem[_mHP] && INFILE(_CR_DEC) && INFILE(_LT_DEC_1)) {
3285  INTERESTING(lDebug ? "HP-DEC(3)" : "HP-DEC");
3286  lmem[_mHP] = 1;
3287  }
3288  else if (!lmem[_mHP] && INFILE(_CR_DEC) && INFILE(_LT_DEC_2)) {
3289  INTERESTING(lDebug ? "HP-DEC(4)" : "HP-DEC");
3290  lmem[_mHP] = 1;
3291  }
3292  else if (INFILE(_LT_EDS_1) && INFILE(_CR_EDS)) {
3293  INTERESTING(lDebug ? "HP-EDS(1)" : "HP");
3294  }
3295  else if (INFILE(_LT_EDS_2) && INFILE(_CR_EDS)) {
3296  INTERESTING(lDebug ? "HP-EDS(2)" : "HP");
3297  }
3298  }
3299  else if (!lmem[_mHP] && INFILE(_LT_DEC_1)) {
3300  INTERESTING(lDebug ? "HP-DEC-style(2)" : "HP-DEC-style");
3301  }
3302  else if (!lmem[_mHP] && INFILE(_LT_DEC_2)) {
3303  INTERESTING(lDebug ? "HP-DEC-style(3)" : "HP-DEC-style");
3304  }
3305  else if (INFILE(_LT_HP_4)) {
3306  INTERESTING(lDebug ? "HP-style(1)" : "HP-style");
3307  }
3308  else if (INFILE(_LT_COMPAQ_1)) {
3309  INTERESTING(lDebug ? "HP-style(2)" : "HP-style");
3310  }
3311  else if (INFILE(_LT_EDS_1)) {
3312  INTERESTING(lDebug ? "HP-EDS(1#2)" : "HP");
3313  }
3314  else if (INFILE(_LT_EDS_2)) {
3315  INTERESTING(lDebug ? "HP-EDS(2#2)" : "HP");
3316  }
3318  /*
3319  * SUN Microsystems
3320  */
3321  if (!lmem[_mSUN] && (INFILE(_CR_SUN) || INFILE(_TEXT_MICROSYSTEMS))) {
3322  if (INFILE(_LT_SUN_PROPRIETARY) || INFILE(_LT_SUN_PROPRIETARY_2) || INFILE(_LT_SUN_PROPRIETARY_3)) {
3323  INTERESTING(lDebug ? "Sun(Prop)" : "Sun-Proprietary");
3324  lmem[_mSUN] = 1;
3325  }
3326  else if (INFILE(_LT_SUN_RPC)) {
3327  INTERESTING("Sun-RPC");
3328  lmem[_mSUN] = 1;
3329  }
3330  else if (INFILE(_LT_SUN_1)) {
3331  if (INFILE(_LT_SUN_FREE)) {
3332  INTERESTING(lDebug ? "Sun(Freeware)" : "Freeware");
3333  }
3334  else {
3335  INTERESTING(lDebug ? "Sun(3)" : "Sun");
3336  }
3337  lmem[_mSUN] = 1;
3338  }
3339  else if (INFILE(_LT_SUN_2)) {
3340  INTERESTING(lDebug ? "Sun(4)" : "Sun-Proprietary");
3341  lmem[_mSUN] = 1;
3342  }
3343  else if (INFILE(_LT_SUN_3)) {
3344  INTERESTING(lDebug ? "Sun(5)" : "Sun");
3345  lmem[_mSUN] = 1;
3346  }
3347  else if (INFILE(_LT_SUN_4)) {
3348  INTERESTING(lDebug ? "Sun(6)" : "Sun");
3349  lmem[_mSUN] = 1;
3350  }
3351  else if (INFILE(_LT_SUN_5)) {
3352  INTERESTING(lDebug ? "Sun(7)" : "Freeware");
3353  lmem[_mSUN] = 1;
3354  }
3355  else if (INFILE(_LT_SUN_6)) {
3356  INTERESTING(lDebug ? "Sun(8)" : "BSD-style");
3357  lmem[_mSUN] = 1;
3358  }
3359  else if (INFILE(_LT_SUN_NC)) {
3360  INTERESTING("Sun.Non-commercial");
3361  lmem[_mSUN] = 1;
3362  }
3363  else if (INFILE(_LT_SUNrestrict)) {
3364  INTERESTING("Sun.RESTRICTED");
3365  lmem[_mSUN] = 1;
3366  }
3367  else if (INFILE(_LT_SUN_BCLA_1) && INFILE(_TITLE_SUN_BCLA)) {
3368  INTERESTING(lDebug ? "BCLA(1)" : "Sun-BCLA");
3369  lmem[_mSUN] = 1;
3370  }
3371  else if (INFILE(_LT_SUN_BCLA_2)) {
3372  INTERESTING(lDebug ? "BCLA(2)" : "Sun-BCLA");
3373  lmem[_mSUN] = 1;
3374  }
3375  else if (INFILE(_LT_SUN_BCLAref)) {
3376  INTERESTING(lDebug ? "BCLA(ref)" : "Sun-BCLA");
3377  lmem[_mSUN] = 1;
3378  }
3379  else if (INFILE(_LT_SUN_ENTITLE)) {
3380  INTERESTING(lDebug ? "Sun(entitlement)" : "Sun");
3381  lmem[_mSUN] = 1;
3382  }
3383  else if (INFILE(_LT_SUN_ANYagreement)) {
3384  INTERESTING("Sun-EULA");
3385  lmem[_mSUN] = 1;
3386  }
3387  else if (INFILE(_LT_SUN_JAVA)) {
3388  INTERESTING("Sun-Java");
3389  lmem[_mSUN] = 1;
3390  }
3391  else if (INFILE(_LT_SUN_IP)) {
3392  INTERESTING("Sun-IP");
3393  lmem[_mSUN] = 1;
3394  lmem[_fIP] = 1;
3395  }
3396  else if (INFILE(_LT_SUN_SCA)) {
3397  INTERESTING("Sun-SCA");
3398  lmem[_mSUN] = 1;
3399  }
3400  else if (INFILE(_LT_SUN_SCSLref)) {
3401  if (INFILE(_TITLE_SCSL_V23)) {
3402  INTERESTING("SCSL-2.3");
3403  }
3404  else if (INFILE(_TITLE_SCSL_V30)) {
3405  INTERESTING("SCSL-3.0");
3406  }
3407  else {
3408  INTERESTING("SCSL");
3409  }
3410  lmem[_mSUN] = 1;
3411  }
3412  else if (INFILE(_TITLE_SUN_SCSL_TSA) &&
3413  INFILE(_LT_SUN_SCSL_TSA)) {
3414  if (INFILE(_TITLE_TSA_10)) {
3415  INTERESTING("SCSL-TSA-1.0");
3416  }
3417  else {
3418  INTERESTING("SCSL-TSA");
3419  }
3420  lmem[_mSUN] = 1;
3421  }
3422  else if (INFILE(_LT_SUN_SISSLref1)
3423  || INFILE(_LT_SUN_SISSLref2)) {
3424  cp = SISSLVERS();
3425  INTERESTING(lDebug ? "SISSL(ref#1)" : cp);
3426  lmem[_mSUN] = 1;
3427  }
3428  }
3429  else if (!lmem[_fREAL] && INFILE(_LT_SUN_PLref)) {
3430  INTERESTING(lDebug ? "Sun-PL(ref)" : "SPL");
3431  lmem[_mSUN] = 1;
3432  }
3433  else if (!lmem[_mSUN] && URL_INFILE(_URL_SUN_BINARY_V150)) {
3434  INTERESTING("Sun-BCLA-1.5.0");
3435  lmem[_mSUN] = 1;
3436  }
3437  else if (!lmem[_mSUN] && URL_INFILE(_URL_SUN_BINARY)) {
3438  INTERESTING(lDebug ? "BCLA(url)" : "Sun-BCLA");
3439  lmem[_mSUN] = 1;
3440  }
3441  else if (!lmem[_mSUN] && INFILE(_LT_SUN_GRAPHICS)) {
3442  INTERESTING(lDebug ? "Sun(8)" : "Sun");
3443  lmem[_mSUN] = 1;
3444  }
3445  else if (!lmem[_mSUN] && INFILE(_LT_SUN_GRAPHICS)) {
3446  INTERESTING(lDebug ? "Sun(9)" : "Sun");
3447  lmem[_mSUN] = 1;
3448  }
3449  else if ((!lmem[_mSUN] && INFILE(_LT_SUN_SISSLref1)) ||
3450  INFILE(_LT_SUN_SISSLref2)) {
3451  cp = SISSLVERS();
3452  INTERESTING(lDebug ? "SISSL(ref#2)" : cp);
3453  lmem[_mSUN] = 1;
3454  }
3455  else if (!lmem[_mSUN] && URL_INFILE(_URL_SISSL)) {
3456  cp = SISSLVERS();
3457  INTERESTING(lDebug ? "SISSL(url)" : cp);
3458  lmem[_mSUN] = 1;
3459  }
3461  if (INFILE(_LT_SUN_PRO)) {
3462  INTERESTING(lDebug ? "SunPro" : "Freeware");
3463  }
3465  /*
3466  * IBM
3467  */
3468  if (INFILE(_TEXT_IBM)) {
3469  if (INFILE(_LT_IBM_RECIP)) {
3470  INTERESTING("IBM-reciprocal");
3471  }
3472  else if (INFILE(_LT_IBM_4)) {
3473  INTERESTING(lDebug ? "IBM(4)" : "IBM-dhcp");
3474  }
3475  else if (INFILE(_LT_IBM_1)) {
3476  INTERESTING(lDebug ? "IBM(1)" : "MIT-style");
3477  }
3478  else if (INFILE(_LT_IBM_3)) {
3479  INTERESTING(lDebug ? "IBM(3)" : "MIT-style");
3480  }
3481  else if (INFILE(_LT_IBM_2)) {
3482  INTERESTING(lDebug ? "IBM(2)" : "IBM");
3483  }
3484  else if (INFILE(_LT_IBM_OWNER)) {
3485  INTERESTING(lDebug ? "IBM(4)" : "IBM");
3486  }
3487  else if (INFILE(_LT_IBM_JIKES)) {
3488  INTERESTING("IBM-JCL");
3489  }
3490  else if (INFILE(_LT_IBM_COURIER)) {
3491  INTERESTING("IBM-Courier");
3492  }
3493  else if (INFILE(_LT_IBM_EULA)) {
3494  INTERESTING(lDebug ? "IBM-EULA(1)" : "IBM-EULA");
3495  }
3496  else if (INFILE(_PHR_IBM_EULA)) {
3497  INTERESTING(lDebug ? "IBM-EULA(2)" : "IBM-EULA");
3498  }
3499  else if (INFILE(_LT_IBM_PIBS)) {
3500  INTERESTING("IBM-pibs");
3501  }
3502  else if (INFILE(_LT_IBM_AS_IS)) {
3503  INTERESTING("IBM-as-is");
3504  }
3505  }
3507  /*
3508  * Motorola
3509  */
3510  if (INFILE(_CR_MOT_1) || INFILE(_CR_MOT_2)) {
3511  if (INFILE(_LT_MOT_1)) {
3512  INTERESTING(lDebug ? "Motorola(1)" : "Motorola");
3513  }
3514  else if (INFILE(_LT_MOT_2)) {
3515  INTERESTING(lDebug ? "Motorola(2)" : "Motorola");
3516  }
3517  }
3518  if (HASTEXT(_TITLE_MOTOROLA_MOBILE, 0)) {
3519  INTERESTING("Motorola-Mobile-SLA");
3520  }
3522  /*
3523  * Java
3524  */
3525  if (INFILE(_LT_JAVA_WSDL4J)) {
3526  INTERESTING("Java-WSDL4J");
3527  }
3528  else if (INFILE(_LT_JAVA_WSDL_SCHEMA)) {
3529  INTERESTING("Java-WSDL-Schema");
3530  }
3531  else if (INFILE(_LT_JAVA_WSDL_POLICY)) {
3532  INTERESTING("Java-WSDL-Policy");
3533  }
3534  else if (INFILE(_LT_JAVA_WSDL_ENUM)) {
3535  INTERESTING("Java-WSDL-Spec");
3536  }
3537  else if (INFILE(_LT_MULTICORP_1)) {
3538  INTERESTING(lDebug ? "Java-Multi(1)" : "Java-Multi-Corp");
3539  }
3540  else if (INFILE(_LT_MULTICORP_2)) {
3541  INTERESTING(lDebug ? "Java-Multi(2)" : "Java-Multi-Corp");
3542  }
3544  /*
3545  * Mibble
3546  */
3547  if (INFILE(_LT_MIBBLE)) {
3548  if (INFILE(_TITLE_MIBBLE_28)) {
3549  INTERESTING("Mibble-2.8");
3550  }
3551  else {
3552  INTERESTING("Mibble");
3553  }
3554  }
3556  /*
3557  * Comtrol Corp
3558  */
3559  if (INFILE(_CR_COMTROL) && INFILE(_LT_COMTROL)) {
3560  INTERESTING("Comtrol");
3561  }
3563  /*
3564  * TrollTech
3565  */
3566  if (INFILE(_LT_TROLLTECH) && INFILE(_CR_TROLLTECH)) {
3567  INTERESTING("Trolltech");
3568  }
3569  else if (INFILE(_LT_QT_COMMref)) {
3570  INTERESTING("Qt.Commercial");
3571  }
3572  else if (INFILE(_LT_QT_PROPRIETARY) || INFILE(_TITLE_QT_PROPRIETARY)) {
3573  INTERESTING("Qt.Commercial");
3574  }
3576  /*
3577  * SNIA (Storage Network Industry) public license
3578  */
3579  if (!lmem[_mMPL] && !lmem[_mSUN] && INFILE(_LT_SNIA_PL)) {
3580  if (INFILE(_TITLE_SNIA_V11)) {
3581  INTERESTING("SNIA-1.1");
3582  }
3583  else if (INFILE(_TITLE_SNIA_V10)) {
3584  INTERESTING("SNIA-1.0");
3585  }
3586  else {
3587  INTERESTING("SNIA");
3588  }
3589  }
3590  else if (INFILE(_LT_SNIAref)) {
3591  if (INFILE(_TITLE_SNIA_V11)) {
3592  INTERESTING(lDebug ? "SNIA-1.1(ref)" : "SNIA-1.1");
3593  }
3594  else if (INFILE(_TITLE_SNIA_V10)) {
3595  INTERESTING(lDebug ? "SNIA-1.0(ref)" : "SNIA-1.0");
3596  }
3597  else {
3598  INTERESTING(lDebug ? "SNIA(ref)" : "SNIA");
3599  }
3600  }
3601  else if (URL_INFILE(_URL_SNIA_V11)) {
3602  INTERESTING(lDebug ? "SNIA-1.1(url)" : "SNIA-1.1");
3603  }
3604  else if (URL_INFILE(_URL_SNIA)) {
3605  INTERESTING(lDebug ? "SNIA(url)" : "SNIA");
3606  }
3608  /*
3609  * BEA
3610  */
3611  if (HASTEXT(_TEXT_BEASYS, 0)) {
3612  if (INFILE(_LT_BEA_1)) {
3613  INTERESTING(lDebug ? "BEA(1)" : "BEA");
3614  }
3615  else if (INFILE(_LT_BEA_2)) {
3616  INTERESTING(lDebug ? "BEA(2)" : "BEA");
3617  }
3618  }
3620  /*
3621  * ADOBE/FRAME
3622  */
3623  if (HASTEXT(_TEXT_ADOBE_FRAME, REG_EXTENDED)) {
3624  if (INFILE(_LT_ADOBE_1)) {
3625  INTERESTING(lDebug ? "Adobe(1)" : "Adobe");
3626  }
3627  else if (!lmem[_mMIT] && INFILE(_LT_ADOBE_2)) {
3628  INTERESTING(lDebug ? "Adobe(2)" : "Adobe");
3629  }
3630  else if (INFILE(_LT_ADOBE_3)) {
3631  INTERESTING(lDebug ? "Adobe(3)" : "Adobe");
3632  }
3633  else if (INFILE(_LT_ADOBE_4)) {
3634  INTERESTING(lDebug ? "Adobe(4)" : "Adobe-EULA");
3635  }
3636  else if (INFILE(_LT_ADOBE_5)) {
3637  INTERESTING(lDebug ? "Adobe(5)" : "Adobe-EULA");
3638  }
3639  else if (INFILE(_LT_ADOBE_6)) {
3640  INTERESTING(lDebug ? "Adobe(6)" : "Adobe-EULA");
3641  }
3642  else if (INFILE(_LT_ADOBE_7)) {
3643  INTERESTING(lDebug ? "Adobe(7)" : "Adobe-EULA");
3644  }
3645  else if (INFILE(_LT_FRAME)) {
3646  INTERESTING(lDebug ? "Adobe(Frame)" : "Adobe");
3647  }
3648  else if (INFILE(_LT_ADOBE_SRC) || INFILE(_TITLE_ADOBE_SRC)) {
3649  INTERESTING(lDebug ? "Adobe(src)" : "Adobe-2006");
3650  }
3651  else if (INFILE(_LT_ADOBE_DATA)) {
3652  INTERESTING(lDebug ? "Adobe(data)" : "Adobe");
3653  }
3654  else if (INFILE(_LT_ADOBE_EULA)) {
3655  INTERESTING("Adobe-EULA");
3656  }
3657  else if (INFILE(_LT_ADOBE_AFM)) {
3658  INTERESTING("APAFML");
3659  }
3660  else if (HASTEXT(_TITLE_ADOBE_DNG, 0)) {
3661  INTERESTING("Adobe-DNG");
3662  }
3663  else if (INFILE(_LT_ADOBE_AFMPARSE_1) && INFILE(_LT_ADOBE_AFMPARSE_2)) {
3664  INTERESTING("Afmparse");
3665  }
3666  else if (INFILE(_LT_ADOBE_OTHER)) {
3667  INTERESTING(lDebug ? "Adobe(other)" : "Adobe");
3668  }
3669  else if (INFILE(_LT_ADOBE_SUB)) {
3670  INTERESTING(lDebug ? "Adobe(sub)" : "Adobe");
3671  }
3672  }
3674  /*
3675  * Docbook and Open Source Metadata Framework
3676  */
3677  if (INFILE(_LT_DOCBOOK)) {
3678  if (HASTEXT(_TEXT_DOCBOOK, 0)) {
3679  INTERESTING("DOCBOOK");
3680  }
3681  else if (HASTEXT(_TEXT_METADATA, 0)) {
3682  INTERESTING("OMF");
3683  }
3684  else {
3685  INTERESTING("DOCBOOK-style");
3686  }
3687  }
3689  /*
3690  * MP3 decoder
3691  */
3692  if (INFILE(_LT_MPEG3)) {
3693  INTERESTING("MPEG3-decoder");
3694  }
3696  /*
3697  * Google
3698  */
3699  if (INFILE(_LT_GOOGLE_1)) {
3700  INTERESTING(lDebug ? "Google(1)" : "Google");
3701  }
3702  else if (INFILE(_LT_GOOGLE_2)) {
3703  INTERESTING(lDebug ? "Google(2)" : "Google");
3704  }
3706  /*
3707  * Mandriva
3708  */
3709  if (INFILE(_LT_MANDRIVA)) {
3710  INTERESTING("Mandriva");
3711  }
3713  /*
3714  * Irondoc
3715  */
3716  if (INFILE(_LT_IRONDOC)) {
3717  INTERESTING("IronDoc");
3718  }
3720  /*
3721  * Quarterdeck Office Systems
3722  */
3723  if (INFILE(_LT_QUARTERDECK) && INFILE(_CR_QUARTERDECK)) {
3724  INTERESTING("QuarterDeck");
3725  }
3727  /*
3728  * Electronic Book Technologies
3729  */
3730  if (INFILE(_LT_EBT)) {
3731  if(INFILE(_CR_EBT)) {
3732  INTERESTING("EBT");
3733  } else {
3734  INTERESTING("EBT-style");
3735  }
3736  }
3738  /*
3739  * SGML
3740  */
3741  if (HASTEXT(_TEXT_SGMLUG, 0) && INFILE(_LT_SGML)) {
3742  INTERESTING("SGML");
3743  }
3745  /*
3746  * LaTeX (KOMA-Script)
3747  */
3748  if (HASTEXT(_TEXT_LATEX, REG_EXTENDED)) {
3749  if (INFILE(_LT_LATEXPL_1) || INFILE(_LT_LATEXPL_2) ||
3750  INFILE(_LT_LATEXPL_3)) {
3751  cp = LPPLVERS();
3752  INTERESTING(lDebug ? "LPPL(1)" : cp);
3753  }
3754  else if (INFILE(_LT_LATEX)) {
3755  cp = LPPLVERS();
3756  INTERESTING(lDebug ? "LPPL(2)" : cp);
3757  }
3758  else if (INFILE(_LT_LATEXPLref1) || INFILE(_LT_LATEXPLref2) ||
3759  INFILE(_LT_LATEXPLref3)) {
3760  cp = LPPLVERS();
3761  INTERESTING(lDebug ? "LPPL(3)" : cp);
3762  }
3763  else if (INFILE(_LT_LATEXref1)) {
3764  cp = LPPLVERS();
3765  INTERESTING(lDebug ? "LPPL(4)" : cp);
3766  }
3767  else if (INFILE(_LT_LATEXref2)) {
3768  cp = LPPLVERS();
3769  INTERESTING(lDebug ? "LPPL(5)" : cp);
3770  }
3771  else if (INFILE(_LT_LATEXref3)) {
3772  cp = LPPLVERS();
3773  INTERESTING(lDebug ? "LPPL(6)" : cp);
3774  }
3775  else if (INFILE(_LT_LATEXref4)) {
3776  cp = LPPLVERS();
3777  INTERESTING(lDebug ? "LPPL(7)" : cp);
3778  }
3779  else if (INFILE(_LT_LATEXref5)) {
3780  cp = LPPLVERS();
3781  INTERESTING(lDebug ? "LPPL(8)" : cp);
3782  }
3783  else if (URL_INFILE(_URL_LATEX)) {
3784  cp = LPPLVERS();
3785  INTERESTING(lDebug ? "LPPL(url)" : cp);
3786  }
3787  }
3789  /*
3790  * QPL
3791  */
3792  if (INFILE(_LT_QPL) || INFILE(_LT_QPLref)) {
3793  if (INFILE(_TITLE_QPL10_1) || INFILE(_TITLE_QPL10_2)) {
3794  INTERESTING("QPL-1.0");
3795  lmem[_mQPL] = 1;
3796  }
3797  else if (INFILE(_TITLE_QPL)) {
3798  INTERESTING("QPL");
3799  lmem[_mQPL] = 1;
3800  }
3801  }
3803  /*
3804  * FREE Public License (not really open/free) and GHOSTSCRIPT
3805  */
3806  if (HASTEXT(_TEXT_GHOSTSCRIPT, 0)) {
3807  if (INFILE(_LT_GS)) {
3808  if (INFILE(_TITLE_GS11)) {
3809  INTERESTING("Ghostscript-GPL-1.1");
3810  }
3811  else {
3812  INTERESTING(lDebug ? "GS-GPL(1)" : "Ghostscript-GPL");
3813  }
3814  }
3815  else if (INFILE(_CR_ALADDIN) || INFILE(_CR_ARTOFCODE)) {
3816  if (INFILE(_LT_GS_GNU1) || INFILE(_LT_GS_GNU2)) {
3817  INTERESTING("GNU-Ghostscript");
3818  }
3819  else if (INFILE(_LT_GNU_1) && INFILE(_LT_GNU_2)) {
3820  INTERESTING(lDebug ? "GS-GPL(2)" : "Ghostscript-GPL");
3821  }
3822  else if (INFILE(_LT_FREEPL) || INFILE(_LT_FREEPLref)) {
3823  INTERESTING(lDebug ? "Aladdin(Closed-Source!)" : "Aladdin");
3824  if (INFILE(_PHR_NOT_OPEN)) {
3825  INTERESTING(lDebug ? "Aladdin(Closed-Source!)" : "Aladdin");
3826  lmem[_mALADDIN] = 1;
3827  }
3828  else {
3829  INTERESTING(lDebug ? "Aladdin-Ghostscript" : "Aladdin");
3830  }
3831  }
3832  else if (INFILE(_LT_ALADDIN_RESTRICT)) {
3833  INTERESTING(lDebug ? "Aladdin(RESTRICTED)": "Aladdin");
3834  }
3835  }
3836  else if (INFILE(_LT_AFPL)) {
3837  INTERESTING("AFPL-Ghostscript");
3838  }
3839  }
3840  else if (INFILE(_LT_FREEPLref_1)) {
3841  INTERESTING("Aladdin");
3842  }
3843  else if (INFILE(_LT_FREEPL) || INFILE(_LT_FREEPLref)) {
3844  INTERESTING("Free-PL");
3845  }
3846  /*
3847  * IPTC (International Press Telecommunications Council)
3848  */
3849  else if (INFILE(_TITLE_IPTC) || INFILE(_LT_IPTC_2)) {
3850  INTERESTING("IPTC");
3851  }
3852  else if (INFILE(_LT_IPTC_1) && mCR_IPTC()) {
3853  INTERESTING("IPTC");
3854  }
3855  /*
3856  * Macromedia
3857  */
3858  else if (INFILE(_TITLE_MACROMEDIA_EULA)) {
3859  INTERESTING("MacroMedia-RPSL");
3860  }
3861  /*
3862  * Ontopia
3863  */
3864  else if (INFILE(_LT_ONTOPIA) && INFILE(_TITLE_ONTOPIA)) {
3865  INTERESTING("Ontopia");
3866  }
3868  /*
3869  * Ascender
3870  */
3871  if (INFILE(_LT_ASCENDER_EULA) && INFILE(_TITLE_ASCENDER_EULA)) {
3872  INTERESTING("Ascender-EULA");
3873  }
3875  /*
3876  * JPNIC
3877  */
3878  if (HASTEXT(_TEXT_JPNIC, 0) && INFILE(_LT_JPNIC)) {
3879  INTERESTING("JPNIC");
3880  }
3882  /*
3883  * ADAPTEC
3884  */
3885  if (INFILE(_LT_ADAPTEC_OBJ)) {
3886  INTERESTING("Adaptec.RESTRICTED");
3887  }
3888  else if (INFILE(_CR_ADAPTEC) && INFILE(_LT_ADAPTEC_GPL)) {
3889  INTERESTING("Adaptec-GPL");
3890  }
3892  /*
3893  * Artistic and Perl
3894  */
3895  if (INFILE(_LT_PERL_1)) {
3896  INTERESTING(lDebug ? "Artistic(Perl#1)" : "Artistic-1.0");
3897  if (!lmem[_mGPL]) {
3898  INTERESTING("Dual-license");
3899  INTERESTING(lDebug ? "GPL(Perl#1)" : "GPL-1.0+");
3900  }
3901  }
3902  else if (INFILE(_LT_PERL_2)) {
3903  INTERESTING(lDebug ? "Artistic(Perl#2)" : "Artistic-1.0");
3904  if (!lmem[_mGPL]) {
3905  INTERESTING("Dual-license");
3906  INTERESTING(lDebug ? "GPL(Perl#2)" : "GPL-1.0+");
3907  }
3908  }
3909  else if (INFILE(_LT_PERL_3)) {
3910  if (!lmem[_fOPENLDAP] && !TRYGROUP(famOPENLDAP)) {
3911  INTERESTING(lDebug ? "Artistic(Perl#3)" : "Artistic-1.0");
3912  }
3913  }
3914  /*
3915  * Licensed "same as perl itself" will actually be Artistic AND GPL, per
3916  * Larry Wall and the documented licensing terms of "perl"
3917  */
3918  else if (INFILE(_LT_PERLref1)) {
3919  INTERESTING(lDebug ? "Artistic(Perl-ref1)" : "Artistic-1.0");
3920  if (!lmem[_mGPL]) {
3921  INTERESTING("Dual-license");
3922  INTERESTING(lDebug ? "GPL(Perl-ref1)" : "GPL-1.0+");
3923  }
3924  }
3925  else if (PERL_INFILE(_LT_PERLref2)) {
3926  INTERESTING(lDebug ? "Artistic(Perl-ref2)" : "Artistic-1.0");
3927  if (!lmem[_mGPL]) {
3928  INTERESTING("Dual-license");
3929  INTERESTING(lDebug ? "GPL(Perl-ref2)" : "GPL-1.0+");
3930  }
3931  }
3932  else if (INFILE(_LT_PERLref3)) {
3933  INTERESTING(lDebug ? "Artistic(Perl-ref3)" : "Artistic-1.0");
3934  if (!lmem[_mGPL]) {
3935  INTERESTING("Dual-license");
3936  INTERESTING(lDebug ? "GPL(Perl-ref3)" : "GPL-1.0+");
3937  }
3938  }
3939  else if (INFILE(_LT_PERLref4)) {
3940  INTERESTING(lDebug ? "Artistic(Perl-ref4)" : "Artistic-1.0");
3941  if (!lmem[_mGPL]) {
3942  INTERESTING("Dual-license");
3943  INTERESTING(lDebug ? "GPL(Perl-ref4)" : "GPL-1.0+");
3944  }
3945  }
3946  else if (INFILE(_LT_PERLref5)) {
3947  INTERESTING(lDebug ? "Artistic(Perl-ref5)" : "Artistic-1.0");
3948  if (!lmem[_mGPL]) {
3949  INTERESTING("Dual-license");
3950  INTERESTING(lDebug ? "GPL(Perl-ref5)" : "GPL-1.0+");
3951  }
3952  }
3953  else if (INFILE(_TITLE_CLARTISTIC)) {
3954  INTERESTING("ClArtistic");
3955  lmem[_fCLA] = 1;
3956  }
3957  else if (!lmem[_fREAL] && !LVAL(_TEXT_GNU_LIC_INFO) &&
3958  (INFILE(_LT_ART_1) || INFILE(_LT_ARTref1) ||
3959  INFILE(_LT_ARTref2) || INFILE(_LT_ARTref3) ||
3960  INFILE(_LT_ARTref4) || PERL_INFILE(_LT_ARTref5) ||
3961  PERL_INFILE(_LT_ARTref6))) {
3962  if (INFILE(_TITLE_OGTSL)) {
3963  INTERESTING("OGTSL");
3964  }
3965  else if (!lmem[_mLIBRE] && !lmem[_fOPENLDAP] &&
3966  !TRYGROUP(famOPENLDAP)) {
3967  if (INFILE(_LT_ART_V2) || INFILE(_TITLE_ART20)) {
3968  INTERESTING(lDebug ? "Artistic(v2.0#1)" : "Artistic-2.0");
3969  }
3970  else if (INFILE(_TITLE_NBPL_V10)) {
3971  INTERESTING("NBPL-1.0");
3972  lmem[_fARTISTIC] = 1;
3973  }
3974  else if(HASTEXT(_PHR_ARTISTIC_PERL, 0)) {
3975  INTERESTING("Artistic-1.0-Perl");
3976  lmem[_fARTISTIC] = 1;
3977  }
3978  else if (HASTEXT(_PHR_ARTISTIC_CLAUSE8, 0))
3979  {
3980  INTERESTING("Artistic-1.0-cl8");
3981  lmem[_fARTISTIC] = 1;
3982  }
3983  else {
3984  INTERESTING(lDebug ? "Artistic(v1.0#other)" : "Artistic-1.0");
3985  lmem[_fARTISTIC] = 1;
3986  }
3987  }
3988  }
3989  else if (INFILE(_LT_ART_2) && INFILE(_TITLE_ART20)) {
3990  INTERESTING(lDebug ? "Artistic(v2.0#2)" : "Artistic-2.0");
3991  }
3992  else if (INFILE(_FILE_ART1) || INFILE(_FILE_ART2)) {
3993  INTERESTING(lDebug ? "Artistic(deb)" : "Artistic-1.0");
3994  }
3995  else if (URL_INFILE(_URL_ART)) {
3996  INTERESTING(lDebug ? "Artistic(url)" : "Artistic-1.0");
3997  }
3999  /*
4000  * LDP, Manpages, OASIS, GPDL, Linux-HOWTO and Linux-doc
4001  */
4002  if (INFILE(_TITLE_LDPL20)) {
4003  INTERESTING("LDPL-2.0");
4004  }
4005  else if (INFILE(_TITLE_LDPL1A)) {
4006  INTERESTING("LDPL-1A");
4007  }
4008  else if (INFILE(_LT_LDPL)) {
4009  INTERESTING(lDebug ? "LDPL(1)" : "LDPL");
4010  }
4011  else if (INFILE(_LT_LDPLref1)) {
4012  INTERESTING(lDebug ? "LDPL(ref1)" : "LDPL");
4013  }
4014  else if (INFILE(_LT_LDPLref2)) {
4015  INTERESTING(lDebug ? "LDPL(ref2)" : "LDPL");
4016  }
4017  else if (INFILE(_LT_LDPLref3)) {
4018  INTERESTING(lDebug ? "LDPL(ref3)" : "LDPL");
4019  }
4020  /*
4021  * GNU-Manpages, Software in the Public Interest (Debian), aka SPI
4022  */
4023  else if (INFILE(_LT_SPI)) {
4024  if (INFILE(_LT_MANPAGE)) {
4025  INTERESTING("GNU-Manpages");
4026  }
4027  else if (!lmem[_fGPL]) {
4028  if (INFILE(_CR_SPI)) {
4029  INTERESTING("Debian-SPI");
4030  }
4031  else {
4032  INTERESTING("Debian-SPI-style");
4033  }
4034  }
4035  }
4036  else if (INFILE(_LT_GPDLref)) {
4037  INTERESTING(lDebug ? "GPDL(1)" : "GPDL");
4038  }
4039  else if (INFILE(_TITLE_GPDL)) {
4040  INTERESTING(lDebug ? "GPDL(2)" : "GPDL");
4041  }
4042  else if (INFILE(_LT_FREEBSD_DOC) && INFILE(_TITLE_FREEBSD_DOC)) {
4043  INTERESTING("FreeBSD-Doc");
4044  }
4045  else if (INFILE(_LT_LINUX_HOWTO)) {
4046  INTERESTING("Linux-HOWTO");
4047  }
4048  else if (INFILE(_LT_LINUXDOC)) {
4049  INTERESTING("LinuxDoc");
4050  }
4051  else if (INFILE(_LT_IEEE_DOC)) {
4052  INTERESTING("IEEE-Doc");
4053  }
4055  /*
4056  * U-Washington
4057  */
4058  if (INFILE(_LT_UW1)) {
4059  if (INFILE(_CR_UWASHINGTON)) {
4060  INTERESTING("U-Wash.Free-Fork");
4061  }
4062  else {
4063  INTERESTING(lDebug ? "U-Wash-style(1)" : "U-Wash-style");
4064  }
4065  }
4066  else if (INFILE(_LT_UW2)) {
4067  if (INFILE(_CR_UWASHINGTON)) {
4068  INTERESTING(lDebug ? "U-Wash(2)" : "U-Washington");
4069  }
4070  else {
4071  INTERESTING(lDebug ? "U-Wash-style(2)" : "U-Wash-style");
4072  }
4073  }
4074  else if (INFILE(_LT_UW3)) {
4075  if (INFILE(_CR_UWASHINGTON)) {
4076  INTERESTING(lDebug ? "U-Wash(3)" : "U-Washington");
4077  }
4078  else {
4079  INTERESTING(lDebug ? "U-Wash-style(3)" : "U-Wash-style");
4080  }
4081  }
4082  else if (INFILE(_LT_UW4)) {
4083  if (INFILE(_CR_UWASHINGTON)) {
4084  INTERESTING(lDebug ? "U-Wash(4)" : "U-Washington");
4085  }
4086  else {
4087  INTERESTING(lDebug ? "U-Wash-style(4)" : "U-Wash-style");
4088  }
4089  }
4091  /*
4092  * WU-ftpd (not the school north of Oregon!
4093  */
4094  if (INFILE(_LT_WU_FTPD)) {
4095  if (INFILE(_TITLE_WU_FTPD) || INFILE(_CR_WASHU)) {
4096  INTERESTING(lDebug ? "Wash-U(1)" : "Wash-U-StLouis");
4097  }
4098  else {
4099  INTERESTING("Wash-U-style");
4100  }
4101  }
4102  else if (INFILE(_LT_WU_FTPDref)) {
4103  INTERESTING(lDebug ? "Wash-U(ref)" : "Wash-U-StLouis");
4104  }
4105  /*
4106  * Delaware
4107  */
4108  else if (INFILE(_LT_DELAWARE)) {
4109  if (INFILE(_CR_DELAWARE)) {
4110  INTERESTING("U-Del");
4111  }
4112  else {
4113  INTERESTING("U-Del-style");
4114  }
4115  }
4116  /*
4117  * Princeton
4118  */
4119  else if (INFILE(_LT_PRINCETON) && NOT_INFILE(_TITLE_WORDNET)) {
4120  if (INFILE(_CR_PRINCETON)) {
4121  INTERESTING("Princeton");
4122  }
4123  else {
4124  INTERESTING("Princeton-style");
4125  }
4126  }
4127  /*
4128  * University of Michigan
4129  */
4130  else if (INFILE(_LT_UMICHIGAN_1)) {
4131  if (INFILE(_CR_MICHIGAN)) {
4132  INTERESTING(lDebug ? "U-Mich(1)" : "U-Michigan");
4133  }
4134  else {
4135  INTERESTING(lDebug ? "U-Mich-style(1)" : "U-Mich-style");
4136  }
4137  }
4138  else if (INFILE(_LT_UMICHIGAN_2)) {
4139  if (INFILE(_CR_MICHIGAN)) {
4140  INTERESTING(lDebug ? "U-Mich(2)" : "U-Michigan");
4141  }
4142  else {
4143  INTERESTING(lDebug ? "U-Mich-style(2)" : "U-Mich-style");
4144  }
4145  }
4146  /*
4147  * Southern Cal
4148  */
4149  else if (INFILE(_LT_USC_NC)) {
4150  if (INFILE(_CR_USC)) {
4151  INTERESTING("USC.Non-commercial");
4152  }
4153  else {
4154  INTERESTING(lDebug ? "NonC(5)" : "Non-commercial");
4155  }
4156  }
4157  else if (INFILE(_LT_USC)) {
4158  if (INFILE(_CR_USC)) {
4159  INTERESTING("USC");
4160  }
4161  else {
4162  INTERESTING("USC-style");
4163  }
4164  }
4165  /*
4166  * Unversity Corporation for Atmospheric Research (UCAR)
4167  */
4168  else if (INFILE(_LT_UCAR_1) && INFILE(_LT_UCAR_2)) {
4169  INTERESTING("UCAR");
4170  }
4171  else if (INFILE(_LT_UCAR_3) && INFILE(_CR_UCAR)) {
4172  if (INFILE(_CR_UCAR)) {
4173  INTERESTING("UCAR");
4174  }
4175  else {
4176  INTERESTING("UCAR-style");
4177  }
4178  }
4179  /*
4180  * Stanford
4181  */
4182  else if (INFILE(_LT_STANFORD)) {
4183  if (INFILE(_CR_STANFORD)) {
4184  INTERESTING("Stanford");
4185  }
4186  else {
4187  INTERESTING("Stanford-style");
4188  }
4189  }
4190  /*
4191  * U-Cambridge
4192  */
4193  else if (INFILE(_LT_CAMBRIDGE)) {
4194  if (HASTEXT(_LT_MSNTP, 0)) {
4195  INTERESTING("MSNTP");
4196  }
4197  else if (INFILE(_CR_CAMBRIDGE_1) || INFILE(_CR_CAMBRIDGE_2)) {
4198  INTERESTING("U-Cambridge");
4199  }
4200  else {
4201  INTERESTING("U-Cambridge-style");
4202  }
4203  }
4204  /*
4205  * Columbia University
4206  */
4207  else if (INFILE(_CR_COLUMBIA) && INFILE(_LT_COLUMBIA)) {
4208  INTERESTING("U-Columbia");
4209  }
4210  /*
4211  * University of Notre Dame (Different from Boost!)
4212  */
4213  if (INFILE(_LT_ND_1)) {
4214  if (INFILE(_CR_NOTREDAME)) {
4215  INTERESTING(lDebug ? "ND(1)" : "NotreDame");
4216  }
4217  else {
4218  INTERESTING(lDebug ? "ND-style(1)" : "NotreDame-style");
4219  }
4220  }
4221  else if (INFILE(_LT_ND_2)) {
4222  if (INFILE(_CR_NOTREDAME)) {
4223  INTERESTING(lDebug ? "ND(2)" : "NotreDame");
4224  }
4225  else {
4226  INTERESTING(lDebug ? "ND-style(2)" : "NotreDame-style");
4227  }
4228  }
4229  else if (INFILE(_LT_ND_3)) {
4230  if (INFILE(_CR_NOTREDAME)) {
4231  INTERESTING(lDebug ? "ND(3)" : "NotreDame");
4232  }
4233  else {
4234  INTERESTING(lDebug ? "ND-style(3)" : "NotreDame-style");
4235  }
4236  }
4238  /*
4239  * Boost references
4240  */
4241  if (!lmem[_mMIT] && INFILE(_LT_BOOST_2)) {
4242  if (INFILE(_CR_BOOST)) {
4243  INTERESTING(lDebug ? "Boost(2)" : "BSL-1.0");
4244  }
4245  else {
4246  INTERESTING(lDebug ? "Boost-style(2)" : "BSL-style");
4247  }
4248  }
4249  else if (INFILE(_LT_BOOSTref1)) {
4250  if (INFILE(_TITLE_BOOST10) || INFILE(_PHR_BOOST_V10) ||
4251  URL_INFILE(_URL_BOOST_10)) {
4252  INTERESTING(lDebug ? "Boost1.0(ref)" : "BSL-1.0");
4253  }
4254  else {
4255  INTERESTING(lDebug ? "Boost(ref)" : "BSL-1.0");
4256  }
4257  }
4258  else if (INFILE(_LT_BOOST_GRAPH)) {
4259  INTERESTING(lDebug ? "Boost(graph)" : "BSL-1.0");
4260  }
4261  else if (INFILE(_LT_BOOST_LAMBDA)) {
4262  INTERESTING(lDebug ? "Boost(lambda)" : "BSL-1.0");
4263  }
4264  else if (URL_INFILE(_URL_BOOST_10)) {
4265  INTERESTING(lDebug ? "Boost-1.0(ref)" : "BSL-1.0");
4266  }
4267  /*
4268  * Sleepycat NON-Commerical
4269  */
4270  else if (INFILE(_LT_SLEEPYCAT_NC)) {
4271  INTERESTING("Sleepycat.Non-commercial");
4272  }
4274  /*
4275  * Vim license
4276  */
4277  if ((INFILE(_LT_VIM_1) || INFILE(_LT_VIM_2)) && INFILE(_TITLE_VIM)) {
4278  INTERESTING("VIM");
4279  }
4281  /*
4282  * Vixie license
4283  */
4284  if (INFILE(_LT_VIXIE)) {
4285  INTERESTING("Vixie-license");
4286  }
4288  /*
4289  * Yahoo!
4290  */
4291  if (INFILE(_LT_YAHOO_1)) {
4292  if (INFILE(_LT_YAHOO_BINARY)) {
4293  INTERESTING("Yahoo-EULA");
4294  }
4295  else {
4296  INTERESTING("YPL");
4297  }
4298  }
4299  if(INFILE(_TITLE_YPL_V10)) {
4300  INTERESTING("YPL-1.0");
4301  }
4302  else if(INFILE(_TITLE_YPL_V11)) {
4303  INTERESTING("YPL-1.1");
4304  }
4306  /*
4307  * Public Use
4308  */
4309  if (INFILE(_LT_PUBLIC_USE)) {
4310  if (INFILE(_TITLE_PUBUSE_V10)) {
4311  INTERESTING("Public-Use-1.0");
4312  }
4313  else {
4314  INTERESTING("Public-Use");
4315  }
4316  }
4318  /*
4319  * Apple
4320  */
4321  if (INFILE(_TEXT_APPLE)) {
4322  if (INFILE(_LT_MIT_12)) {
4323  INTERESTING(lDebug ? "Apple MIT License" : "AML");
4324  }
4325  else if (INFILE(_LT_APPLE_1)) {
4326  INTERESTING(lDebug ? "Apple(1)" : "Apple");
4327  }
4328  else if (INFILE(_LT_APPLE_2)) {
4329  INTERESTING(lDebug ? "Apple(2)" : "Apple");
4330  }
4331  else if (INFILE(_LT_APPLE_3)) { /* squeak license */
4332  INTERESTING(lDebug ? "Apple(3)" : "Apple");
4333  }
4334  else if (INFILE(_LT_APPLE_4)) { /* squeak license */
4335  INTERESTING(lDebug ? "Apple(4)" : "Apple-EULA");
4336  }
4337  else if (INFILE(_LT_APPLE_FONTFORGE)) {
4338  INTERESTING("Apple.FontForge");
4339  }
4340  else if (INFILE(_LT_APPLE_SAMPLE)) {
4341  INTERESTING("Apple.Sample");
4342  }
4343  else if (INFILE(_LT_APSLref1) || INFILE(_LT_APSLref2) ||
4344  INFILE(_TITLE_APSL)) {
4345  if (INFILE(_TITLE_APSL20)) {
4346  INTERESTING("APSL-2.0");
4347  }
4348  else if (INFILE(_TITLE_Ferris)) {
4349  INTERESTING(lDebug ? "Ferris-1.2" : "APSL-style");
4350  }
4351  else if (INFILE(_TITLE_APSL_style)) {
4352  INTERESTING("APSL-style");
4353  }
4354  else if (INFILE(_TITLE_APSL12)) {
4355  INTERESTING("APSL-1.2");
4356  }
4357  else if (INFILE(_TITLE_APSL11)) {
4358  INTERESTING("APSL-1.1");
4359  }
4360  else if (INFILE(_TITLE_APSL10)) {
4361  INTERESTING("APSL-1.0");
4362  }
4363  else {
4364  INTERESTING("APSL");
4365  }
4366  }
4367  else if (INFILE(_LT_ACDL)) {
4368  INTERESTING("ACDL");
4369  }
4370  else if (INFILE(_TITLE_APPLE_SLA)) {
4371  INTERESTING(lDebug ? "Apple(SLA)" : "Apple-EULA");
4372  }
4373  else if (URL_INFILE(_URL_APSL)) {
4374  INTERESTING(lDebug ? "APSL(url)" : "APSL");
4375  }
4376  else if (URL_INFILE(_URL_ACDL)) {
4377  INTERESTING(lDebug ? "ACDL(url)" : "ACDL");
4378  }
4379  }
4381  /*
4382  * Redland
4383  */
4384  if (INFILE(_LT_REDLAND)) {
4385  INTERESTING("Redland");
4386  }
4388  /*
4389  * Red Hat and Fedora
4390  */
4391  if (INFILE(_LT_RH_PKGS)) {
4392  if (INFILE(_LT_RH_NONCOMMERCIAL)) {
4393  INTERESTING(lDebug ? "RH(NC)" : "RedHat.Non-commercial");
4394  lmem[_mREDHAT] = 1;
4395  }
4396  else if (INFILE(_LT_RH_FEDORA)) {
4397  INTERESTING(lDebug ? "Fedora(1)" : "Fedora");
4398  lmem[_mREDHAT] = 1;
4399  }
4400  }
4401  else if (INFILE(_LT_RH_REDHAT)) {
4402  INTERESTING(lDebug ? "RH(2)" : "RedHat");
4403  lmem[_mREDHAT] = 1;
4404  }
4405  else if (INFILE(_LT_RH_SPECIFIC)) {
4406  INTERESTING(lDebug ? "RH(4)" : "RedHat-specific");
4407  lmem[_mREDHAT] = 1;
4408  }
4409  else if (INFILE(_LT_FEDORA)) {
4410  INTERESTING(lDebug ? "Fedora(2)" : "Fedora");
4411  lmem[_mREDHAT] = 1;
4412  }
4413  else if (INFILE(_LT_FEDORA_CLA) || INFILE(_TITLE_FEDORA_CLA)) {
4414  INTERESTING("FedoraCLA");
4415  lmem[_mREDHAT] = 1;
4416  }
4417  else if (INFILE(_CR_REDHAT)) {
4418  if (INFILE(_LT_RH_1)) {
4419  INTERESTING(lDebug ? "RH(1)" : "RedHat");
4420  lmem[_mREDHAT] = 1;
4421  }
4422  else if (INFILE(_LT_RH_EULA)) {
4423  INTERESTING("RedHat-EULA");
4424  lmem[_mREDHAT] = 1;
4425  }
4426  }
4428  /*
4429  * SUSE/Novell/UnitedLinux
4430  */
4431  if (INFILE(_CR_SUSE) && INFILE(_PHR_YAST_CR)) {
4432  INTERESTING("YaST.SuSE");
4433  }
4434  else if (INFILE(_TITLE_NOVELL_EULA)) {
4435  INTERESTING("Novell-EULA");
4436  }
4437  else if (INFILE(_TITLE_UL_EULA)) {
4438  INTERESTING("UnitedLinux-EULA");
4439  }
4440  else if (INFILE(_LT_NOVELL)) {
4441  INTERESTING("Novell");
4442  lmem[_fIP] = 1;
4443  }
4444  else if (INFILE(_LT_NOVELL_IP_1)) {
4445  INTERESTING(lDebug ? "Novell-IP(1)" : "Novell-IP");
4446  lmem[_fIP] = 1;
4447  }
4448  else if (INFILE(_LT_NOVELL_IP_2)) {
4449  INTERESTING(lDebug ? "Novell-IP(2)" : "Novell-IP");
4450  lmem[_fIP] = 1;
4451  }
4453  /*
4454  * Epson Public license
4455  */
4456  if (INFILE(_LT_EPSON_PL) && INFILE(_TITLE_EPSON_PL)) {
4457  INTERESTING("Epson-PL");
4458  }
4459  else if (INFILE(_LT_EPSON_EULA) && INFILE(_TITLE_EPSON_EULA)) {
4460  INTERESTING("Epson-EULA");
4461  }
4463  /*
4464  * Open Publication license
4465  */
4466  if (INFILE(_LT_OPENPUBL_1) || INFILE(_LT_OPENPUBL_2)) {
4467  if (INFILE(_TITLE_OPENPUBL04)) {
4468  INTERESTING("Open-PL-0.4");
4469  }
4470  else if (INFILE(_TITLE_OPENPUBL10) || URL_INFILE(_URL_OPEN_PL_V10)) {
4471  INTERESTING("Open-PL-1.0");
4472  }
4473  else if (INFILE(_TITLE_OPENPUBL)) {
4474  INTERESTING("Open-PL");
4475  }
4476  else {
4477  INTERESTING("Open-PL-style");
4478  }
4479  }
4480  else if (INFILE(_LT_OPENPUBLref)) {
4481  INTERESTING(lDebug ? "Open-PL(ref)" : "Open-PL");
4482  }
4484  /*
4485  * Free Art License
4486  */
4487  if (INFILE(_LT_FREEART_V10)) {
4488  INTERESTING("FAL-1.0");
4489  }
4490  else if (INFILE(_LT_FREEART_V13)) {
4491  INTERESTING("FAL-1.3");
4492  }
4494  /*
4495  * RSA Security, Inc.
4496  */
4497  if (INFILE(_CR_RSA)) {
4498  if (INFILE(_LT_RSA_1)) {
4499  INTERESTING(lDebug ? "RSA(1)" : "RSA-Security");
4500  }
4501  else if (INFILE(_LT_RSA_2)) {
4502  INTERESTING(lDebug ? "RSA(2)" : "RSA-Security");
4503  }
4504  }
4505  else if (INFILE(_LT_RSA_3)) {
4506  INTERESTING(lDebug ? "RSA(3)" : "RSA-Security");
4507  }
4508  else if (INFILE(_LT_RSA_4)) {
4509  INTERESTING(lDebug ? "RSA(4)" : "RSA-Security");
4510  }
4511  else if (INFILE(_LT_RSA_5)) {
4512  INTERESTING(lDebug ? "RSA(5)" : "RSA-DNS");
4513  }
4514  else if (INFILE (_LT_RSA_CRYPTOKI_1) && INFILE(_LT_RSA_CRYPTOKI_2)){
4515  INTERESTING("RSA-Cryptoki");
4516  }
4518  /* Some licenses only deal with fonts */
4519  if (HASTEXT(_TEXT_FONT, 0)) {
4520  /*
4521  * AGFA Monotype
4522  */
4523  if (INFILE(_LT_AGFA)) {
4524  INTERESTING("AGFA.RESTRICTED");
4525  }
4526  else if (INFILE(_LT_AGFA_EULA)) {
4527  INTERESTING("AGFA-EULA");
4528  }
4529  /*
4530  * Bigelow and Holmes
4531  */
4532  if (INFILE(_LT_BH_FONT)) {
4533  if (INFILE(_CR_BH)) {
4534  INTERESTING("BH-Font");
4535  }
4536  else {
4537  INTERESTING("BH-Font-style");
4538  }
4539  }
4541  /*
4542  * BIZNET
4543  */
4544  if (INFILE(_LT_BIZNET)) {
4545  if (INFILE(_CR_BIZNET)) {
4546  INTERESTING("BIZNET");
4547  }
4548  else {
4549  INTERESTING("BIZNET-style");
4550  }
4551  }
4553  /*
4554  * BITSTREAM
4555  */
4556  if (INFILE(_LT_BITSTREAM_1)) {
4557  INTERESTING(lDebug ? "Bitstream(2)" : "Bitstream");
4558  }
4559  else if (INFILE(_LT_BITSTREAM_2)) {
4560  INTERESTING(lDebug ? "Bitstream(3)" : "Bitstream");
4561  }
4563  /*
4564  * Larabie Fonts
4565  */
4566  if (INFILE(_LT_LARABIE_EULA) && INFILE(_TITLE_LARABIE_EULA)) {
4567  INTERESTING("Larabie-EULA");
4568  }
4570  /*
4571  * Baekmuk Fonts and Hwan Design
4572  */
4573  if (INFILE(_LT_BAEKMUK_1)) {
4574  INTERESTING("Baekmuk-Font");
4575  }
4576  else if (INFILE(_LT_BAEKMUK_2)) {
4577  INTERESTING("Baekmuk.Hwan");
4578  }
4580  /*
4581  * Information-Technology Promotion Agency (IPA)
4582  */
4583  if (INFILE(_LT_IPA_EULA)) {
4584  INTERESTING("IPA-Font-EULA");
4585  }
4587  /*
4588  * Arphic Public License
4589  */
4590  if (INFILE(_LT_ARPHIC)) {
4591  if (INFILE(_CR_ARPHIC)) {
4592  INTERESTING("Arphic-Font-PL");
4593  }
4594  else {
4595  INTERESTING("Arphic-style");
4596  }
4597  }
4598  }
4600  /*
4601  * AT&T
4602  */
4603  if (INFILE(_LT_ATT_1)) {
4604  if (INFILE(_CR_ATT)) {
4605  INTERESTING(lDebug ? "ATT(1)" : "ATT");
4606  }
4607  else {
4608  INTERESTING(lDebug ? "ATT-style(1)" : "ATT-style");
4609  }
4610  }
4611  else if (INFILE(_LT_ATT_2)) {
4612  if (!lmem[_fBSD] && INFILE(_CR_BSDCAL)) {
4613  INTERESTING(lDebug ? "BSD(14)" : "BSD");
4614  lmem[_fBSD] = 1;
4615  }
4616  else if (INFILE(_CR_ATT) || INFILE(_CR_LUCENT)) {
4617  INTERESTING(lDebug ? "ATT(2)" : "ATT");
4618  }
4619  else {
4620  INTERESTING(lDebug ? "ATT-style(2)" : "ATT-style");
4621  }
4622  }
4623  else if (INFILE(_LT_ATT_SRC_1) || INFILE(_LT_ATT_SRC_2)) {
4624  if (INFILE(_TITLE_ATT_SRC_12D)) {
4625  INTERESTING("ATT-Source-1.2d");
4626  }
4627  else if (INFILE(_TITLE_ATT_SRC_10)) {
4628  INTERESTING("ATT-Source-1.0");
4629  }
4630  else {
4631  INTERESTING("ATT-Source");
4632  }
4633  }
4634  else if (INFILE(_LT_ATT_NONCOMMERC1) || INFILE(_LT_ATT_NONCOMMERC2)) {
4635  INTERESTING("ATT.Non-commercial");
4636  }
4638  /*
4639  * Silicon Graphics
4640  */
4641  if (INFILE(_TITLE_SGI_V10)) {
4642  INTERESTING("SGI-B-1.0");
4643  }
4644  else if (INFILE(_TITLE_SGI_V11)) {
4645  INTERESTING("SGI-B-1.1");
4646  }
4647  else if (INFILE(_TITLE_SGI_V20)) {
4648  INTERESTING("SGI-B-2.0");
4649  }
4650  else if (INFILE(_LT_SGI_1)) {
4651  if (HASTEXT(_PHR_SGI_LIBTIFF, REG_EXTENDED)) {
4652  INTERESTING("libtiff");
4653  }
4654  else if (HASTEXT(_PHR_LIBTIFF_STYLE, REG_EXTENDED)) {
4655  INTERESTING("libtiff-style");
4656  }
4657  }
4658  else if (INFILE(_LT_SGI_2)) {
4659  if (INFILE(_LT_SGI_V10)) {
4660  INTERESTING("SGI-B-1.0");
4661  }
4662  else if (INFILE(_LT_SGI_V11)) {
4663  INTERESTING("SGI-B-1.1");
4664  }
4665  else if (INFILE(_LT_SGI_V20)) {
4666  INTERESTING("SGI-B-2.0");
4667  }
4668  else if (INFILE(_CR_SGI) || URL_INFILE(_URL_SGI)) {
4669  INTERESTING("SGI");
4670  }
4671  }
4672  else if (INFILE(_LT_SGI_1)) {
4673  if (INFILE(_CR_SGI) || URL_INFILE(_URL_SGI)) {
4674  INTERESTING("SGI-style");
4675  }
4676  }
4677  else if (INFILE(_LT_SGI_FREEW)) {
4678  INTERESTING("SGI-Freeware");
4679  }
4680  else if (INFILE(_LT_SGI_GLX)) {
4681  if (INFILE(_TITLE_SGI_GLX_V10)) {
4682  INTERESTING(lDebug ? "SGI_GLX(1.0)" : "SGI_GLX-1.0");
4683  }
4684  else {
4685  INTERESTING("SGI_GLX");
4686  }
4687  }
4688  else if (INFILE(_LT_SGI_GLXref) && INFILE(_CR_SGI)) {
4689  if (INFILE(_TITLE_SGI_GLX_V10)) {
4690  INTERESTING(lDebug ? "SGI_GLX(10ref)" : "SGI_GLX-1.0");
4691  }
4692  else {
4693  INTERESTING(lDebug ? "SGI_GLX(ref)" : "SGI_GLX");
4694  }
4695  }
4696  else if (INFILE(_LT_SGI_PROPRIETARY) && INFILE(_CR_SGI)) {
4697  INTERESTING("SGI-Proprietary");
4698  }
4700  /*
4701  * 3DFX (Glide)
4702  */
4703  if (INFILE(_CR_3DFX_1) || INFILE(_CR_3DFX_2)) {
4704  if (INFILE(_LT_GLIDE_3DFX)) {
4705  INTERESTING("Glide");
4706  }
4707  else if (INFILE(_LT_GLIDE_GPL)) {
4708  INTERESTING("3DFX-PL");
4709  }
4710  }
4711  /*
4712  * Nvidia Corp
4713  */
4714  else if (INFILE(_LT_NVIDIA_EULA_3)) {
4715  INTERESTING(lDebug ? "Nvidia(1)" : "Nvidia-EULA-a");
4716  }
4717  else if (INFILE(_CR_NVIDIA) && INFILE(_LT_NVIDIA)) {
4718  INTERESTING(lDebug ? "Nvidia(2)" : "Nvidia");
4719  }
4720  else if (INFILE(_LT_NVIDIA_EULA_2)) {
4721  INTERESTING(lDebug ? "Nvidia(3)" : "Nvidia-EULA-b");
4722  }
4723  else if (INFILE(_LT_NVIDIA_EULA_1) || INFILE(_TITLE_NVIDIA)) {
4724  INTERESTING(lDebug ? "Nvidia(4)" : "Nvidia-EULA-b");
4725  }
4726  /*
4727  * ATI Corp
4728  */
4729  else if (INFILE(_TITLE_ATI_EULA) && INFILE(_LT_ATI_EULA)) {
4730  INTERESTING("ATI-EULA");
4731  }
4732  /*
4733  * Agere Systems
4734  */
4735  else if (INFILE(_TITLE_AGERE_EULA) && INFILE(_LT_AGERE_EULA)) {
4736  INTERESTING("Agere-EULA");
4737  }
4739  /*
4740  * KD Tools, AB
4741  */
4742  if (INFILE(_TITLE_KDAB_EULA)) {
4743  if (INFILE(_LT_KDAB_1)) {
4744  INTERESTING(lDebug ? "KDAB(1)" : "KD-Tools-EULA");
4745  }
4746  if (INFILE(_LT_KDAB_2)) {
4747  INTERESTING(lDebug ? "KDAB(2)" : "KD-Tools-EULA");
4748  }
4749  }
4751  /*
4752  * KDE
4753  */
4754  if (INFILE(_PHR_KDE_FILE) && INFILE(_LT_KDE)) {
4755  INTERESTING("KDE");
4756  }
4758  /*
4759  * Broadcom
4760  */
4761  if (INFILE(_LT_BROADCOM_EULA) && INFILE(_CR_BROADCOM)) {
4762  INTERESTING("Broadcom-EULA");
4763  }
4765  /*
4766  * DARPA (Defense Advanved Research Projects Agency)
4767  */
4768  if (INFILE(_LT_DARPA_COUGAAR)) {
4769  INTERESTING("DARPA-Cougaar");
4770  }
4771  else if (INFILE(_LT_DARPA)) {
4772  INTERESTING("DARPA");
4773  }
4775  /*
4776  * Tektronix
4777  */
4778  if (INFILE(_LT_TEKTRONIX)) {
4779  if (INFILE(_CR_TEKTRONIX)) {
4780  INTERESTING("Tektronix");
4781  }
4782  else {
4783  INTERESTING("Tektronix-style");
4784  }
4785  }
4787  /*
4788  * Open Market, Inc
4789  */
4790  if (INFILE(_LT_CADENCE) && INFILE(_CR_CADENCE)) {
4791  INTERESTING("Cadence");
4792  }
4794  /*
4795  * Open Market, Inc
4796  */
4797  if (INFILE(_LT_OPENMKT)) {
4798  INTERESTING("OpenMarket");
4799  }
4801  /*
4802  * Unicode
4803  */
4804  if (!lmem[_fUNICODE]) {
4805  if (INFILE(_TITLE_UNICODE)) {
4806  INTERESTING(lDebug ? "Unicode(4)" : "Unicode");
4807  }
4808  else if (INFILE(_LT_UNICODE_1) && INFILE(_CR_UNICODE)) {
4809  INTERESTING(lDebug ? "Unicode(1)" : "Unicode");
4810  }
4811  else if (INFILE(_LT_UNICODE_2)) {
4812  INTERESTING(lDebug ? "Unicode(2)" : "Unicode");
4813  }
4814  else if (INFILE(_LT_UNICODE_3)) {
4815  INTERESTING(lDebug ? "Unicode(3)" : "Unicode");
4816  }
4817  else if (INFILE(_LT_UNICODE_4)) {
4818  INTERESTING(lDebug ? "Unicode(4)" : "Unicode-TOU");
4819  }
4820  else if (URL_INFILE(_URL_UNICODE)) {
4821  INTERESTING(lDebug ? "Unicode(5)" : "Unicode-TOU");
4822  }
4823  else if (INFILE(_TITLE_UNICODE_TOU) && INFILE(_LT_UNICODE_TOU)) {
4824  INTERESTING("Unicode-TOU");
4825  }
4827  }
4828  /*
4829  * Software Research Assoc
4830  */
4831  if (INFILE(_LT_SRA) && INFILE(_CR_SRA)) {
4832  INTERESTING("SW-Research");
4833  }
4835  /*
4836  * MITRE Collaborative Virtual Workspace (CVW) License
4837  */
4838  if (INFILE(_LT_MITRE_1)) {
4839  if (INFILE(_CR_MITRE)) {
4840  INTERESTING(lDebug ? "MitreCVW(1)" : "MitreCVW");
4841  }
4842  else if (INFILE(_TITLE_CVW)) {
4843  INTERESTING(lDebug ? "MitreCVW(2)" : "MitreCVW");
4844  }
4845  else {
4846  INTERESTING("MitreCVW-style");
4847  }
4848  }
4849  else if (INFILE(_LT_MITRE_2)) {
4850  INTERESTING(lDebug ? "Mitre(2)" : "Mitre");
4851  }
4853  /*
4854  * Jabber, Motosoto
4855  */
4856  if (INFILE(_LT_JABBER_1)) {
4857  if (INFILE(_TITLE_MOTOSOTO091)) {
4858  INTERESTING("Motosoto");
4859  }
4860  else if (INFILE(_TITLE_JABBER)) {
4861  INTERESTING("Jabber");
4862  }
4863  }
4864  else if (INFILE(_LT_JABBER_2)) {
4865  if (INFILE(_TITLE_JABBER_V10)) {
4866  INTERESTING(lDebug ? "Jabber(1.0)" : "Jabber-1.0");
4867  }
4868  else {
4869  INTERESTING(lDebug ? "Jabber(2)" : "Jabber");
4870  }
4871  }
4872  else if (URL_INFILE(_URL_JABBER)) {
4873  INTERESTING(lDebug ? "Jabber(url)" : "Jabber");
4874  }
4876  /*
4877  * CPL, Lucent Public License, Eclipse PL
4878  */
4879  int _epl = 0;
4880  if (INFILE(_LT_CPL_1) || INFILE(_LT_CPL_2)) {
4881  if (INFILE(_TITLE_IBM_PL20)) {
4882  INTERESTING("IPL-2.0");
4883  }
4884  else if (INFILE(_TITLE_IBM_PL10)) {
4885  INTERESTING("IPL-1.0");
4886  }
4887  else if (INFILE(_TITLE_IBM_PL)) {
4888  INTERESTING("IPL");
4889  }
4890  else if (INFILE(_TITLE_OpenGroup)) {
4891  INTERESTING("OpenGroup");
4892  }
4893  else if (INFILE(_TITLE_EPL10)) {
4894  INTERESTING(lDebug ? "Eclipse(v.0#1)" : "EPL-1.0");
4895  _epl = 1;
4896  }
4897  else if (INFILE(_TITLE_EPL20)) {
4898  INTERESTING(lDebug ? "Eclipse(v.2#1)" : "EPL-2.0");
4899  _epl = 1;
4900  }
4901  else if (INFILE(_TITLE_EPL) && NOT_INFILE(_TITLE_EPL_IGNORE)) {
4902  INTERESTING(lDebug ? "Eclipse(#1)" : "EPL");
4903  _epl = 1;
4904  }
4905  else if (INFILE(_TITLE_LUCENT102)) {
4906  INTERESTING("LPL-1.02");
4907  }
4908  else if (INFILE(_TITLE_LUCENT10)) {
4909  INTERESTING("LPL-1.0");
4910  }
4911  else if (NOT_INFILE(_LT_CA)) {
4912  cp = CPLVERS();
4913  INTERESTING(lDebug ? "CPL(#1)" : cp);
4914  }
4915  }
4916  else if (INFILE(_LT_LPL_102)) {
4917  INTERESTING("LPL-1.02");
4918  }
4919  else if (!lmem[_fREAL] && INFILE(_LT_CPLref1) && NOT_INFILE(_TITLE_EPL10)) {
4920  cp = CPLVERS();
4921  INTERESTING(lDebug ? "CPL(ref)" : cp);
4922  }
4923  else if (URL_INFILE(_URL_CPL)) {
4924  cp = CPLVERS();
4925  INTERESTING(lDebug ? "CPL(url)" : cp);
4926  }
4927  else if (INFILE(_PHR_CPL_05)) {
4928  INTERESTING(lDebug ? "CPL(0.5)" : "CPL-0.5");
4929  }
4930  else if (INFILE(_PHR_CPL_10)) {
4931  INTERESTING(lDebug ? "CPL(0.5)" : "CPL-1.0");
4932  }
4933  else if (INFILE(_LT_IBM_PLref1)) {
4934  INTERESTING(lDebug ? "IBM-PL(ref)" : "IPL");
4935  }
4936  else if (URL_INFILE(_URL_IBM_PL)) {
4937  INTERESTING(lDebug ? "IBM-PL(url)" : "IPL");
4938  }
4940  /* More EPL cases */
4941  if (!_epl) {
4942  if (INFILE(_LT_EPL20ref_1)) {
4943  INTERESTING(lDebug ? "Eclipse(ref#2)" : "EPL-2.0");
4944  }
4945  else if (INFILE(_LT_EPL10ref_1) || INFILE(_LT_EPL10ref_2) || HASTEXT(_LT_EPL10ref_3, REG_EXTENDED)) {
4946  INTERESTING(lDebug ? "Eclipse(ref#2)" : "EPL-1.0");
4947  }
4948  else if (INFILE(_LT_EPLref)) {
4949  if (INFILE(_TITLE_EPL10)) {
4950  INTERESTING(lDebug ? "Eclipse(v.0#2)" : "EPL-1.0");
4951  }
4952  else if (INFILE(_TITLE_EPL20)) {
4953  INTERESTING(lDebug ? "Eclipse(v.2#2)" : "EPL-2.0");
4954  }
4955  else {
4956  INTERESTING(lDebug ? "Eclipse(#2)" : "EPL");
4957  }
4958  }
4959  else if (INFILE(_LT_EPL10ref_1)) {
4960  INTERESTING(lDebug ? "Eclipse(ref#2)" : "EPL-1.0");
4961  }
4962  else if (INFILE(_LT_EPL) && NOT_INFILE(_TITLE_EPL_IGNORE)) {
4963  if (INFILE(_TITLE_EPL10ref_1)) {
4964  INTERESTING(lDebug ? "Eclipse(v1.0#2)" : "EPL-1.0");
4965  }
4966  if (INFILE(_TITLE_EPL20ref_1)) {
4967  INTERESTING(lDebug ? "Eclipse(v1.0#2)" : "EPL-2.0");
4968  }
4969  }
4970  }
4972  /*
4973  * SyBase/Watcom
4974  */
4975  if (INFILE(_LT_SYBASE)) {
4976  if (INFILE(_TITLE_SYBASE10)) {
4977  INTERESTING("Watcom-1.0");
4978  }
4979  else {
4980  INTERESTING("Watcom");
4981  }
4982  }
4984  /*
4985  * Ricoh
4986  */
4987  if (INFILE(_LT_RICOH)) {
4988  if (INFILE(_TITLE_RICOH10)) {
4989  INTERESTING("RSCPL");
4990  }
4991  }
4993  /*
4994  * OCLC
4995  */
4996  if (INFILE(_LT_OCLC)) {
4997  if (INFILE(_TITLE_OCLC20)) {
4998  INTERESTING("OCLC-2.0");
4999  }
5000  else if (INFILE(_TITLE_OCLC10)) {
5001  INTERESTING("OCLC-1.0");
5002  }
5003  else {
5004  INTERESTING("OCLC");
5005  }
5006  }
5008  /*
5009  * Educational Community License
5010  */
5011  if (INFILE(_LT_ECL1)) {
5012  INTERESTING("ECL-1.0");
5013  lmem[_mMIT] = 1;
5014  }
5015  else if (INFILE(_LT_ECL2)) {
5016  INTERESTING("ECL-2.0");
5017  lmem[_mMIT] = 1;
5018  }
5019  else if (INFILE(_LT_ECL)) {
5020  INTERESTING(lDebug ? "ECL(1)" : "ECL-1.0");
5021  lmem[_mMIT] = 1;
5022  }
5024  /*
5025  * EU DataGrid and Condor PL
5026  */
5027  if (INFILE(_LT_EU)) {
5028  if (INFILE(_TITLE_CONDOR_V10)) {
5029  INTERESTING("Condor-1.0");
5030  } else if (INFILE(_TITLE_CONDOR_V11)) {
5031  INTERESTING("Condor-1.1");
5032  }
5033  else {
5034  INTERESTING("EUDatagrid");
5035  }
5036  }
5037  else if (URL_INFILE(_URL_EUDatagrid)) {
5038  INTERESTING("EUDatagrid");
5039  }
5041  /*
5042  * Adaptive Public License
5043  */
5044  if (INFILE(_LT_ADAPTIVE)) {
5045  if (INFILE(_TITLE_ADAPTIVE10)) {
5046  INTERESTING("APL-1.0");
5047  }
5048  else {
5049  INTERESTING("APL");
5050  }
5051  lmem[_fAPL] = 1;
5052  }
5054  /*
5055  * gSOAP Public License
5056  */
5057  if (!lmem[_mGSOAP] && INFILE(_LT_GSOAPref13)) {
5058  INTERESTING("gSOAP-1.3b");
5059  }
5060  else if (!lmem[_mGSOAP] && INFILE(_LT_GSOAPref)) {
5061  INTERESTING("gSOAP");
5062  }
5064  /*
5065  * Computer Associates
5066  */
5067  if (INFILE(_LT_CA)) {
5068  if (INFILE(_TITLE_CA11)) {
5069  INTERESTING("CATOSL-1.1");
5070  }
5071  else {
5072  INTERESTING("CA");
5073  }
5074  }
5075  else if (INFILE(_TITLE_CA)) {
5076  INTERESTING("CATOSL");
5077  }
5079  /*
5080  * Frameworx
5081  */
5082  if (INFILE(_LT_FRAMEWORX)) {
5083  if (INFILE(_TITLE_FRAMEWORX10)) {
5084  INTERESTING("Frameworx-1.0");
5085  }
5086  else {
5087  INTERESTING("Frameworx");
5088  }
5089  }
5091  /*
5092  * NASA
5093  */
5094  if (INFILE(_LT_NASA)) {
5095  if (INFILE(_TITLE_NASA13)) {
5096  INTERESTING("NASA-1.3");
5097  }
5098  else {
5099  INTERESTING("NASA");
5100  }
5101  }
5103  /*
5104  * Freetype
5105  */
5106  if (INFILE(_LT_FREETYPE)) {
5107  if (INFILE(_TITLE_CATHARON)) {
5108  INTERESTING(lDebug ? "Catharon(1)" : "Catharon");
5109  }
5110  else if (INFILE(_CR_CATHARON)) {
5111  INTERESTING(lDebug ? "Catharon(2)" : "Catharon");
5112  }
5113  else if (INFILE(_TITLE_FREETYPE)) {
5114  INTERESTING("FTL");
5115  }
5116  else {
5117  INTERESTING("FTL-style");
5118  }
5119  }
5120  else if (INFILE(_LT_FTL)) {
5121  INTERESTING("FTL");
5122  }
5123  else if (INFILE(_TITLE_FTL)|| INFILE(_SPDX_FTL)) {
5124  INTERESTING("FTL");
5125  }
5126  else if (INFILE(_LT_CATHARON)) {
5127  INTERESTING(lDebug ? "Catharon(3)" : "Catharon");
5128  }
5129  else if (INFILE(_LT_FREETYPEref)) {
5130  INTERESTING(lDebug ? "FTL(ref)" : "FTL");
5131  }
5133  /*
5134  * Eiffel Forum License
5135  */
5136  if (INFILE(_LT_EIFFEL)) {
5137  if (INFILE(_TITLE_EIFFEL2)) {
5138  INTERESTING("EFL-2.0");
5139  }
5140  else if (INFILE(_TITLE_EIFFEL1)) {
5141  INTERESTING("EFL-1.0");
5142  }
5143  else {
5144  INTERESTING("EFL");
5145  }
5146  }
5147  else if (INFILE(_LT_EIFFEL_20)) {
5148  INTERESTING("EFL-2.0");
5149  }
5150  else if (INFILE(_LT_EIFFEL_1)) {
5151  INTERESTING("EFL");
5152  }
5154  /*
5155  * BISON, Nethack, etc.
5156  */
5157  if (!lmem[_fGPL] && (INFILE(_LT_BISON) || INFILE(_LT_BISONref))) {
5158  if (INFILE(_TITLE_NETHACK)) {
5159  INTERESTING("NGPL");
5160  }
5161  else {
5162  INTERESTING("BISON");
5163  }
5164  }
5166  /*
5167  * Open Software License (OSL) and Academic Free License (AFL) are similar
5168  */
5169  if (INFILE(_LT_OSL_BAD)) {
5170  cp = (INFILE(_TITLE_AFL) ? AFLVERS() : OSLVERS());
5171  INTERESTING(lDebug? "OSL(bad)" : cp);
5172  }
5173  else if (INFILE(_LT_OSLref1)) {
5174  cp = OSLVERS();
5175  INTERESTING(lDebug? "OSL(ref1)" : cp);
5176  }
5177  else if (INFILE(_LT_OSLref2)) {
5178  cp = OSLVERS();
5179  INTERESTING(lDebug? "OSL(ref2)" : cp);
5180  }
5181  else if (INFILE(_LT_AFL)) {
5182  cp = (INFILE(_TITLE_AFL) ? AFLVERS() : OSLVERS());
5183  INTERESTING(lDebug? "AFL#1" : cp);
5184  }
5185  else if (INFILE(_TITLE_OSL21) && NOT_INFILE(_TITLE_OSL21_EXHIBIT)) {
5186  cp = OSLVERS();
5187  INTERESTING(lDebug? "OSL(T2.1)" : cp);
5188  }
5189  else if (INFILE(_TITLE_AFL21)) {
5190  cp = AFLVERS();
5191  INTERESTING(lDebug? "AFL(T2.1)" : cp);
5192  }
5193  else if (INFILE(_TITLE_OSL30) && NOT_INFILE(_TITLE_OSL30_EXHIBIT)) {
5194  cp = OSLVERS();
5195  INTERESTING(lDebug? "OSL(T3.0)" : cp);
5196  }
5197  else if (INFILE(_TITLE_AFL30)) {
5198  cp = AFLVERS();
5199  INTERESTING(lDebug? "AFL(T3.0)" : cp);
5200  }
5201  else if (URL_INFILE(_URL_OSL11)) {
5202  INTERESTING(lDebug ? "OSL_v1.1(url)" : "OSL-1.1");
5203  }
5204  else if (URL_INFILE(_URL_OSL)) {
5205  INTERESTING(lDebug ? "OSL(url)" : "OSL");
5206  }
5207  else if (URL_INFILE(_URL_AFL)) {
5208  INTERESTING(lDebug ? "AFL(url)" : "AFL");
5209  }
5211  /*
5212  * There are occasions where something is licensed under *either* AFL
5213  * or OSL, so don't keep AFL-refs in the if-then-else-if chain here.
5214  */
5215  if (INFILE(_LT_AFLref1)) {
5216  cp = AFLVERS();
5217  INTERESTING(lDebug? "AFL(ref1)" : cp);
5218  }
5219  else if (INFILE(_LT_AFLref2)) {
5220  cp = AFLVERS();
5221  INTERESTING(lDebug? "AFL(ref2)" : cp);
5222  }
5224  /*
5225  * Inner Net license
5226  */
5227  if (INFILE(_LT_INNERNET)) {
5228  if (INFILE(_TITLE_INNERNET200)) {
5229  INTERESTING("InnerNet-2.00");
5230  }
5231  else if (HASTEXT(_TEXT_INNERNET, 0)) {
5232  INTERESTING("InnerNet");
5233  }
5234  else {
5235  INTERESTING("InnerNet-style");
5236  }
5237  }
5238  else if (INFILE(_LT_INNERNETref_V2)) {
5239  INTERESTING(lDebug ? "InnetNet(v2ref)" : "InnerNet-2.00");
5240  }
5242  /*
5243  * Open Government Licence
5244  */
5245  if (INFILE(_TITLE_OGL_UK)) {
5246  if (INFILE(_TITLE_OGL_UK_10)) {
5247  INTERESTING("OGL-UK-1.0");
5248  }
5249  else if (INFILE(_TITLE_OGL_UK_20)) {
5250  INTERESTING("OGL-UK-2.0");
5251  }
5252  else if (INFILE(_TITLE_OGL_UK_30)) {
5253  INTERESTING("OGL-UK-3.0");
5254  }
5255  /* Full OGL license texts have reference to Creative Commons */
5256  if (HASTEXT(_LT_CC_ref, REG_EXTENDED)) {
5257  lmem[_fCCBY] = 1;
5258  }
5259  }
5261  /*
5262  * Creative Commons Public License, Mindterm, and the Reciprocal PL
5263  */
5264  if (!lmem[_fCCBY] && HASTEXT(_LT_CC_ref, REG_EXTENDED)) {
5265  cp = CCVERS();
5266  INTERESTING(lDebug ? "CC(ref)" : cp);
5267  }
5268  else if (INFILE(_LT_CCPL)) {
5269  if (INFILE(_LT_RECIP_1) || INFILE(_LT_RECIP_2)) {
5270  if (INFILE(_TITLE_RPL15)) {
5271  INTERESTING(lDebug ? "RPL-1.5#1" : "RPL-1.5");
5272  }
5273  else if (INFILE(_TITLE_RPL11)) {
5274  INTERESTING(lDebug ? "RPL-1.1#1" : "RPL-1.1");
5275  }
5276  else if (INFILE(_TITLE_RPL10)) {
5277  INTERESTING(lDebug ? "RPL-1.0#1" : "RPL-1.0");
5278  }
5279  else {
5280  INTERESTING(lDebug ? "RPL#1" : "RPL");
5281  }
5282  }
5283  }
5284  else if (INFILE(_LT_RECIP15)) {
5285  INTERESTING("RPL-1.5");
5286  }
5287  else if (INFILE(_TITLE_MINDTERM)) {
5288  INTERESTING("MindTerm");
5289  }
5290  else if (INFILE(_LT_RECIP_1) || INFILE(_LT_RECIP_2)) {
5291  if (INFILE(_TITLE_RPL15)) {
5292  INTERESTING(lDebug ? "RPL-1.5#2" : "RPL-1.5");
5293  }
5294  else if (INFILE(_TITLE_RPL11)) {
5295  INTERESTING(lDebug ? "RPL-1.1#2" : "RPL-1.1");
5296  }
5297  else if (INFILE(_TITLE_RPL10)) {
5298  INTERESTING(lDebug ? "RPL-1.0#2" : "RPL-1.0");
5299  }
5300  else {
5301  INTERESTING(lDebug ? "RPL#2" : "RPL");
5302  }
5303  }
5304  /*
5305  * For some reason license text strings were defined for few
5306  * Creative Commons licenses.
5307  */
5308  else if (INFILE(_LT_CC_BY_SA_30)) {
5309  INTERESTING("CC-BY-SA-3.0");
5310  }
5311  else if (INFILE(_LT_CC_BY_SA_25)) {
5312  INTERESTING("CC-BY-SA-2.5");
5313  }
5314  else if (INFILE(_LT_CC_BY_NC_30)) {
5315  INTERESTING("CC-BY-NC-3.0");
5316  }
5317  else if (INFILE(_LT_CC_BY_ND_30)) {
5318  INTERESTING("CC-BY-ND-3.0");
5319  }
5321  if (URL_INFILE(_URL_RPL)) {
5322  INTERESTING(lDebug ? "RPL(url)" : "RPL");
5323  }
5324  else if (URL_INFILE(_URL_CCLGPL)) {
5325  cp = LGPLVERS();
5326  INTERESTING(lDebug ? "CC-LGPL(url)" : cp);
5327  }
5328  else if (URL_INFILE(_URL_CCGPL)) {
5329  cp = GPLVERS();
5330  INTERESTING(lDebug ? "CC-GPL(url)" : cp);
5331  }
5333  /*
5334  * SpikeSource
5335  */
5336  if (INFILE(_CR_SPIKESOURCE) && INFILE(_LT_SPIKESOURCE)) {
5337  INTERESTING("SpikeSource");
5338  }
5340  /*
5341  * Legato systems
5342  */
5343  if (INFILE(_LT_LEGATO_1) || INFILE(_LT_LEGATO_2)) {
5344  INTERESTING("Legato");
5345  }
5347  /*
5348  * Paradigm associates
5349  */
5350  if (INFILE(_LT_PARADIGM) && INFILE(_CR_PARADIGM)) {
5351  INTERESTING("Paradigm");
5352  }
5354  /*
5355  * Wintertree Software
5356  */
5357  if (INFILE(_LT_WINTERTREE)) {
5358  INTERESTING("Wintertree");
5359  }
5361  /*
5362  * Genivia
5363  */
5364  if (INFILE(_LT_GENIVIAref)) {
5365  INTERESTING("Genivia.Commercial");
5366  }
5368  /*
5369  * Open Directory License
5370  */
5371  if (INFILE(_LT_ODL)) {
5372  INTERESTING("ODL");
5373  }
5375  /*
5376  * Open Directory License
5377  */
5378  if (INFILE(_LT_OSD)) {
5379  INTERESTING("OSD");
5380  }
5382  /*
5383  * Zveno
5384  */
5385  if (INFILE(_LT_ZVENO) && INFILE(_CR_ZVENO)) {
5386  INTERESTING("Zveno");
5387  }
5389  /*
5390  * Brainstorm
5391  */
5392  if (INFILE(_LT_BRAINSTORM_EULA) && INFILE(_TITLE_BRAINSTORM_EULA)) {
5393  INTERESTING("BrainStorm-EULA");
5394  }
5396  /*
5397  * AOL
5398  */
5399  if (INFILE(_LT_AOL_EULA)) {
5400  INTERESTING("AOL-EULA");
5401  }
5403  /*
5404  * Algorithmics
5405  */
5406  if (INFILE(_LT_ALGORITHMICS)) {
5407  INTERESTING("Algorithmics");
5408  }
5410  /*
5411  * Pixware
5412  */
5413  if (INFILE(_LT_PIXWARE_EULA)) {
5414  INTERESTING("Pixware-EULA");
5415  }
5417  /*
5418  * Compuserve
5419  */
5420  if (HASTEXT(_TEXT_COMPUSERVE, 0) && INFILE(_LT_COMPUSERVE)) {
5421  INTERESTING("CompuServe");
5422  }
5424  /*
5425  * Advanved Micro Devices (AMD)
5426  */
5427  if (INFILE(_CR_AMD) && INFILE(_LT_AMD)) {
5428  INTERESTING("AMD");
5429  }
5430  else if (INFILE(_LT_AMD_EULA) && INFILE(_TITLE_AMD_EULA)) {
5431  INTERESTING("AMD-EULA");
5432  }
5434  /*
5435  * OMRON Corp
5436  */
5437  if ((INFILE(_CR_OMRON_1) || INFILE(_CR_OMRON_2)) &&
5438  (INFILE(_LT_OMRON1) || INFILE(_LT_OMRON2))) {
5439  INTERESTING(lDebug ? "OMRON(2)" : "OMRON");
5440  }
5442  /*
5443  * MetroLink
5444  */
5445  if (INFILE(_TITLE_METROLINK)) {
5446  if (INFILE(_LT_METRO)) {
5447  if (INFILE(_LT_METRO_NONFREE)) {
5448  INTERESTING("MetroLink-nonfree");
5449  }
5450  else {
5451  INTERESTING("MetroLink");
5452  }
5453  }
5454  }
5455  else if (INFILE(_LT_METROLINKref)) {
5456  INTERESTING(lDebug ? "MetroLink(ref)" : "MetroLink");
5457  }
5459  /*
5460  * University of Edinburgh (and a CMU derivative)
5461  */
5462  if (INFILE(_LT_EDINBURGH_1)) {
5463  if (mCR_CMU()) {
5464  INTERESTING(lDebug ? "CMU(3)" : "CMU");
5465  lmem[_mCMU] = 1;
5466  }
5467  else if (mCR_EDIN()) {
5468  INTERESTING(lDebug ? "U-Edinburgh(1)" : "U-Edinburgh");
5469  }
5470  else {
5471  INTERESTING(lDebug ? "UE-style(1)" : "U-Edinburgh-style");
5472  }
5473  }
5474  else if (INFILE(_LT_EDINBURGH_2)) {
5475  if (mCR_EDIN()) {
5476  INTERESTING(lDebug ? "U-Edinburgh(2)" : "U-Edinburgh");
5477  }
5478  else {
5479  INTERESTING(lDebug ? "UE-style(2)" : "U-Edinburgh-style");
5480  }
5481  }
5483  /*
5484  * Older CMU (including the weird "fnord" text) licenses.
5485  * Note that SPDX listed MIT-CMU license is detected earlier.
5486  */
5487  if (!lmem[_mCMU] && INFILE(_LT_CMU_1)) {
5488  if (!lmem[_mREDHAT] && INFILE(_CR_REDHAT)) {
5489  INTERESTING(lDebug ? "RH(5)" : "RedHat");
5490  lmem[_mREDHAT] = 1;
5491  }
5492  else if (INFILE(_CR_NRL)) {
5493  INTERESTING("NRL");
5494  }
5495  else if (!lmem[_mCMU] && mCR_CMU()) {
5496  INTERESTING(lDebug ? "CMU(5)" : "CMU");
5497  lmem[_mCMU] = 1;
5498  }
5499  else {
5500  INTERESTING("CMU-style");
5501  lmem[_mCMU] = 1;
5502  }
5503  }
5504  else if (!lmem[_mCMU] && INFILE(_LT_CMU_2) && mCR_CMU()) {
5505  INTERESTING(lDebug ? "CMU(6)" : "CMU");
5506  lmem[_mCMU] = 1;
5507  }
5508  else if (INFILE(_LT_CMU_3)) {
5509  INTERESTING(lDebug ? "CMU(7)" : "CMU");
5510  lmem[_mCMU] = 1;
5511  }
5512  else if (INFILE(_LT_CMU_4)) {
5513  INTERESTING(lDebug ? "CMU(8)" : "CMU");
5514  lmem[_mCMU] = 1;
5515  }
5516  else if (INFILE(_LT_CMU_5)) {
5517  INTERESTING(lDebug ? "CMU(9)" : "CMU");
5518  lmem[_mCMU] = 1;
5519  }
5520  else if (INFILE(_LT_CMU_6)) {
5521  INTERESTING(lDebug ? "CMU(10)" : "CMU");
5522  lmem[_mCMU] = 1;
5523  }
5525  /*
5526  * University of Chicago
5527  */
5528  if (INFILE(_CR_UCHICAGO) && INFILE(_LT_UCHICAGO)) {
5529  INTERESTING("U-Chicago");
5530  }
5532  /*
5533  * University of Utah
5534  */
5535  if (INFILE(_CR_UUTAH) && INFILE(_LT_UUTAH)) {
5536  INTERESTING("U-Utah");
5537  }
5539  /*
5540  * University of British Columbia
5541  */
5542  if (INFILE(_CR_UBC) && INFILE(_LT_UBC)) {
5543  INTERESTING("U-BC");
5544  }
5546  /*
5547  * ImageMagick Studios - DON'T RECALL THE TEXT FOR THIS LICENSE!
5548  */
5549  if (INFILE(_LT_IMAGEMAGICK)) {
5550  if (INFILE(_CR_IMAGEMAGICK)) {
5551  INTERESTING("ImageMagick");
5552  }
5553  else {
5554  INTERESTING("ImageMagick-style");
5555  }
5556  }
5557  else if (URL_INFILE(_URL_IMAGEMAGICK)) {
5558  INTERESTING(lDebug ? "ImageMagick(url)" : "ImageMagick");
5559  }
5561  /*
5562  * Riverbank
5563  */
5564  if (INFILE(_LT_RIVERBANK) && INFILE(_TITLE_RIVERBANK_EULA)) {
5565  INTERESTING("Riverbank-EULA");
5566  }
5568  /*
5569  * Polyserve
5570  */
5571  if (INFILE(_CR_POLYSERVE) && INFILE(_LT_POLYSERVE)) {
5572  INTERESTING("Polyserve-CONFIDENTIAL");
5573  }
5575  /*
5576  * Fujitsu Limited
5577  */
5578  if (INFILE(_CR_FUJITSU) && INFILE(_LT_FUJITSU)) {
5579  INTERESTING("Fujitsu");
5580  }
5582  /*
5583  * Cypress Semiconductor
5584  */
5585  if (INFILE(_CR_CYPRESS) && INFILE(_LT_CYPRESS)) {
5586  INTERESTING("Cypress-FW");
5587  }
5588  /*
5589  * Keyspan
5590  */
5591  else if (INFILE(_CR_KEYSPAN) && INFILE(_LT_KEYSPAN)) {
5592  INTERESTING("Keyspan-FW");
5593  }
5594  /*
5595  * ATMEL
5596  */
5597  else if (INFILE(_CR_ATMEL) && INFILE(_LT_ATMEL)) {
5598  INTERESTING("ATMEL-FW");
5599  }
5601  /*
5602  * Quest Software
5603  */
5604  if (INFILE(_LT_QUEST_EULA) && INFILE(_TITLE_QUEST_EULA)) {
5605  INTERESTING("Quest-EULA");
5606  }
5608  /*
5609  * International Organization for Standarization
5610  */
5611  if (INFILE(_LT_IOS) && INFILE(_CR_IOS)) {
5612  INTERESTING("IOS");
5613  }
5615  /*
5616  * Garmin Ltd.
5617  */
5618  if (INFILE(_LT_GARMIN_EULA) && INFILE(_TITLE_GARMIN_EULA)) {
5619  INTERESTING("Garmin-EULA");
5620  }
5622  /*
5623  * AVM GmbH
5624  */
5625  if (INFILE(_CR_AVM)) {
5626  if (INFILE(_LT_AVM_1)) {
5627  INTERESTING(lDebug ? "AVM(1)" : "AVM");
5628  }
5629  else if (INFILE(_LT_AVM_2)) {
5630  INTERESTING(lDebug ? "AVM(2)" : "AVM");
5631  }
5632  }
5633  else if (INFILE(_LT_AVM_3)) {
5634  INTERESTING(lDebug ? "AVM(3)" : "AVM");
5635  }
5637  /*
5638  * Fair license
5639  */
5640  if (INFILE(_LT_FAIR)) {
5641  if (INFILE(_TITLE_FAIR)) {
5642  INTERESTING("Fair");
5643  }
5644  else {
5645  INTERESTING("Fair-style");
5646  }
5647  }
5649  /*
5650  * GCA (Majordomo)
5651  */
5652  if (INFILE(_LT_GCA)) {
5653  if (INFILE(_TITLE_MAJORDOMO11)) {
5654  INTERESTING("Majordomo-1.1");
5655  }
5656  else {
5657  INTERESTING("Majordomo");
5658  }
5659  }
5661  /*
5662  * Zeus Technology -- this one is kind of a corner-case since the wording
5663  * is VERY general. If there's a Zeus copyright with the license text,
5664  * spell it out; else, look for the same text in the "generic" section.
5665  */
5666  if (INFILE(_CR_ZEUS) && INFILE(_LT_ZEUS)) {
5667  INTERESTING("Zeus");
5668  }
5670  /*
5671  * Information-technology promotion agency
5672  */
5673  if (!lmem[_mXOPEN] && INFILE(_LT_XOPEN_1)) {
5674  if (!lmem[_mOSF] && INFILE(_CR_OSF)) {
5675  INTERESTING(lDebug ? "OSF(2)" : "OSF");
5676  lmem[_mOSF] = 1;
5677  }
5678  else if (INFILE(_CR_UI)) {
5679  INTERESTING(lDebug ? "UI(2)" : "Unix-Intl");
5680  }
5681  else if (INFILE(_CR_XOPEN)) {
5682  INTERESTING(lDebug ? "XOpen(2)" : "X/Open");
5683  lmem[_mXOPEN] = 1;
5684  }
5685  else if (INFILE(_CR_IPA)) {
5686  INTERESTING("IPA");
5687  }
5688  else if (!lmem[_mSUN] && INFILE(_CR_SUN)) {
5689  INTERESTING(lDebug ? "Sun(10)" : "Sun");
5690  lmem[_mSUN] = 1;
5691  }
5692  else {
5693  INTERESTING("X/Open-style");
5694  }
5695  }
5696  /* This one is funky - it includes part of the copyright */
5697  else if (!lmem[_mXOPEN] && INFILE(_LT_XOPEN_2)) {
5698  INTERESTING(lDebug ? "XOpen(3)" : "X/Open");
5699  lmem[_mXOPEN] = 1;
5700  }
5702  /*
5703  * Interlink networks EULA (seen in HP proprietary code)
5704  */
5705  if (INFILE(_LT_INTERLINK_EULA) && INFILE(_TITLE_INTERLINK_EULA)) {
5706  INTERESTING("Interlink-EULA");
5707  }
5709  /*
5710  * Mellanox Technologies
5711  */
5712  if (INFILE(_LT_MELLANOX) && INFILE(_CR_MELLANOX)) {
5713  INTERESTING("Mellanox");
5714  }
5716  /*
5717  * nCipher Corp
5718  */
5719  if (INFILE(_LT_NCIPHER) && INFILE(_CR_NCIPHER)) {
5720  INTERESTING("nCipher");
5721  }
5723  /*
5724  * Distributed Processing Technology Corp
5725  */
5726  if (INFILE(_CR_DPTC) && INFILE(_LT_DPTC)) {
5727  INTERESTING("DPTC");
5728  }
5729  /*
5730  * Distributed Management Task Force
5731  */
5732  else if (HASTEXT(_TEXT_REPRODUCED, 0) && INFILE(_CR_DMTF) &&
5733  INFILE(_LT_DMTF)) {
5734  INTERESTING("DMTF");
5735  lmem[_fATTRIB] = 1;
5736  }
5738  /*
5739  * DSC Technologies Corp
5740  */
5741  if (INFILE(_CR_DSCT) && INFILE(_LT_DSCT)) {
5742  INTERESTING("DSCT");
5743  }
5745  /*
5746  * Epinions, Inc.
5747  */
5748  if (INFILE(_CR_EPINIONS) && INFILE(_LT_EPINIONS)) {
5749  INTERESTING("Epinions");
5750  }
5752  /*
5753  * MITEM, Ltd
5754  */
5755  if (INFILE(_CR_MITEM) && INFILE(_LT_MITEM)) {
5756  INTERESTING("MITEM");
5757  }
5759  /*
5760  * Cylink corp
5761  */
5762  if ((INFILE(_LT_CYLINK_ISC_1) || INFILE(_LT_CYLINK_ISC_2))) {
5763  INTERESTING("Cylink-ISC");
5764  }
5766  /*
5767  * SciTech software
5768  */
5769  if (INFILE(_CR_SCITECH) && INFILE(_LT_SCITECH)) {
5770  INTERESTING("SciTech");
5771  }
5773  /*
5774  * OReilly and Associates
5775  */
5776  if (INFILE(_LT_OREILLY_1)) {
5777  if (INFILE(_CR_OREILLY)) {
5778  INTERESTING("OReilly");
5779  }
5780  else {
5781  INTERESTING("OReilly-style");
5782  }
5783  }
5784  else if (INFILE(_LT_OREILLY_2)) {
5785  if (INFILE(_CR_OREILLY)) {
5786  INTERESTING(lDebug ? "OReilly-2" : "OReilly");
5787  }
5788  else {
5789  INTERESTING(lDebug ? "OReilly-st-2" : "OReilly-style");
5790  }
5791  }
5793  /*
5794  * Bit-Torrent
5795  */
5796  if (INFILE(_LT_BITTORRENT)) {
5797  if (INFILE(_TITLE_BITTORRENT11)) {
5798  INTERESTING("BitTorrent-1.1");
5799  }
5800  else if (INFILE(_TITLE_BITTORRENT10)) {
5801  INTERESTING("BitTorrent-1.0");
5802  }
5803  else {
5804  INTERESTING("BitTorrent");
5805  }
5806  }
5807  else if (INFILE(_LT_BITTORRENT_V11)) {
5808  INTERESTING("BitTorrent-1.1");
5809  }
5810  else if (INFILE(_LT_BITTORRENT_V10)) {
5811  INTERESTING("BitTorrent-1.0");
5812  }
5813  else if (INFILE(_LT_BITTORRENTref)) {
5814  INTERESTING(lDebug ? "BitTorrent(ref)" : "BitTorrent");
5815  }
5817  /*
5818  * Open Software Foundation
5819  */
5820  if (INFILE(_LT_OSF_1)) {
5821  if (INFILE(_CR_OSF)) {
5822  INTERESTING(lDebug ? "OSF(3)" : "OSF");
5823  lmem[_mOSF] = 1;
5824  }
5825  else {
5826  INTERESTING(lDebug ? "OSF-style(1)" : "OSF-style");
5827  }
5828  }
5829  else if (INFILE(_LT_OSF_2)) {
5830  if (INFILE(_CR_OSF)) {
5831  INTERESTING(lDebug ? "OSF(4)" : "OSF");
5832  lmem[_mOSF] = 1;
5833  }
5834  else if (INFILE(_LT_CMU_8)) {
5835  INTERESTING(lDebug ? "CMU(11)" : "CMU");
5836  }
5837  else {
5838  INTERESTING(lDebug ? "OSF-style(2)" : "OSF-style");
5839  }
5840  }
5842  /*
5843  * OpenLDAP (if not already determined above -- the OpenLDAP public license
5844  * borrows text from LOTS of different sources)
5845  */
5846  if (!lmem[_fBSD] && lmem[_tOPENLDAP] && !lmem[_fOPENLDAP]) {
5847  if (INFILE(_LT_OPENLDAP_1)) {
5848  if (!TRYGROUP(famOPENLDAP)) {
5849  INTERESTING("OLDAP-style");
5850  }
5851  }
5852  else if (INFILE(_LT_OPENLDAP_2)) {
5853  INTERESTING("OLDAP");
5854  }
5855  }
5857  /*
5858  * The Knuth license is sufficiently bizarre enough it belongs down here,
5859  * towards the end of the search
5860  *****
5861  * Lachman Associates - includes a proprietary-to-the-max paragraph
5862  * IoSoft Ltd.
5863  */
5864  if (INFILE(_CR_KNUTH) && INFILE(_LT_KNUTH_1)) {
5865  INTERESTING(lDebug ? "Knuth(1)" : "D.E.Knuth");
5866  }
5867  else if (INFILE(_LT_KNUTH_2)) {
5868  INTERESTING(lDebug ? "Knuth(2)" : "D.E.Knuth");
5869  }
5870  else if (INFILE(_LT_KNUTH_STYLE)) {
5871  INTERESTING("Knuth-style");
5872  }
5873  else if (INFILE(_LT_LACHMAN_SECRET)) {
5874  INTERESTING("Lachman-Proprietary");
5875  }
5876  else if (INFILE(_LT_IOSOFT_SRCONLY)) {
5877  INTERESTING("IoSoft.COMMERCIAL");
5878  }
5880  /*
5881  * The Free Software License
5882  */
5883  if (INFILE(_LT_FREE_SW)) {
5884  INTERESTING("Free-SW");
5885  }
5886  /*
5887  * NOT free software and explicitly free software
5888  */
5889  else if (INFILE(_PHR_NOT_FREE_SW)) {
5890  if (INFILE(_LT_NOT_FREE) && INFILE(_CR_WTI)) {
5891  INTERESTING("WTI.Not-free");
5892  }
5893  else {
5894  INTERESTING("Not-Free");
5895  }
5896  }
5898  /*
5899  * Code Project Open License
5900  */
5901  if (INFILE(_LT_CPOL)) {
5902  if (HASTEXT(_LT_CPOL_V102, REG_EXTENDED)) {
5903  INTERESTING("CPOL-1.02");
5904  } else {
5905  INTERESTING("CPOL");
5906  }
5907  }
5909  /*
5910  * Macrovision
5911  */
5912  if (INFILE(_LT_MACROV_IA) && INFILE(_PHR_MACROVISION)) {
5913  if (INFILE(_PHR_EULA)) {
5914  INTERESTING("Macrovision-EULA");
5915  }
5916  else {
5917  INTERESTING("Macrovision");
5918  }
5919  }
5921  /*
5922  * VMware
5923  */
5924  if (INFILE(_LT_VMWARE) && INFILE(_TITLE_VMWARE)) {
5925  INTERESTING("VMware-EULA");
5926  }
5928  /*
5929  * UCWARE.com
5930  */
5931  if (INFILE(_LT_UCWARE_EULA_1) || INFILE(_LT_UCWARE_EULA_2)) {
5932  INTERESTING("UCWare-EULA");
5933  }
5935  /*
5936  * InfoSeek Corp
5937  */
5938  if (INFILE(_LT_INFOSEEK) && INFILE(_CR_INFOSEEK)) {
5939  INTERESTING("InfoSeek");
5940  }
5942  /*
5943  * Trident Microsystems
5944  */
5945  if (INFILE(_LT_TRIDENT_EULA) && INFILE(_CR_TRIDENT)) {
5946  INTERESTING("Trident-EULA");
5947  }
5949  /*
5950  * ARJ Software Inc
5951  */
5952  if (INFILE(_LT_ARJ) && INFILE(_CR_ARJ)) {
5953  INTERESTING("ARJ");
5954  }
5956  /*
5957  * Piriform Ltd
5958  */
5959  if (INFILE(_LT_PIRIFORM) && INFILE(_CR_PIRIFORM)) {
5960  INTERESTING("Piriform");
5961  }
5963  /*
5964  * Design Science License (DSL)
5965  */
5966  if (INFILE(_LT_DSL)) {
5967  INTERESTING("DSL");
5968  }
5970  /*
5971  * Skype
5972  */
5973  if (INFILE(_TITLE_SKYPE) && INFILE(_LT_SKYPE)) {
5974  INTERESTING("Skype-EULA");
5975  }
5977  /*
5978  * Hauppauge
5979  */
5980  if (INFILE(_LT_HAUPPAUGE)) {
5981  INTERESTING("Hauppauge");
5982  }
5984  /*
5985  * Platform Computing Corp (or a generic on-your-intranet-only restriction)
5986  */
5987  if (INFILE(_LT_INTRANET_ONLY)) {
5988  if (INFILE(_CR_PLATFORM_COMP)) {
5989  INTERESTING(lDebug ? "Platfm(1)" : "Platform-Computing(RESTRICTED)");
5990  } else {
5991  MEDINTEREST("Intranet-only");
5992  }
5993  } else if (INFILE(_LT_NOT_INTERNET)) {
5994  if (INFILE(_CR_PLATFORM_COMP)) {
5995  INTERESTING(lDebug ? "Platfm(2)" : "Platform-Computing(RESTRICTED)");
5996  } else {
5997  MEDINTEREST("Not-Internet");
5998  }
5999  }
6001  /*
6002  * Curl
6003  */
6004  if (URL_INFILE(_URL_CURL)) {
6005  INTERESTING(lDebug ? "Curl(URL)" : "curl");
6006  }
6008  /*
6009  * ID Software
6010  */
6011  if (INFILE(_LT_ID_EULA)) {
6012  INTERESTING("ID-EULA");
6013  }
6015  /*
6016  * M+ Fonts Project
6017  */
6018  if (INFILE(_LT_MPLUS_FONT) && INFILE(_CR_MPLUS)) {
6019  INTERESTING("M-Plus-Project");
6020  }
6022  /*
6023  * Powder Development
6024  */
6025  if (INFILE(_LT_POWDER)) {
6026  INTERESTING("Powder-Proprietary");
6027  }
6029  /*
6030  * Against DRM
6031  */
6032  if (INFILE(_LT_AGAINST_DRM)) {
6033  INTERESTING("AgainstDRM");
6034  }
6036  /*
6037  * The TeXinfo exception clause
6038  */
6039  if (INFILE(_LT_TEX_EXCEPT)) {
6040  INTERESTING(lDebug ? "TeX-except" : "TeX-exception");
6041  }
6043  /*
6044  * The U.S. Gummint
6045  */
6046  if (INFILE(_LT_USGOVT_1)) {
6047  if (INFILE(_CR_URA)) {
6048  MEDINTEREST("URA.govt");
6049  }
6050  else {
6051  MEDINTEREST(lDebug ? "Govt-Wk(1)" : "Govt-work");
6052  }
6053  }
6054  else if (INFILE(_LT_USGOVT_2)) {
6055  /*
6056  * mpich2
6057  */
6058  if (INFILE(_LT_MPICH2)) {
6059  INTERESTING("mpich2");
6060  }
6061  else {
6062  MEDINTEREST(lDebug ? "Govt-Wk(2)" : "Govt-work");
6063  }
6064  }
6065  else if (INFILE(_LT_USGOVT_RIGHTS1) && INFILE(_LT_PUBLIC)) {
6066  MEDINTEREST(lDebug ? "US-Govt(1)" : "Govt-rights");
6067  }
6068  else if (INFILE(_LT_USGOVT_RIGHTS2)) {
6069  MEDINTEREST(lDebug ? "US-Govt(2)" : "Govt-rights");
6070  }
6072  /*
6073  * AACA (Ada Conformity Assessment Authority)
6074  */
6075  if (INFILE(_LT_ACAA_RIGHTS) && INFILE(_LT_PUBLIC)) {
6076  INTERESTING("ACAA");
6077  }
6079  /*
6080  * Zend Engine License
6081  */
6082  if (INFILE(_LT_ZEND_1) || URL_INFILE(_URL_ZEND)) {
6083  INTERESTING("Zend-2.0");
6084  }
6085  else if (INFILE(_LT_ZEND_2)) {
6086  INTERESTING("Zend-1.0");
6087  }
6089  /*
6090  * WebM
6091  * Changed to BSD-3-Clause, WebM is not OSI nor SPDX recognized license
6092  */
6093  if (URL_INFILE(_URL_WEBM)) {
6094  INTERESTING(lDebug ? "WebM" : "BSD-3-Clause");
6095  }
6097  /* Dyade Public License
6098  * http://old.koalateam.com/jackaroo/DYADE_PUBLIC_LICENSE.TXT
6099  */
6100  if (INFILE(_LT_DYADE) && INFILE(_LT_DYADE_2))
6101  {
6102  INTERESTING("Dyade");
6103  }
6104  /*
6105  * Zimbra
6106  */
6107  if (INFILE(_TITLE_ZIMBRA_13)) {
6108  INTERESTING("Zimbra-1.3");
6109  }
6110  else if (INFILE(_TITLE_ZIMBRA_12)) {
6111  INTERESTING("Zimbra-1.2");
6112  }
6113  else if (INFILE(_TITLE_ZIMBRA)) {
6114  INTERESTING("Zimbra");
6115  }
6117  /*
6118  * Open Database
6119  */
6120  if (INFILE(_TITLE_ODBL)) {
6121  INTERESTING("ODbL-1.0");
6122  lmem[_fODBL] = 1;
6123  }
6125  /*
6126  * Multics
6127  */
6128  if (INFILE(_LT_MULTICS)) {
6129  INTERESTING("Multics");
6130  }
6132  /*
6133  * H2
6134  * Note, H2 title is also checked in MPL section
6135  */
6136  if (INFILE(_TITLE_H2_V10)) {
6137  INTERESTING("H2-1.0");
6138  }
6140  /*
6141  * CRYPTOGAMS
6142  */
6143  if (INFILE(_LT_CRYPTOGAMS)) {
6144  INTERESTING("Cryptogams");
6145  }
6147  /*
6148  * Cygnus-eCos-1.0
6149  * Note, Cygnus-eCos title is also checked in MPL section
6150  */
6151  if (INFILE(_TITLE_CYGNUS_ECOS_V10)) {
6152  INTERESTING("Cygnus-eCos-1.0");
6153  }
6155  /*
6156  * RHeCos-1.1
6157  * Note, RHeCos-1.1 title is also checked in MPL section
6158  */
6159  if (INFILE(_TITLE_RHeCos_V11)) {
6160  INTERESTING("RHeCos-1.1");
6161  }
6163  /*
6164  * TMate
6165  * Note, TMate is also recognized with BSD-2-Clause detection
6166  */
6167  if (INFILE(_TITLE_TMATE)) {
6168  INTERESTING("TMate");
6169  }
6171  /*
6172  * Abstyles
6173  */
6174  if (INFILE(_LT_ABSTYLES_1) && INFILE(_LT_ABSTYLES_2)) {
6175  INTERESTING("Abstyles");
6176  }
6178  /*
6179  * Amazon Digital Services License
6180  */
6181  if (INFILE(_LT_ADSL) && INFILE(_CR_AMAZON)) {
6182  INTERESTING("ADSL");
6183  }
6185  /*
6186  * CrystalStacker License
6187  */
6188  if (HASTEXT(_LT_CRYSTALSTACKER, REG_EXTENDED)) {
6189  INTERESTING("CrystalStacker");
6190  }
6192  /*
6193  * 3GPP
6194  */
6195  if (INFILE(_LT_3GPP)) {
6196  INTERESTING("3GPP");
6197  }
6199  /*
6200  * ITU-T
6201  */
6202  if (INFILE(_LT_ITU_T_1) || INFILE(_LT_ITU_T_2) || HASTEXT(_TITLE_ITU_T, 0)) {
6203  INTERESTING("ITU-T");
6204  }
6206  /*
6207  * Sun Public License
6208  */
6209  if (!lmem[_mSUN] && !lmem[_mMPL]) {
6210  if (INFILE(_TITLE_SUN_PL10)) {
6211  INTERESTING("SPL-1.0");
6212  }
6213  else if (!lmem[_fREAL] && INFILE(_TITLE_SUN_PL)) {
6214  INTERESTING("SPL");
6215  }
6216  }
6218  /*
6219  * libtiff, note that license text is detected earlier
6220  */
6221  if (INFILE(_PHR_LIBTIFF)) {
6222  INTERESTING("libtiff");
6223  }
6225  /*
6226  * Imlib2
6227  */
6228  if (INFILE(_PHR_Imlib2)) {
6229  INTERESTING("Imlib2");
6230  }
6232  /*
6233  * Wide Open License (WOL)
6234  */
6235  if (INFILE(_TITLE_WOL) || INFILE(_URL_WOL)) {
6236  INTERESTING("WOL");
6237  }
6239  /*
6240  * naist-2003
6241  */
6242  if (INFILE(_LT_NAIST_2003) && HASTEXT(_TEXT_NAIST, 0)) {
6243  INTERESTING("naist-2003");
6244  }
6246  /*
6247  * EDL-1.0
6248  */
6249  if (INFILE(_TITLE_EDL_V10)) {
6250  INTERESTING("EDL-1.0");
6251  }
6253  /*
6254  * HSQLDB
6255  */
6256  if (INFILE(_LT_HSQLDB_1) || INFILE(_LT_HSQLDB_2) || INFILE(_LT_HSQLDB_3)) {
6257  INTERESTING("HSQLDB");
6258  }
6260  /*
6261  * Sony Computer Entertainment (SCEA) Shared Source License
6262  */
6263  if (INFILE(_TITLE_SCEA)) {
6264  INTERESTING("SCEA");
6265  }
6267  /*
6268  * OpenMap
6269  */
6270  if (INFILE(_TITLE_OPENMAP)) {
6271  INTERESTING("OpenMap");
6272  lmem[_fPDDL] = 1;
6273  }
6275  /*
6276  * ICU 1.8.1
6277  */
6278  if (INFILE(_LT_ICU_1) || INFILE(_TITLE_ICU) || INFILE(_SPDX_ICU)) {
6279  INTERESTING("ICU");
6280  }
6281  else if (INFILE(_PHR_ICU_1)) {
6282  INTERESTING("ICU");
6283  }
6285  /*
6286  * Ubuntu Font License
6287  */
6288  if (INFILE(_TITLE_UBUNTU_FONT)) {
6289  INTERESTING("ubuntu-font-1.0");
6290  lmem[_fPDDL] = 1;
6291  }
6293  /*
6294  * ODC Attribution License
6295  */
6296  if (INFILE(_LT_ODC)) {
6297  INTERESTING("ODC-By-1.0");
6298  pd = 0;
6299  }
6301  /*
6302  * Community Data License Agreement
6303  */
6304  if (INFILE(_TITLE_CDLA_Permissive_10)) {
6305  INTERESTING("CDLA-Permissive-1.0");
6306  }
6307  else if (INFILE(_TITLE_CDLA_Sharing_10)) {
6308  INTERESTING("CDLA-Sharing-1.0");
6309  }
6311  /*
6312  * Toolbar2000
6313  */
6314  if (INFILE(_TITLE_Toolbar2000) || INFILE(_URL_Toolbar2000)) {
6315  INTERESTING("Toolbar2000");
6316  }
6318  /*
6319  * unboundID-ldap-sdk
6320  */
6321  if (INFILE(_TITLE_unboundID_ldap_sdk) || INFILE(_LT_unboundID_ldap_sdk)) {
6322  INTERESTING("unboundID-ldap-sdk");
6323  }
6325 
6326  SPDXREF();
6328  EXCEPTIONS();
6330 
6331  /*
6332  * The Stallman paper "Why Software Should Be Free" is a red-herring.
6333  * His 1986 interview in Byte magazine also is, too.
6334  */
6335  if ((INFILE(_TITLE_RMS_WSSBF) && INFILE(_PHR_RMS1) &&
6336  INFILE(_PHR_RMS2)) || INFILE(_TITLE_RMS_BYTE86)) {
6337  if (lDiags) {
6338  printf("... RMS propaganda\n");
6339  }
6340  lmem[_fDOC] = 1;
6341  }
6343  /*
6344  * If there's a no-warranty statement in the file, remember the regex.
6345  * Ditto for phrase stating restrictions.
6346  */
6347  if (maxInterest != IL_HIGH) {
6348  for (i = 0; i < NNOWARRANTY; i++) {
6349  if (INFILE((j = _NO_WARRANTY_first+i))) {
6350  nw = j;
6351  break;
6352  }
6353  }
6354  }
6355  addLicence(cur.theMatches,"NoWarranty");
6356 
6357  /*
6358  * Statements about IP (Intellectual Property) rights
6359  */
6360  if (!lmem[_fIP] && INFILE(_LT_GEN_IP_1)) {
6361  INTERESTING(lDebug ? "IP(1)" : "IP-claim");
6362  }
6363  else if (!lmem[_fIP] && INFILE(_LT_GEN_IP_2) && NOT_INFILE(_TITLE_MIROS)) {
6364  INTERESTING(lDebug ? "IP(2)" : "IP-claim");
6365  }
6366  else if (!lmem[_fIP] && INFILE(_LT_GEN_IP_3)) {
6367  INTERESTING(lDebug ? "IP(3)" : "IP-claim");
6368  }
6370  /*
6371  * Dual licenses
6372  */
6373  if (INFILE(_LT_DUAL_LICENSE_0) && NOT_INFILE(_TITLE_NOSL)) {
6374  MEDINTEREST(lDebug ? "Dual-license(0)" : "Dual-license");
6375  }
6376  else if (INFILE(_LT_DUAL_LICENSE_22)) {
6377  MEDINTEREST(lDebug ? "Dual-license(22)" : "Dual-license");
6378  }
6379  else if (INFILE(_LT_DUAL_LICENSE_1) && NOT_INFILE(_TITLE_NOSL)) {
6380  MEDINTEREST(lDebug ? "Dual-license(1)" : "Dual-license");
6381  }
6382  else if (INFILE(_LT_DUAL_LICENSE_2)) {
6383  MEDINTEREST(lDebug ? "Dual-license(2)" : "Dual-license");
6384  }
6385  else if (INFILE(_LT_DUAL_LICENSE_3) && NOT_INFILE(_LT_DUAL_LICENSE_3_EXHIBIT)) {
6386  MEDINTEREST(lDebug ? "Dual-license(3)" : "Dual-license");
6387  }
6388  else if (INFILE(_LT_DUAL_LICENSE_4)) {
6389  MEDINTEREST(lDebug ? "Dual-license(4)" : "Dual-license");
6390  }
6391  else if (INFILE(_LT_DUAL_LICENSE_5)) {
6392  MEDINTEREST(lDebug ? "Dual-license(5)" : "Dual-license");
6393  }
6394  else if (INFILE(_LT_DUAL_LICENSE_6)) {
6395  MEDINTEREST(lDebug ? "Dual-license(6)" : "Dual-license");
6396  }
6397  else if (INFILE(_LT_DUAL_LICENSE_7)) {
6398  MEDINTEREST(lDebug ? "Dual-license(7)" : "Dual-license");
6399  }
6400  else if (INFILE(_LT_DUAL_LICENSE_8)) {
6401  MEDINTEREST(lDebug ? "Dual-license(8)" : "Dual-license");
6402  }
6403  else if (INFILE(_LT_DUAL_LICENSE_9)) {
6404  MEDINTEREST(lDebug ? "Dual-license(9)" : "Dual-license");
6405  }
6406  else if (INFILE(_LT_DUAL_LICENSE_10)) {
6407  MEDINTEREST(lDebug ? "Dual-license(10)" : "Dual-license");
6408  }
6409  else if (INFILE(_LT_DUAL_LICENSE_11)) {
6410  MEDINTEREST(lDebug ? "Dual-license(11)" : "Dual-license");
6411  }
6412  else if (INFILE(_LT_DUAL_LICENSE_12)) {
6413  MEDINTEREST(lDebug ? "Dual-license(12)" : "Dual-license");
6414  }
6415  else if (INFILE(_LT_DUAL_LICENSE_13)) {
6416  INTERESTING(lDebug ? "Dual-license(13)" : "Dual-license");
6417  INTERESTING("BSD");
6418  INTERESTING("MIT");
6419  /*
6420  * A special case for NomosTestfiles/Dual-license/respond.js
6421  * that has two dual-license statements.
6422  */
6423  if (!lmem[_mGPL]) {
6424  if (INFILE(_LT_DUAL_LICENSE_16)) {
6425  INTERESTING(lDebug ? "GPLV2(Dual-license(16))" : "GPL-2.0");
6426  }
6427  }
6428  }
6429  else if (INFILE(_LT_DUAL_LICENSE_14)) {
6430  INTERESTING(lDebug ? "Dual-license(14)" : "Dual-license");
6431  INTERESTING("BSD");
6432  if (!lmem[_mGPL]) {
6433  INTERESTING("GPL");
6434  }
6435  }
6436  else if (INFILE(_LT_DUAL_LICENSE_15)) {
6437  MEDINTEREST(lDebug ? "Dual-license(15)" : "Dual-license");
6438  }
6439  else if (INFILE(_LT_DUAL_LICENSE_16)) {
6440  INTERESTING(lDebug ? "Dual-license(16)" : "Dual-license");
6441  INTERESTING("MIT");
6442  INTERESTING(lDebug ? "GPLV2(Dual-license(16))" : "GPL-2.0");
6443  }
6444  else if (INFILE(_LT_DUAL_LICENSE_17)) {
6445  MEDINTEREST(lDebug ? "Dual-license(17)" : "Dual-license");
6446  }
6447  else if (INFILE(_LT_DUAL_LICENSE_18)) {
6448  MEDINTEREST(lDebug ? "Dual-license(18)" : "Dual-license");
6449  }
6450  else if (INFILE(_LT_DUAL_LICENSE_19)) {
6451  MEDINTEREST(lDebug ? "Dual-license(19)" : "Dual-license");
6452  }
6453  else if (INFILE(_LT_DUAL_LICENSE_20)) {
6454  MEDINTEREST(lDebug ? "Dual-license(20)" : "Dual-license");
6455  }
6456  else if (INFILE(_LT_DUAL_LICENSE_21)) {
6457  MEDINTEREST(lDebug ? "Dual-license(21)" : "Dual-license");
6458  }
6459  else if (INFILE(_LT_DUAL_LICENSE_23)) {
6460  MEDINTEREST(lDebug ? "Dual-license(23)" : "Dual-license");
6461  }
6462  else if (INFILE(_LT_DUAL_LICENSE_24)) {
6463  MEDINTEREST(lDebug ? "Dual-license(24)" : "Dual-license");
6464  }
6465  else if (INFILE(_LT_DUAL_LICENSE_25)) {
6466  MEDINTEREST(lDebug ? "Dual-license(25)" : "Dual-license");
6467  }
6468  else if (INFILE(_LT_DUAL_LICENSE_26)) {
6469  MEDINTEREST(lDebug ? "Dual-license(26)" : "Dual-license");
6470  }
6471  else if (INFILE(_LT_DUAL_LICENSE_27)) {
6472  MEDINTEREST(lDebug ? "Dual-license(27)" : "Dual-license");
6473  }
6474  else if (INFILE(_LT_DUAL_LICENSE_28)) {
6475  MEDINTEREST(lDebug ? "Dual-license(28)" : "Dual-license");
6476  }
6477  else if (INFILE(_LT_DUAL_LICENSE_29) && NOT_INFILE(_LT_MPL_SECONDARY_LICENSE)) {
6478  MEDINTEREST(lDebug ? "Dual-license(29)" : "Dual-license");
6479  }
6480  else if (INFILE(_LT_DUAL_LICENSE_30)) {
6481  MEDINTEREST(lDebug ? "Dual-license(30)" : "Dual-license");
6482  }
6483  else if (INFILE(_LT_DUAL_LICENSE_31)) {
6484  MEDINTEREST(lDebug ? "Dual-license(31)" : "Dual-license");
6485  }
6486  else if (INFILE(_LT_DUAL_LICENSE_32)) {
6487  MEDINTEREST(lDebug ? "Dual-license(32)" : "Dual-license");
6488  }
6489  else if (INFILE(_LT_DUAL_LICENSE_33)) {
6490  MEDINTEREST(lDebug ? "Dual-license(33)" : "Dual-license");
6491  }
6492  else if (INFILE(_LT_DUAL_LICENSE_34)) {
6493  MEDINTEREST(lDebug ? "Dual-license(34)" : "Dual-license");
6494  }
6495  else if (HASTEXT(_LT_DUAL_LICENSE_35, 0)) {
6496  MEDINTEREST(lDebug ? "Dual-license(35)" : "Dual-license");
6497  /*
6498  * GPL is not detected correctly in this case, therefore it is set here.
6499  */
6500  INTERESTING("GPL");
6501  }
6502  else if (INFILE(_LT_DUAL_LICENSE_36)) {
6503  MEDINTEREST(lDebug ? "Dual-license(36)" : "Dual-license");
6504  }
6505  else if (INFILE(_LT_DUAL_LICENSE_37)) {
6506  MEDINTEREST(lDebug ? "Dual-license(37)" : "Dual-license");
6507  }
6508  else if (INFILE(_LT_DUAL_LICENSE_38)) {
6509  MEDINTEREST(lDebug ? "Dual-license(38)" : "Dual-license");
6510  }
6511  else if (INFILE(_LT_DUAL_LICENSE_39)) {
6512  MEDINTEREST(lDebug ? "Dual-license(39)" : "Dual-license");
6513  }
6514  else if (INFILE(_LT_DUAL_LICENSE_40)) {
6515  MEDINTEREST(lDebug ? "Dual-license(40)" : "Dual-license");
6516  }
6517  else if (INFILE(_LT_DUAL_LICENSE_41)) {
6518  MEDINTEREST(lDebug ? "Dual-license(41)" : "Dual-license");
6519  }
6520  else if (INFILE(_LT_DUAL_LICENSE_42)) {
6521  MEDINTEREST(lDebug ? "Dual-license(42)" : "Dual-license");
6522  }
6523  else if (INFILE(_LT_DUAL_LICENSE_43)) {
6524  MEDINTEREST(lDebug ? "Dual-license(43)" : "Dual-license");
6525  }
6526  else if (HASTEXT(_LT_DUAL_LICENSE_44, 0)) {
6527  MEDINTEREST(lDebug ? "Dual-license(44)" : "Dual-license");
6528  }
6529  else if (INFILE(_LT_DUAL_LICENSE_45)) {
6530  MEDINTEREST(lDebug ? "Dual-license(45)" : "Dual-license");
6531  INTERESTING("MIT");
6532  }
6533  else if (HASTEXT(_LT_DUAL_LICENSE_46, REG_EXTENDED)) {
6534  MEDINTEREST(lDebug ? "Dual-license(46)" : "Dual-license");
6535  }
6536  else if (HASTEXT(_LT_DUAL_LICENSE_47, REG_EXTENDED) && NOT_INFILE(_LT_MPL_SECONDARY_LICENSE)) {
6537  MEDINTEREST(lDebug ? "Dual-license(47)" : "Dual-license");
6538  }
6539  else if (INFILE(_LT_DUAL_LICENSE_48)) {
6540  MEDINTEREST(lDebug ? "Dual-license(48)" : "Dual-license");
6541  }
6542  else if (INFILE(_LT_DUAL_LICENSE_49)) {
6543  MEDINTEREST(lDebug ? "Dual-license(49)" : "Dual-license");
6544  }
6546  /*
6547  * The Beer-ware license(!)
6548  */
6549  if (INFILE(_LT_BEERWARE)) {
6550  INTERESTING("Beerware");
6551  }
6553  /*
6554  * CMake license
6555  */
6556  if (URL_INFILE(_URL_CMAKE)) {
6557  INTERESTING("CMake");
6558  }
6560  /*
6561  * unRAR restriction
6562  */
6563  if (INFILE(_LT_UNRARref1) || INFILE(_LT_UNRARref2)) {
6564  INTERESTING("unRAR restriction");
6565  }
6567  /*
6568  * ANTLR Software Rights Notice
6569  */
6570  if (INFILE(_LT_ANTLR)) {
6571  INTERESTING("ANTLR-PD");
6572  lmem[_fANTLR] = 1;
6573  }
6575  /*
6576  * Creative Commons Zero v1.0 Universal
6577  */
6578  if (INFILE(_SPDX_CC0_10)) {
6579  INTERESTING("CC0-1.0");
6580  }
6581  else if (INFILE(_TITLE_CC0_10_1) || INFILE(_PHR_CC0_1) || INFILE(_PHR_CC0_2)) {
6582  INTERESTING("CC0-1.0");
6583  }
6585  /*
6586  * PA Font License (IPA)
6587  */
6588  if (INFILE(_TITLE_IPA)) {
6589  INTERESTING("IPA");
6590  }
6592  /*
6593  * European Union Public Licence
6594  */
6595  if (INFILE(_PHR_EUPL_10) || INFILE(_TITLE_EUPL_10)) {
6596  INTERESTING("EUPL-1.0");
6597  }
6598  else if (INFILE(_PHR_EUPL_11) || INFILE(_TITLE_EUPL_11)) {
6599  INTERESTING("EUPL-1.1");
6600  }
6601  else if (INFILE(_TITLE_EUPL_12)) {
6602  INTERESTING("EUPL-1.2");
6603  }
6604  else if (INFILE(_PHR_EUPL)) {
6605  INTERESTING("EUPL");
6606  }
6608  /* University of Illinois/NCSA Open Source License */
6609  if (!lmem[_fNCSA] && INFILE(_TITLE_NCSA) && NOT_INFILE(_TITLE_NCSA_EXHIBIT)) {
6610  INTERESTING(lDebug ? "NCSA(2)" : "NCSA");
6611  /* OZPLB-1.1 refers both to NCSA and OZPLB-1.1 licenses */
6612  if (INFILE(_TITLE_OZPLB_11)) {
6613  INTERESTING("OZPLB-1.1");
6614  }
6615  lmem[_fBSD] = 1;
6616  lmem[_mMIT] = 1;
6617  }
6619  /* ODC Public Domain Dedication & License 1.0 */
6620  if (INFILE(_TITLE_PDDL)) {
6621  INTERESTING("PDDL-1.0");
6622  lmem[_fPDDL] = 1;
6623  }
6625  /* PostgreSQL License */
6626  if (INFILE(_TITLE_POSTGRES) || INFILE(_TITLE_POSTGRES_1)) {
6627  INTERESTING("PostgreSQL");
6628  lmem[_fBSD] = 1;
6629  }
6631  /* Sax Public Domain Notice */
6632  if (INFILE(_LT_SAX_PD)) {
6633  INTERESTING("SAX-PD");
6634  lmem[_fSAX] = 1;
6635  }
6637  /*
6638  * WTF Public "license"
6639  */
6640  if (INFILE(_LT_WTFPL)) {
6641  INTERESTING("WTFPL");
6642  }
6643  else if (INFILE(_LT_WTFPLref)) {
6644  INTERESTING(lDebug ? "WTFPL(ref)" : "WTFPL");
6645  }
6646  else if (INFILE(_LT_WTFPLref_1)) {
6647  INTERESTING(lDebug ? "WTFPL(ref#1)" : "WTFPL");
6648  }
6649  else if (INFILE(_PHR_WTFPL)) {
6650  INTERESTING(lDebug ? "WTFPL(phr)" : "WTFPL");
6651  }
6653  /* Independent JPEG Group License */
6654  if (!lmem[_fIJG]) {
6655  if (HASTEXT(_PHR_IJG_1, REG_EXTENDED)) {
6656  INTERESTING("IJG");
6657  }
6658  else if (HASTEXT(_PHR_IJG_2, 0)) {
6659  INTERESTING("IJG");
6660  }
6661  else if (HASTEXT(_TITLE_IJG_1, 0) && !HASTEXT(_PHR_IJG_INTERFACE_1, 0) && !HASTEXT(_PHR_IJG_INTERFACE_2, 0)) {
6662  INTERESTING("IJG");
6663  }
6664  /* Independent JPEG Group can be referenced without IJG license*/
6665  else if (HASTEXT(_TITLE_IJG_2, 0) && !HASTEXT(_PHR_IJG_INTERFACE_1, 0) && !HASTEXT(_PHR_IJG_INTERFACE_2, 0)) {
6666  INTERESTING("IJG-possibility");
6667  }
6669  }
6670  /* Netizen Open Source License */
6671  if (!lmem[_mMPL] && INFILE(_TITLE_NOSL)) {
6672  INTERESTING(lDebug ? "NOSL(#2)" : "NOSL");
6673  }
6675  /* Net Boolean Public License v1 */
6676  if (INFILE(_TITLE_NBPL_V10)) {
6677  INTERESTING("NBPL-1.0");
6678  }
6680  /* Flora License */
6681  if (INFILE(_TITLE_Flora_V10)) {
6682  INTERESTING("Flora-1.0");
6683  }
6684  else if (INFILE(_TITLE_Flora_V11)) {
6685  INTERESTING("Flora-1.1");
6686  }
6687  else if (URL_INFILE(_URL_Flora)) {
6688  INTERESTING("Flora");
6689  }
6691  /* Standard ML of New Jersey License */
6692  if (INFILE(_TITLE_SMLNJ)) {
6693  INTERESTING("SMLNJ");
6694  }
6696  /* Mozilla Public License possibility */
6697  if (!lmem[_mMPL] && URL_INFILE(_URL_MPL_LATEST)) {
6698  INTERESTING(lDebug ? "MPL(latest)" : "MPL");
6699  }
6701  /* Citrix License */
6702  if (INFILE(_TITLE_CITRIX)) {
6703  INTERESTING("Citrix");
6704  lmem[_fCITRIX] = 1;
6705  }
6707  /* CUA office public license */
6708  if (INFILE(_TITLE_CUA10)) {
6709  INTERESTING("CUA-OPL-1.0");
6710  }
6712  /* the Erlang Public License */
6713  if (INFILE(_TITLE_ERLPL_ref)) {
6714  INTERESTING("ErlPL-1.1");
6715  }
6717  /* German Free Software License */
6718  if (INFILE(_TITLE_D_FSL_10) || INFILE(_TITLE_D_FSL_DE1_10) || INFILE(_TITLE_D_FSL_DE2_10) || INFILE(_TITLE_D_FSL_DE3_10) || INFILE(_TITLE_D_FSL_DE4_10))
6719  {
6720  INTERESTING("D-FSL-1.0");
6721  lmem[_mGPL] = 1;
6722  }
6724  /* CCLRC License */
6725  if (INFILE(_TITLE_CCLRC)) {
6726  INTERESTING("CCLRC");
6727  }
6729 
6730  /* Some GPL cases are still missing */
6731  if (!lmem[_mGPL] && (INFILE(_LT_GPL_V2_ref) || INFILE(_LT_GPL_V2_ref1) || INFILE(_LT_GPL_V2_ref2) || INFILE(_LT_GPL_V2_ref3) || INFILE(_LT_GPL_V2_ref4)))
6732  {
6733  INTERESTING(lDebug ? "GPL_V2_ref" : "GPL-2.0");
6734  lmem[_mGPL] = 1;
6735  }
6736  else if (!lmem[_mGPL] && INFILE(_LT_GPL_V3_ref))
6737  {
6738  INTERESTING(lDebug ? "GPL_V3_ref" : "GPL-3.0");
6739  lmem[_mGPL] = 1;
6740  }
6741  else if (!lmem[_mGPL] && INFILE(_LT_GPLref22))
6742  {
6743  INTERESTING(lDebug ? "GPLref22" : "GPL");
6744  lmem[_mGPL] = 1;
6745  }
6746  else if (!lmem[_mGPL] && NOT_INFILE(_LT_IGNORE_CLAUSE_2) && INFILE(_LT_GPLref21))
6747  {
6748  INTERESTING(lDebug ? "GPLref21" : "GPL");
6749  lmem[_mGPL] = 1;
6750  }
6752 
6753  /* MX4J License version 1.0 */
6754  if (INFILE(_LT_MX4J_V10))
6755  {
6756  INTERESTING("MX4J-1.0");
6757  }
6758  else if (INFILE(_LT_MX4J))
6759  {
6760  INTERESTING("MX4J");
6761  }
6763  /* postfix license */
6764  if (INFILE(_TITLE_POSTFIX))
6765  {
6766  INTERESTING("Postfix");
6767  }
6769  /* not public domain */
6770  if (HASTEXT(_LT_PUBDOM_NOTclaim, REG_EXTENDED)) {
6771  if (INFILE(_LT_PUBDOM_CC)) {
6772  INTERESTING(lDebug ? "Pubdom(CC)" : LS_PD_CLM);
6773  }
6774  else {
6775  INTERESTING(LS_NOT_PD);
6776  }
6777  pd = 0;
6778  }
6780  /* LIBGCJ license */
6781  if (INFILE(_LT_LIBGCJ))
6782  {
6783  INTERESTING("LIBGCJ");
6784  }
6786  /* open cascade technology public license */
6787  if (INFILE(_TITLE_OPEN_CASCADE))
6788  {
6789  INTERESTING("OpenCASCADE-PL");
6790  }
6792  /* KnowledgeTree Public License */
6793  if (INFILE(_LT_KnowledgeTree_V11))
6794  {
6795  INTERESTING("KnowledgeTree-1.1");
6796  }
6798  /* Interbase Public License */
6799  if (INFILE(_LT_Interbase_V10))
6800  {
6801  INTERESTING("Interbase-1.0");
6802  }
6804  /* ClearSilver license */
6805  if (INFILE(_LT_ClearSilver))
6806  {
6807  INTERESTING("ClearSilver");
6808  }
6810  /* ACE, TAO, CIAO */
6811  if(INFILE(_LT_ACE)) {
6812  INTERESTING("ACE");
6813  }
6814  else if(INFILE(_LT_FACE)) {
6815  INTERESTING("FaCE");
6816  }
6818  /* JISP */
6819  if(INFILE(_LT_JISP)) {
6820  INTERESTING("JISP");
6821  }
6823  /* Qmail */
6824  if(INFILE(_LT_QMAIL)) {
6825  INTERESTING("Qmail");
6826  }
6828  /* Migemo */
6829  if(INFILE(_LT_MIGEMO)) {
6830  INTERESTING("Migemo");
6831  }
6833  /* Sendmail */
6834  if(INFILE(_LT_Sendmail_title) ) {
6835  INTERESTING("Sendmail");
6836  }
6838  /* Giftware */
6839  if(INFILE(_LT_GIFTWARE)) {
6840  INTERESTING("Giftware");
6841  }
6843  /* Logica opensource */
6844  if(INFILE(_LT_LOGICA)) {
6845  INTERESTING("Logica-OSL-1.0");
6846  }
6848  /* Unidex */
6849  if(INFILE(_LT_UNIDEX)) {
6850  INTERESTING("Unidex");
6851  }
6853  /* TCL License */
6854  if (!lmem[_fTCL]) {
6855  if (INFILE(_TITLE_TCL)) {
6856  INTERESTING("TCL");
6857  }
6858  else if (INFILE(_SPDX_TCL)) {
6859  INTERESTING("TCL");
6860  }
6861  else if (INFILE(_LT_TCL)) {
6862  INTERESTING("TCL");
6863  }
6864  }
6866  /* AndroidSDK-Commercial license */
6867  if (INFILE(_LT_GOOGLE_SDK)) {
6868  INTERESTING("AndroidSDK.Commercial");
6869  }
6871  /* Qhull license */
6872  if (INFILE(_PHR_Qhull)) {
6873  INTERESTING("Qhull");
6874  }
6876  /* OZPLB-1.0 license */
6877  if (INFILE(_PHR_OZPLB_10)) {
6878  INTERESTING("OZPLB-1.0");
6879  }
6881 
6882  /*
6883  * Some licenses say "licensed under the same terms as FOO".
6884  */
6885  gl.flags |= FL_SAVEBASE; /* save match buffer (if any) */
6886  if (*licStr == NULL_CHAR) {
6887  i = 0;
6888  if (INFILE(_LT_SAME_LICENSE_1)) {
6889  INTERESTING(lDebug ? "Same-lic-1" : "Same-license-as");
6890  i = 1;
6891  } else if (INFILE(_LT_SAME_LICENSE_2)) {
6892  INTERESTING(lDebug ? "Same-lic-2" : "Same-license-as");
6893  i = 2;
6894  }
6895  if (i) {
6896  if (cur.licPara == NULL_STR) {
6897  saveLicenseParagraph(cur.matchBase, isML, isPS, NO);
6898  }
6899  }
6900  }
6902  gl.flags |= ~FL_SAVEBASE; /* turn off, regardless */
6903  /*
6904  * ... and, there are several generic claims that "you are free to use this
6905  * software".
6906  * We call these claims "Freeware", because you can use the software free of charge,
6907  * but some other copyright holder exclusive rights are not granted in some cases.
6908  */
6909  if (*licStr == NULL_CHAR || pd >= 0) {
6910  for (i = 0; i < NFREECLAIM; i++) {
6911  if (CANSKIP(i, _KW_permission, _FREE_first_perm,
6912  _FREE_last_perm)) {
6913  i = _FREE_last_perm;
6914  continue;
6915  }
6916  if (CANSKIP(i, _KW_distribut, _FREE_first_dist,
6917  _FREE_last_dist)) {
6918  i = _FREE_last_dist;
6919  continue;
6920  }
6921  if (INFILE(_FREECLAIM_first+i)) {
6922  (void) strcpy(name, "Freeware");
6923  if (lDebug) {
6924  (void) sprintf(name+8, "(%d)", i+1);
6925  }
6926  INTERESTING(name);
6927  break;
6928  }
6929  }
6930  }
6932  /* Check for Public Domain */
6933  if (!lmem[_fANTLR] && !lmem[_fCLA] && !lmem[_mPYTHON] && !lmem[_mGFDL] &&
6934  !lmem[_fODBL] && !lmem[_fPDDL] && !lmem[_fRUBY] && !lmem[_fSAX] && !lmem[_fAPL] && !lmem[_mAPACHE] && !lmem[_mAPACHE10] && !lmem[_mAPACHE11] &&
6935  !lmem[_fARTISTIC] && !lmem[_fCITRIX] && !lmem[_mLGPL] && !lmem[_fBSD]&& NOT_INFILE(_TITLE_D_FSL_10)
6936  && !INFILE(_LT_CPOL)) {
6937  pd = checkPublicDomain(filetext, size, score, kwbm, isML, isPS);
6938  }
6940  /*
6941  * Some licenses point you to files/URLs...
6942  */
6943  if (*licStr == NULL_CHAR) {
6944  checkFileReferences(filetext, size, score, kwbm, isML, isPS);
6945  }
6947  /*
6948  * And, If no other licenses are present but there's a reference to
6949  * something being non-commercial, better note it now.
6950  */
6951 #if 0
6952  if (*licStr == NULL_CHAR && !HASKW(kwbm, _KW_public_domain))
6953 #endif
6954  if (maxInterest != IL_HIGH && !HASKW(kwbm, _KW_public_domain) &&
6955  NOT_INFILE(_PHR_COMMERC_NONCOMM)) {
6956  if (INFILE(_LT_NONCOMMERCIAL_1)) {
6957  INTERESTING(lDebug ? "NonC(1)" : "Non-commercial");
6958  }
6959  else if (INFILE(_LT_ZZNON_COMMERC1)) {
6960  INTERESTING(lDebug ? "NonC(2)" : "Non-commercial");
6961  }
6962  else if (INFILE(_LT_ZZNON_COMMERC2)) {
6963  INTERESTING(lDebug ? "NonC(3)" : "Non-commercial");
6964  }
6965  else if (HASTEXT(_TEXT_COMMERC, 0) &&
6966  INFILE(_PHR_NONCOMMERCIAL)) {
6967  INTERESTING(lDebug ? "NonC(4)" : "Non-commercial");
6968  }
6969  }
6970  if (INFILE(_LT_NOT_OPENSOURCE)) {
6971  INTERESTING("Not-OpenSource");
6972  }
6973  listClear(&whereList, NO); /* again, clear "unused" matches */
6975  /*
6976  * Look for footprints that declare something as proprietary... if we such
6977  * a statement, we care about the Copyright owner, too.
6978  */
6979  if (maxInterest != IL_HIGH) { /* if (*licStr == NULL_CHAR) { */
6980  j = 0; /* just a flag */
6981  if (INFILE(_LT_GEN_PROPRIETARY_1)) {
6982  INTERESTING(lDebug ? "Prop(1)" : "COMMERCIAL");
6983  j++;
6984  }
6985  else if (INFILE(_LT_GEN_PROPRIETARY_2)) {
6986  INTERESTING(lDebug ? "Prop(2)" : "COMMERCIAL");
6987  j++;
6988  }
6989  else if (INFILE(_LT_GEN_PROPRIETARY_3)) {
6990  INTERESTING(lDebug ? "Prop(3)" : "COMMERCIAL");
6991  j++;
6992  }
6993  else if (INFILE(_LT_GEN_PROPRIETARY_4)) {
6994  INTERESTING(lDebug ? "Prop(4)" : "COMMERCIAL");
6995  j++;
6996  }
6997  else if (INFILE(_LT_GEN_PROPRIETARY_5)) {
6998  INTERESTING(lDebug ? "Prop(5)" : "COMMERCIAL");
6999  j++;
7000  }
7001  else if (INFILE(_LT_GEN_PROPRIETARY_6)) {
7002  INTERESTING(lDebug ? "Prop(6)" : "COMMERCIAL");
7003  j++;
7004  }
7005  else if (INFILE(_LT_GEN_PROPRIETARY_7)) {
7006  INTERESTING(lDebug ? "Prop(7)" : "COMMERCIAL");
7007  j++;
7008  }
7009  else if (INFILE(_LT_GEN_PROPRIETARY_8)) {
7010  INTERESTING(lDebug ? "Prop(8)" : "COMMERCIAL");
7011  j++;
7012  }
7013  if (j) {
7014  checkCornerCases(filetext, size, score, kwbm, isML,
7015  isPS, nw, YES);
7016  }
7017  }
7018  listClear(&whereList, NO); /* again, clear "unused" matches */
7020  /*
7021  * END of license-footprint checking of known patterns/strings
7022  ******
7023  * Plan-B: look for things attorneys generally believe aren't "overly
7024  * legally-binding" or "uninterestring from a license perspective':
7025  * ... notable references to commercial, non-commercial, not-for-profit,
7026  * not-an-open-source-license, etc.
7027  */
7028  if (maxInterest != IL_HIGH) {
7029  if (INFILE(_LT_COMMERCIAL_1)) {
7030  INTERESTING(lDebug ? "COMM(1)" : "COMMERCIAL");
7031  }
7032  else if (INFILE(_LT_COMMERCIAL_2)) {
7033  INTERESTING(lDebug ? "COMM(2)" : "COMMERCIAL");
7034  }
7035  else if (HASTEXT(_LT_COMMERCIAL_3, REG_EXTENDED)) {
7036  if (HASTEXT(_LT_COMMERCIAL_Intel, REG_EXTENDED)) {
7037  INTERESTING("Intel.Commercial");
7038  } else if (HASTEXT(_LT_COMMERCIAL_Broadcom, REG_EXTENDED)) {
7039  INTERESTING("Broadcom.Commercial");
7040  } else {
7041  INTERESTING(lDebug ? "COMM(3)" : "COMMERCIAL");
7042  }
7043  }
7044  else if (INFILE(_LT_COMMERCIAL_4)) {
7045  if (HASTEXT(_LT_COMMERCIAL_Android_Fraunhofer, 0)) {
7046  INTERESTING("AndroidFraunhofer.Commercial");
7047  } else {
7048  INTERESTING(lDebug ? "COMM(4)" : "COMMERCIAL");
7049  }
7050  }
7051  else if (HASTEXT(_TEXT_BOOK, 0) && INFILE(_LT_BOOKPURCHASE)) {
7052  INTERESTING(lDebug ? "PurchBook" : "COMMERCIAL");
7053  }
7054  else if (INFILE(_LT_COMMERCIAL_5)) {
7055  INTERESTING(lDebug ? "COMM(5)" : "COMMERCIAL");
7056  }
7057  else if (INFILE(_LT_COMMERCIAL_6)) {
7058  INTERESTING(lDebug ? "COMM(6)" : "COMMERCIAL");
7059  }
7060  if (INFILE(_LT_NONPROFIT_1)) {
7061  MEDINTEREST(lDebug ? "NonP(1)" : "Non-profit");
7062  }
7063  else if (!lmem[_mPYTH_TEXT] && HASTEXT(_TEXT_PROFIT, 0) &&
7064  INFILE(_PHR_NONPROFIT)) {
7065  if (!(lmem[_fIETF] + lmem[_fDOC])) {
7066  MEDINTEREST(lDebug ? "NonP(2)" : "Non-profit");
7067  }
7068  }
7069  if (INFILE(_PHR_NO_SALE)) {
7070  MEDINTEREST("Not-for-sale");
7071  }
7072  if (!lmem[_mALADDIN] && INFILE(_PHR_NOT_OPEN)) {
7073  MEDINTEREST("NOT-Open-Source");
7074  }
7075  if (HASKW(kwbm, _KW_patent) && INFILE(_PHR_PATENT) && NOT_INFILE(_PHR_PATENT_NOT)) {
7076  MEDINTEREST("Patent-ref");
7077  }
7078  if (INFILE(_PHR_RESTRICT_RIGHTS)) {
7079  if (INFILE(_PHR_USGOVT_RESTRICT)) {
7080  MEDINTEREST("Govt-restrict");
7081  }
7082  else {
7083  MEDINTEREST("Restricted-rights");
7084  }
7085  }
7086  if (INFILE(_LT_EXPORTS_USA)) {
7087  MEDINTEREST("US-Export-restrict");
7088  }
7089  if (pd < 0) {
7090  checkPublicDomain(filetext, size, score, kwbm, isML, isPS);
7091  }
7092  }
7093  listClear(&whereList, NO); /* again, clear "unused" matches */
7095  /*
7096  * These "minimal-reference possibilities" MUST adhere to a prescribed
7097  * format: the name to be used MUST be the first of several name to match:
7098  * "(NAME identifier|NAME license|license NAME)"
7099  *****
7100  * Furthermore, licenses should be ordered from the most-specific to the
7101  * least-specific; e.g., look for LGPL_v3 before looking for LGPL -- the
7102  * strGrep() calls below ensure reporting only more-specific license
7103  * versions if found. For instance, if you order LGPL *before* LGPL_v3
7104  * we'll get both LGPLv3 and LGPL, which is redundant AND looks stupid.
7105  */
7106  if (*licStr == NULL_CHAR && HASKW(kwbm, _KW_license)) {
7107  for (i = 0, j = _MINlicense_first; i < NMINlicense; i++, j++) {
7108  if (dbgIdxGrep(j, filetext, lDiags)) {
7109  cp = strchr(_REGEX(j), ' ');
7110  if (cp == NULL_STR) {
7111  Assert(NO, "Bad reference[1] %d", j);
7112  continue;
7113  }
7114  *cp = NULL_CHAR;
7115  if (!(*licStr) || !strGrep(_REGEX(j)+1, licStr,
7116  REG_ICASE)) {
7117  (void) sprintf(name, "%s-possibility",
7118  _REGEX(j)+1);
7119  LOWINTEREST(name);
7120  }
7121  *cp = ' ';
7122  }
7123  }
7124  }
7125  listClear(&whereList, NO); /* again, clear "unused" matches */
7127  if (*licStr == NULL_CHAR && HASTEXT(_TEXT_SOURCE, 0)) {
7128  for (i = 0, j = _MINsource_first; i < NMINsource; i++, j++) {
7129  if (dbgIdxGrep(j, filetext, lDiags)) {
7130  cp = strchr(_REGEX(j), ' ');
7131  if (cp == NULL_STR) {
7132  Assert(NO, "Bad reference[2] %d", j);
7133  continue;
7134  }
7135  *cp = NULL_CHAR;
7136  if (!(*licStr) || !strGrep(_REGEX(j)+1, licStr,
7137  REG_ICASE)) {
7138  (void) sprintf(name, "%s-possibility",
7139  _REGEX(j)+1);
7140  LOWINTEREST(name);
7141  }
7142  *cp = ' ';
7143  }
7144  }
7145  }
7146  listClear(&whereList, NO); /* again, clear "unused" matches */
7148  if (*licStr == NULL_CHAR && HASTEXT(_KW_copyright, 0)) {
7149  for (i = 0, j = _MINcpyrt_first; i < NMINcpyrt; i++, j++) {
7150  if (dbgIdxGrep(j, filetext, lDiags)) {
7151  cp = strchr(_REGEX(j), ' ');
7152  if (cp == NULL_STR) {
7153  Assert(NO, "Bad reference[2] %d", j);
7154  continue;
7155  }
7156  *cp = NULL_CHAR;
7157  if (!(*licStr) || !strGrep(_REGEX(j)+1, licStr,
7158  REG_ICASE)) {
7159  (void) sprintf(name, "%s-possibility",
7160  _REGEX(j)+1);
7161  LOWINTEREST(name);
7162  }
7163  *cp = ' ';
7164  }
7165  }
7166  }
7167  listClear(&whereList, NO); /* again, clear "unused" matches */
7169  /*
7170  * NOW look for unclassified licenses, if we haven't found anything yet.
7171  * And avoid checking .po files -- message catalogues are known to have
7172  * false-positives.
7173  *****
7174  * FIX-ME: if a file contains ONLY a "no warranty" description/clause, it
7175  * will (currently) get flagged as an UnclassifiedLicense (so the check
7176  * for no-warranty was moved ABOVE this check in case we can use that info)
7177  */
7178  if (maxInterest != IL_HIGH && !lmem[_fDOC]) {
7179  if (!pd &&
7180  checkUnclassified(filetext, size, scp->score, isML,
7181  isPS, nw)) {
7182  strcpy(name, LS_UNCL);
7183  if (isPS) {
7184  strcat(name, "(PS)");
7185  }
7186  MEDINTEREST(name);
7187  checkCornerCases(filetext, size, score, kwbm, isML, isPS, nw, YES);
7188  }
7189 #ifdef UNKNOWN_CHECK_DEBUG
7190  else {
7191  printf("... NOT an Unclassified license, NW %d PD %d\n",
7192  nw, pd);
7193  }
7194 #endif /* UNKNOWN_CHECK_DEBUG */
7195  }
7196  listClear(&whereList, NO); /* clear "unused" matches */
7198  /*
7199  * If we still haven't found anything, check for the really-low interest
7200  * items such as copyrights, and references to keywords (patent/trademark)
7201  */
7202  if (maxInterest != IL_HIGH && pd <= 0) {
7203  checkCornerCases(filetext, size, score, kwbm, isML, isPS,
7204  nw, NO);
7205  }
7206 #ifdef MEMSTATS
7207  printf("DEBUG: static lists in parseLicenses():\n");
7208  listDump(&searchList, -1);
7209  memStats("parseLicenses: pre-Free");
7210 #endif /* MEMSTATS */
7211  listClear(&searchList, NO);
7212 #ifdef MEMSTATS
7213  memStats("parseLicenses: EOP");
7214 #endif /* MEMSTATS */
7215 #ifdef LTSR_DEBUG
7216  showLTCache("LTSR-results AFTER:");
7217 #endif /* LTSR_DEBUG */
7218 #ifdef FLAG_NO_COPYRIGHT
7219  if (!SEEN(_CR_ZZZANY)) {
7220  (void) INFILE(_CR_ZZZANY);
7221  }
7222  if (!SEEN(_CR_ZZZWRONG_1)) {
7223  (void) INFILE(_CR_ZZZWRONG_1);
7224  }
7225  if (LVAL(_CR_ZZZANY)+LVAL(_CR_ZZZWRONG_1)+
7226  HASREGEX(_CR_ZZZWRONG_2, filetext) == 0) {
7227  gl.flags |= FL_NOCOPYRIGHT;
7228  }
7229 #endif /* FLAG_NO_COPYRIGHT */
7230  listClear(&whCacheList, NO);
7231  if (whereList.used) {
7232  listClear(&whereList, NO); /* may already be cleared! */
7233  }
7234  return(licStr+1); /* don't include the leading comma */
7235 }
7236 
7245 char *sisslVersion(char *filetext, int size, int isML, int isPS)
7246 {
7247  char *lstr = NULL_STR;
7248 
7249 #ifdef PROC_TRACE
7250  traceFunc("== sisslVersion()\n");
7251 #endif /* PROC_TRACE */
7252 
7253  if (INFILE(_TITLE_SISSL_V11)) {
7254  lstr = "SISSL-1.1";
7255  }
7256  else if (INFILE(_TITLE_SISSL_V12)) {
7257  lstr = "SISSL-1.2";
7258  } else {
7259  lstr = "SISSL";
7260  }
7261  return lstr;
7262 }
7263 
7272 char *aslVersion(char *filetext, int size, int isML, int isPS)
7273 {
7274  char *lstr = NULL_STR;
7275 
7276 #ifdef PROC_TRACE
7277  traceFunc("== aslVersion()\n");
7278 #endif /* PROC_TRACE */
7279 
7280  /*
7281  * Exclude first non-Apache licenses
7282  */
7283  if (INFILE(_TITLE_PHORUM) || INFILE(_CR_PHORUM)) {
7284  lstr = "Phorum";
7285  lmem[_mAPACHE] = 1;
7286  }
7287  else if (INFILE(_CR_IMAGEMAGICK)) {
7288  lstr = "ImageMagick(Apache)";
7289  lmem[_mAPACHE] = 1;
7290  }
7291  /*
7292  * Apache-2.0 cases
7293  */
7294  else if (INFILE(_SPDX_Apache_20)) {
7295  lstr = (lDebug ? "Apache-2.0(SPDX)" : "Apache-2.0");
7296  lmem[_mAPACHE] = 1;
7297  }
7298  else if (INFILE(_TITLE_Apache_20)) {
7299  lstr = (lDebug ? "Apache-2(f)" : "Apache-2.0");
7300  lmem[_mAPACHE] = 1;
7301  }
7302  else if (INFILE(_PHR_Apache_20_ref1) || INFILE(_PHR_Apache_20_ref2) || INFILE(_PHR_Apache_20_ref3))
7303  {
7304  lstr = (lDebug ? "PHR_Apache_20_ref(1-5)" : "Apache-2.0");
7305  lmem[_mAPACHE] = 1;
7306  }
7307  else if (URL_INFILE(_URL_Apache_20)) {
7308  lstr = (lDebug ? "Apache-2.0(u)" : "Apache-2.0");
7309  lmem[_mAPACHE] = 1;
7310  }
7311  else if (INFILE(_LT_Apache_20) && NOT_INFILE(_TITLE_Flora_V10) && NOT_INFILE(_TITLE_Flora_V11) && !URL_INFILE(_URL_Flora))
7312  {
7313  lstr = (lDebug ? "Apache(2.0#2)" : "Apache-2.0");
7314  lmem[_mAPACHE] = 1;
7315  }
7316  else if (INFILE(_PHR_Apache_20_ref4) || INFILE(_PHR_Apache_20_ref5) || INFILE(_PHR_Apache_20_ref6)) {
7317  lstr = (lDebug ? "Apache(2.0#3)" : "Apache-2.0");
7318  lmem[_mAPACHE] = 1;
7319  }
7320  else if (INFILE(_TITLE_Apache_20)) {
7321  lstr = (lDebug ? "Apache(2.0#4)" : "Apache-2.0");
7322  lmem[_mAPACHE] = 1;
7323  }
7324  else if (URL_INFILE(_URL_Apache_20_1)) {
7325  lstr = (lDebug ? "Apache2(url#1)" : "Apache-2.0");
7326  lmem[_mAPACHE] = 1;
7327  }
7328  else if (URL_INFILE(_URL_Apache_20_2)) {
7329  lstr = (lDebug ? "Apache2(url#2)" : "Apache-2.0");
7330  lmem[_mAPACHE] = 1;
7331  }
7332  /*
7333  * Apache-1.1 cases
7334  */
7335  else if (INFILE(_SPDX_Apache_11)) {
7336  lstr = (lDebug ? "Apache-1.1(SPDX)" : "Apache-1.1");
7337  lmem[_mAPACHE11] = 1;
7338  }
7339  else if (INFILE(_TITLE_Apache_11)) {
7340  lstr = (lDebug ? "Apache-1.1(f)" : "Apache-1.1");
7341  lmem[_mAPACHE11] = 1;
7342  }
7343  else if (URL_INFILE(_URL_Apache_11)) {
7344  lstr = (lDebug ? "Apache-1.1(u)" : "Apache-1.1");
7345  lmem[_mAPACHE11] = 1;
7346  }
7347  else if (INFILE(_LT_Apache_11_CLAUSE_3) && INFILE(_LT_Apache_11_CLAUSE_4) && INFILE(_LT_Apache_11_CLAUSE_5)) {
7348  lstr = (lDebug ? "Apache-1.1(clauses)" : "Apache-1.1");
7349  lmem[_mAPACHE11] = 1;
7350  }
7351  else if (INFILE(_PHR_Apache_11_ref1)) {
7352  lstr = (lDebug ? "Apache(1.1#phr)" : "Apache-1.1");
7353  lmem[_mAPACHE11] = 1;
7354  }
7355  /*
7356  * Apache-1.0 cases
7357  */
7358  else if (INFILE(_SPDX_Apache_10)) {
7359  lstr = (lDebug ? "Apache-1.0(SPDX)" : "Apache-1.0");
7360  lmem[_mAPACHE10] = 1;
7361  }
7362  else if (INFILE(_PHR_Apache_ref2)) {
7363  lstr = (lDebug ? "Apache-1.0(f)" : "Apache-1.0");
7364  lmem[_mAPACHE10] = 1;
7365  }
7366  else if (INFILE(_LT_Apache_10_CLAUSE_4)) {
7367  lstr = (lDebug ? "Apache-1.0(g)" : "Apache-1.0");
7368  lmem[_mAPACHE10] = 1;
7369  }
7370  else if (URL_INFILE(_URL_Apache_10)) {
7371  lstr = (lDebug ? "Apache-1.0(u)" : "Apache-v1.0");
7372  lmem[_mAPACHE10] = 1;
7373  }
7374  /*
7375  * BSD-style cases
7376  */
7377  else if (INFILE(_LT_BSD_1)) {
7378  if (INFILE(_CR_APACHE) || INFILE(_TITLE_Apache)) {
7379  if (INFILE(_PHR_Apache_20_ref6)) {
7380  lstr = (lDebug ? "Apache-20_ref6" : "Apache-2.0");
7381  lmem[_mAPACHE] = 1;
7382  }
7383  else if (INFILE(_PHR_Apache_11_ref2)) {
7384  lstr = (lDebug ? "Apache(1.1#2)" : "Apache-1.1");
7385  lmem[_mAPACHE11] = 1;
7386  }
7387  else if ((INFILE(_PHR_Apache_ref2) || INFILE(_LT_Apache_10_CLAUSE_4))) {
7388  lstr = (lDebug ? "Apache(1.0#2)" : "Apache-1.0");
7389  lmem[_mAPACHE10] = 1;
7390  }
7391  else {
7392  lstr = (lDebug ? "Apache(title)" : "Apache");
7393  lmem[_mAPACHE] = 1;
7394  }
7395  }
7396  }
7397  /*
7398  * Apache without versions
7399  */
7400  else if (!lmem[_fREAL] && INFILE(_SPDX_Apache)) {
7401  lstr = (lDebug ? "Apache(SPDX)" : "Apache");
7402  lmem[_mAPACHE] = 1;
7403  }
7404  else if (INFILE(_PHR_Apache_ref1)) {
7405  INTERESTING(lDebug ? "Apache(ref#1)" : "Apache");
7406  lmem[_mAPACHE] = 1;
7407  }
7408  else if (INFILE(_PHR_Apache_ref4)) {
7409  lstr = (lDebug ? "Apache(ref#3)" : "Apache");
7410  lmem[_mAPACHE] = 1;
7411  }
7412  else if (INFILE(_PHR_Apache_ref3)) {
7413  lstr = (lDebug ? "Apache(ref#4)" : "Apache");
7414  lmem[_mAPACHE] = 1;
7415  }
7416  else if (URL_INFILE(_URL_Apache_1)) {
7417  lstr = (lDebug ? "Apache(url#1)" : "Apache");
7418  lmem[_mAPACHE] = 1;
7419  }
7420  else if (URL_INFILE(_URL_Apache_2)) {
7421  lstr = (lDebug ? "Apache(url#2)" : "Apache");
7422  lmem[_mAPACHE] = 1;
7423  }
7424  else if (INFILE(_PHR_Apache_ref6)) {
7425  lstr = (lDebug ? "Apache(ref#6)" : "Apache");
7426  lmem[_mAPACHE] = 1;
7427  }
7428  /*
7429  * _LT_Apache_1 and _2 cannot be identified in any Apache license
7430  * versions. They have been defined in very early nomos versions. They
7431  * are kept here, although, there are no special test cases for them.
7432  */
7433  else if (INFILE(_LT_Apache_1)) {
7434  lstr = (lDebug ? "Apache(1)" : "Apache");
7435  lmem[_mAPACHE] = 1;
7436  }
7437  else if (INFILE(_LT_Apache_2)) {
7438  lstr = (lDebug ? "Apache(2)" : "Apache");
7439  lmem[_mAPACHE] = 1;
7440  }
7441  else if (INFILE(_LT_APACHESTYLEref)) {
7442  lstr = ("Apache-style");
7443  lmem[_mAPACHE] = 1;
7444  }
7445  return lstr;
7446 }
7447 
7456 char *mplNplVersion(char *filetext, int size, int isML, int isPS)
7457 {
7458  char *lstr = NULL_STR;
7459 
7460 #ifdef PROC_TRACE
7461  traceFunc("== mplNplVersion()\n");
7462 #endif /* PROC_TRACE */
7463 
7464  if (INFILE(_TITLE_MPL11_OR_LATER)) {
7465  lstr = "MPL-1.1+";
7466  }
7467  else if (INFILE(_LT_MPL11_ref)) {
7468  lstr = "MPL-1.1";
7469  }
7470  else if (INFILE(_TITLE_NPL11_MPL)) {
7471  lstr = "NPL-1.1";
7472  }
7473  else if (INFILE(_TITLE_MPL11) && INFILE(_TITLE_MPL_style)) {
7474  lstr = "MPL-1.1-style";
7475  }
7476  else if (INFILE(_TITLE_SUGARCRM_PL)) {
7477  lstr = "SugarCRM-1.1.3";
7478  lmem[_mMPL] = 1;
7479  lmem[_fATTRIB] = 1;
7480  }
7481  else if (INFILE(_TITLE_MPL11) && !HASTEXT(_LT_NP_AME, REG_EXTENDED)) {
7482  lstr = "MPL-1.1";
7483  }
7484  else if (INFILE(_TITLE_MPL20_EXCEPTION)) {
7485  lstr = "MPL-2.0-no-copyleft-exception";
7486  }
7487  else if (INFILE(_TITLE_MPL20) || URL_INFILE(_URL_MPL20) || HASTEXT(_LT_MPL20_ref, REG_EXTENDED)) {
7488  lstr = "MPL-2.0";
7489  }
7490  else if (INFILE(_TITLE_MPL10) && INFILE(_TITLE_ERLPL)) {
7491  lstr = "ErlPL-1.1";
7492  }
7493  else if (INFILE(_TITLE_MPL10)) {
7494  lstr = "MPL-1.0";
7495  }
7496  else if (INFILE(_TITLE_MPL_EULA_30)) {
7497  lstr = "MPL-EULA-3.0";
7498  }
7499  else if (INFILE(_TITLE_MPL_EULA_20)) {
7500  lstr = "MPL-EULA-2.0";
7501  }
7502  else if (INFILE(_TITLE_MPL_EULA_11)) {
7503  lstr = "MPL-EULA-1.1";
7504  }
7505  else if (URL_INFILE(_URL_NPL10)) {
7506  lstr = (lDebug ? "NPL1.0(url)" : "NPL-1.0");
7507  }
7508  else if (URL_INFILE(_URL_NPL11)) {
7509  lstr = (lDebug ? "NPL1.1(url)" : "NPL-1.1");
7510  }
7511  else if (URL_INFILE(_URL_MPL10)) {
7512  lstr = (lDebug ? "MPL1.0(url)" : "MPL-1.0");
7513  }
7514  else if (URL_INFILE(_URL_MPL11)) {
7515  lstr = (lDebug ? "MPL1.1(url)" : "MPL-1.1");
7516  }
7517  else if (INFILE(_FILE_MPL10)) {
7518  lstr = (lDebug ? "MPL1.0(file)" : "MPL-1.0");
7519  }
7520  else if (INFILE(_FILE_MPL11)) {
7521  lstr = (lDebug ? "MPL1.1(file)" : "MPL-1.1");
7522  }
7523  else if (INFILE(_TITLE_NPL11_OR_LATER)) {
7524  lstr = "NPL-1.1+";
7525  }
7526  else if (INFILE(_TITLE_NPL11)) {
7527  lstr = "NPL-1.1";
7528  }
7529  else if (INFILE(_TITLE_NPL10)) {
7530  lstr = "NPL-1.0";
7531  }
7532  else if (URL_INFILE(_URL_NPL)) {
7533  lstr = (lDebug ? "NPL(url)" : "NPL");
7534  }
7535  else if (INFILE(_SPDX_MPL_10)) {
7536  lstr = "MPL-1.0";
7537  }
7538  else if (INFILE(_SPDX_MPL_11)) {
7539  lstr = "MPL-1.1";
7540  }
7541  else if (INFILE(_SPDX_MPL_20_no_copyleft_exception)) {
7542  lstr = "MPL-2.0-no-copyleft-exception";
7543  }
7544  else if (INFILE(_SPDX_MPL_20)) {
7545  lstr = "MPL-2.0";
7546  }
7547  else if (URL_INFILE(_URL_MPL_LATEST)) {
7548  lstr = (lDebug ? "MPL(latest)" : "MPL");
7549  }
7550  else if (URL_INFILE(_URL_MPL)) {
7551  lstr = (lDebug ? "MPL(url)" : "MPL");
7552  }
7553  else if (INFILE(_TITLE_NPL)) {
7554  lstr = "NPL";
7555  }
7556  else if (INFILE(_TITLE_MPL)) {
7557  lstr = "MPL";
7558  }
7559  else {
7560  lstr = (lDebug ? "MPL(last)" : "MPL");
7561  }
7562  return lstr;
7563 }
7564 
7573 char *realVersion(char *filetext, int size, int isML, int isPS, int ref)
7574 {
7575  char *lstr = NULL_STR;
7576 
7577 #ifdef PROC_TRACE
7578  traceFunc("== realVersion()\n");
7579 #endif /* PROC_TRACE */
7580 
7581  if (ref == _TITLE_RPSL) {
7582  if (INFILE(_TITLE_RPSL_V30)) {
7583  lstr = "RPSL-3.0";
7584  }
7585  else if (INFILE(_TITLE_RPSL_V20)) {
7586  lstr = "RPSL-2.0";
7587  }
7588  else if (INFILE(_TITLE_RPSL_V10)) {
7589  lstr = "RPSL-1.0";
7590  }
7591  else if (INFILE(_TITLE_RPSL)) {
7592  lstr = "RPSL";
7593  }
7594  }
7595  else if (ref == _TITLE_RCSL) {
7596  if (INFILE(_TITLE_RCSL_V30)) {
7597  lstr = "RCSL-3.0";
7598  }
7599  else if (INFILE(_TITLE_RCSL_V20)) {
7600  lstr = "RCSL-2.0";
7601  }
7602  else if (INFILE(_TITLE_RCSL_V10)) {
7603  lstr = "RCSL-1.0";
7604  }
7605  else if (INFILE(_TITLE_RCSL)) {
7606  lstr = "RCSL";
7607  }
7608  }
7609  else {
7610  lstr = "RealNetworks-Unknown";
7611  }
7612  return lstr;
7613 }
7614 
7623 char *pythonVersion(char *filetext, int size, int isML, int isPS)
7624 {
7625  char *lstr = NULL_STR;
7626 
7627 #ifdef PROC_TRACE
7628  traceFunc("== pythonVersion()\n");
7629 #endif /* PROC_TRACE */
7630 
7631  if (INFILE(_TITLE_PYTHON201)) {
7632  lstr = "Python-2.0.1";
7633  }
7634  else if (INFILE(_TITLE_PYTHON202)) {
7635  lstr = "Python-2.0.2";
7636  }
7637  else if (INFILE(_TITLE_PYTHON211)) {
7638  lstr = "Python-2.1.1";
7639  }
7640  else if (INFILE(_TITLE_PYTHON213)) {
7641  lstr = "Python-2.1.3";
7642  }
7643  else if (INFILE(_TITLE_PYTHON223)) {
7644  lstr = "Python-2.2.3";
7645  }
7646  else if (INFILE(_TITLE_PYTHON227)) {
7647  lstr = "Python-2.2.7";
7648  }
7649  else if (INFILE(_TITLE_PYTHON237)) {
7650  lstr = "Python-2.3.7";
7651  }
7652  else if (INFILE(_TITLE_PYTHON244)) {
7653  lstr = "Python-2.4.4";
7654  }
7655  else if (INFILE(_TITLE_PYTHON22)) {
7656  lstr = "Python-2.2";
7657  }
7658  else if (INFILE(_TITLE_PYTHON23)) {
7659  lstr = "Python-2.3";
7660  }
7661  else if (INFILE(_TITLE_PYTHON2)) {
7662  lstr = "Python-2.0";
7663  }
7664  else {
7665  lstr = "Python";
7666  }
7667  return lstr;
7668 }
7669 
7678 char *aflVersion(char *filetext, int size, int isML, int isPS)
7679 {
7680  char *lstr = NULL_STR;
7681 
7682 #ifdef PROC_TRACE
7683  traceFunc("== aflVersion()\n");
7684 #endif /* PROC_TRACE */
7685 
7686  if (INFILE(_TITLE_AFL30)) {
7687  lstr = lDebug? "AFL(v3.0#1)" : "AFL-3.0";
7688  }
7689  else if (INFILE(_TITLE_AFL21)) {
7690  lstr = lDebug? "AFL(v2.1#1)" : "AFL-2.1";
7691  }
7692  else if (INFILE(_TITLE_AFL20)) {
7693  lstr = lDebug? "AFL(v2.0#1)" : "AFL-2.0";
7694  }
7695  else if (INFILE(_TITLE_AFL12)) {
7696  lstr = lDebug? "AFL(v1.2#1)" : "AFL-1.2";
7697  }
7698  else if (INFILE(_TITLE_AFL11)) {
7699  lstr = lDebug? "AFL(v1.1#1)" : "AFL-1.1";
7700  }
7701  else if (INFILE(_TITLE_AFL10)) {
7702  lstr = lDebug? "AFL(v1.0#1)" : "AFL-1.0";
7703  }
7704  else {
7705  lstr = "AFL";
7706  }
7707  return lstr;
7708 }
7709 
7718 char *oslVersion(char *filetext, int size, int isML, int isPS)
7719 {
7720  char *lstr = NULL_STR;
7721  /* */
7722 #ifdef PROC_TRACE
7723  traceFunc("== oslVersion()\n");
7724 #endif /* PROC_TRACE */
7725  /* */
7726  if (INFILE(_TITLE_NON_PROFIT_OSL30)) {
7727  lstr = "NPOSL-3.0";
7728  }
7729  else if (INFILE(_TITLE_OSL30)) {
7730  lstr = lDebug? "OSL(v3.0#1)" : "OSL-3.0";
7731  }
7732  else if (INFILE(_TITLE_OSL21)) {
7733  lstr = lDebug? "OSL(v2.1#1)" : "OSL-2.1";
7734  }
7735  else if (INFILE(_TITLE_OSL20)) {
7736  lstr = lDebug? "OSL(v2.0#1)" : "OSL-2.0";
7737  }
7738  else if (INFILE(_TITLE_OSL11)) {
7739  lstr = lDebug? "OSL(v1.1#1)" : "OSL-1.1";
7740  }
7741  else if (INFILE(_TITLE_OSL10)) {
7742  lstr = lDebug? "OSL(v1.0#1)" : "OSL-1.0";
7743  }
7744  else {
7745  lstr = "OSL";
7746  }
7747  return lstr;
7748 }
7749 
7758 char *cddlVersion(char *filetext, int size, int isML, int isPS)
7759 {
7760  char *lstr = NULL_STR;
7761  /* */
7762 #ifdef PROC_TRACE
7763  traceFunc("== cddlVersion()\n");
7764 #endif /* PROC_TRACE */
7765  /* */
7766  if (INFILE(_TITLE_CDDL_10)) {
7767  lstr = "CDDL-1.0";
7768  }
7769  else if (INFILE(_SPDX_CDDL_10)) {
7770  INTERESTING("CDDL-1.0");
7771  }
7772  else if (URL_INFILE(_URL_CDDL_10)) {
7773  lstr = "CDDL-1.0";
7774  }
7775  else if (INFILE(_TITLE_CDDL_11)) {
7776  lstr = "CDDL-1.1";
7777  }
7778  else if (INFILE(_SPDX_CDDL_11)) {
7779  INTERESTING("CDDL-1.1");
7780  }
7781  else if (URL_INFILE(_URL_CDDL)) {
7782  lstr = "CDDL";
7783  }
7784  else {
7785  lstr = "CDDL";
7786  }
7787  return lstr;
7788 }
7789 
7798 char *lpplVersion(char *filetext, int size, int isML, int isPS)
7799 {
7800  char *lstr = NULL_STR;
7801  /* */
7802 #ifdef PROC_TRACE
7803  traceFunc("== lpplVersion()\n");
7804 #endif /* PROC_TRACE */
7805  /* */
7806  if (INFILE(_PHR_LATEX_PL13A_OR_LATER_1) ||
7807  INFILE(_PHR_LATEX_PL13A_OR_LATER_2)) {
7808  if (INFILE(_LT_LATEX_PREAMBLE)) {
7809  lstr = lDebug ? "LPPL-v1.3a(#1)" : "LPPL-1.3a";
7810  }
7811  else {
7812  lstr = "LPPL-1.3a+";
7813  }
7814  }
7815  else if (INFILE(_TITLE_LATEX_PL13A) || INFILE(_PHR_LATEX_PL13A)) {
7816  lstr = lDebug ? "LPPL-v1.3a(#2)" : "LPPL-1.3a";
7817  }
7818  else if (INFILE(_PHR_LATEX_PL13B_OR_LATER_1) ||
7819  INFILE(_PHR_LATEX_PL13B_OR_LATER_2)) {
7820  if (INFILE(_LT_LATEX_PREAMBLE)) {
7821  lstr = lDebug ? "LPPL-v1.3b(#1)" : "LPPL-1.3b";
7822  }
7823  else {
7824  lstr = "LPPL-1.3b+";
7825  }
7826  }
7827  else if (INFILE(_TITLE_LATEX_PL13B) || INFILE(_PHR_LATEX_PL13B)) {
7828  lstr = lDebug ? "LPPL-v1.3b(#2)" : "LPPL-1.3b";
7829  }
7830  else if (INFILE(_PHR_LATEX_PL13C_OR_LATER_1) ||
7831  INFILE(_PHR_LATEX_PL13C_OR_LATER_2)) {
7832  if (INFILE(_LT_LATEX_PREAMBLE)) {
7833  lstr = lDebug ? "LPPL-v1.3c(#1)" : "LPPL-1.3c";
7834  }
7835  else {
7836  lstr = "LPPL-1.3c+";
7837  }
7838  }
7839  else if (INFILE(_TITLE_LATEX_PL13C) || INFILE(_PHR_LATEX_PL13C)) {
7840  lstr = lDebug ? "LPPL-v1.3c(#2)" : "LPPL-1.3c";
7841  }
7842  else if (INFILE(_PHR_LATEX_PL13_OR_LATER_1) ||
7843  INFILE(_PHR_LATEX_PL13_OR_LATER_2)) {
7844  if (INFILE(_LT_LATEX_PREAMBLE)) {
7845  lstr = lDebug ? "LPPL-v1.3(#1)" : "LPPL-1.3";
7846  }
7847  else {
7848  lstr = "LPPL-1.3+";
7849  }
7850  }
7851  else if (INFILE(_TITLE_LATEX_PL13) || INFILE(_PHR_LATEX_PL13)) {
7852  lstr = lDebug ? "LPPL-v1.3(#2)" : "LPPL-1.3";
7853  }
7854  else if (INFILE(_PHR_LATEX_PL12_OR_LATER_1) ||
7855  INFILE(_PHR_LATEX_PL12_OR_LATER_2)) {
7856  if (INFILE(_LT_LATEX_PREAMBLE)) {
7857  lstr = lDebug ? "LPPL-v1.2(#1)" : "LPPL-1.2";
7858  }
7859  else {
7860  lstr = "LPPL-1.2+";
7861  }
7862  }
7863  else if (INFILE(_TITLE_LATEX_PL12) || INFILE(_PHR_LATEX_PL12)) {
7864  lstr = lDebug ? "LPPL-v1.2(#2)" : "LPPL-1.2";
7865  }
7866  else if (INFILE(_PHR_LATEX_PL11_OR_LATER_1) ||
7867  INFILE(_PHR_LATEX_PL11_OR_LATER_2)) {
7868  if (INFILE(_LT_LATEX_PREAMBLE)) {
7869  lstr = lDebug ? "LPPL-v1.1(#1)" : "LPPL-1.1";
7870  }
7871  else {
7872  lstr = "LPPL-1.1+";
7873  }
7874  }
7875  else if (INFILE(_TITLE_LATEX_PL11) || INFILE(_PHR_LATEX_PL11)) {
7876  lstr = lDebug ? "LPPL-v1.1(#2)" : "LPPL-1.1";
7877  }
7878  else if (INFILE(_PHR_LATEX_PL10_OR_LATER_1) ||
7879  INFILE(_PHR_LATEX_PL10_OR_LATER_2)) {
7880  if (INFILE(_LT_LATEX_PREAMBLE)) {
7881  lstr = lDebug ? "LPPL-v1.0(#1)" : "LPPL-1.0";
7882  }
7883  else {
7884  lstr = "LPPL-1.0+";
7885  }
7886  }
7887  else if (INFILE(_TITLE_LATEX_PL10) || INFILE(_PHR_LATEX_PL10)) {
7888  lstr = lDebug ? "LPPL-v1.0(#2)" : "LPPL-1.0";
7889  }
7890  else {
7891  lstr = "LPPL";
7892  }
7893  return lstr;
7894 }
7895 
7904 char *agplVersion(char *filetext, int size, int isML, int isPS)
7905 {
7906  char *lstr = NULL_STR;
7907  /* */
7908 #ifdef PROC_TRACE
7909  traceFunc("== agplVersion()\n");
7910 #endif /* PROC_TRACE */
7911  /* */
7912  /*
7913  * Look for version 1 BEFORE version 3; the text of version 1 license says
7914  * you can also license it under GPL version 3... same reasoning goes with
7915  * the actual v3 license (vs the reference).
7916  */
7917  if (INFILE(_PHR_AGPL_10_or_later)
7918  || INFILE(_TITLE_AGPL_10_or_later)
7919  || INFILE(_SPDX_AGPL_10_or_later)
7920  || HASTEXT(_SPDX_AGPL_10plus, REG_EXTENDED)
7921  || HASTEXT(_PHR_AGPL_10plus, REG_EXTENDED))
7922  {
7923  lstr = "AGPL-1.0+";
7924  }
7925  else if (INFILE(_PHR_FSF_V1_ONLY)
7926  || INFILE(_TITLE_AGPL_10_only)
7927  || INFILE(_SPDX_AGPL_10))
7928  {
7929  lstr = "AGPL-1.0";
7930  }
7931  else if (INFILE(_PHR_AGPL_30_or_later)
7932  || INFILE(_TITLE_AGPL_30_or_later_ref1)
7933  || INFILE(_TITLE_AGPL_30_or_later)
7934  || INFILE(_SPDX_AGPL_30_or_later)
7935  || HASTEXT(_SPDX_AGPL_30plus, REG_EXTENDED)
7936  || HASTEXT(_PHR_AGPL_30plus, REG_EXTENDED))
7937  {
7938  if (INFILE(_LT_AGPL_30)) {
7939  lstr = lDebug ? "Affero-v3(#1)" : "AGPL-3.0";
7940  }
7941  else {
7942  lstr = "AGPL-3.0+";
7943  }
7944  }
7945  else if (HASTEXT(_PHR_AGPL_30_1, REG_EXTENDED) || INFILE(_SPDX_AGPL_30)) {
7946  lstr = "AGPL-3.0";
7947  }
7948  else if (GPL_INFILE(_PHR_FSF_V3_ONLY)) {
7949  if (INFILE(_TITLE_GPL3)) {
7950  lstr = lDebug ? "GPLv3(Affero#1)" : "GPL-3.0";
7951  }
7952  else if (INFILE(_LT_GPL3ref3)){
7953  lstr = lDebug ? "GPLv3(special)" : "GPL-3.0";
7954  }
7955  else {
7956  lstr = lDebug ? "Affero-v3(#2)" : "AGPL-3.0";
7957  }
7958  }
7959  else if (INFILE(_TITLE_AGPL_30_only)) {
7960  lstr = lDebug ? "Affero-v3(#3)" : "AGPL-3.0";
7961  }
7962  else if (INFILE(_TITLE_GPL3)) {
7963  lstr = lDebug ? "GPLv3(Affero#2)" : "GPL-3.0";
7964  }
7965  else if (URL_INFILE(_URL_AGPL3)) {
7966  lstr = lDebug ? "Affero-v3(url)" : "AGPL-3.0";
7967  }
7968  else {
7969  lstr = "AGPL";
7970  }
7971  return lstr;
7972 }
7973 
7982 char *gfdlVersion(char *filetext, int size, int isML, int isPS)
7983 {
7984  char *lstr = NULL_STR;
7985  /* */
7986 #ifdef PROC_TRACE
7987  traceFunc("== gfdlVersion()\n");
7988 #endif /* PROC_TRACE */
7989  /* */
7990  /*
7991  * Have to be careful here; the text of the 1.2 license says it's licensed
7992  * under 1.1 or later - have to be careful what we're looking for, and in a
7993  * specific order
7994  */
7995  if (INFILE(_TITLE_GFDL_V13_FULL_LICENSE)) {
7996  lstr = "GFDL-1.3";
7997  /* Full GFDL-1.3 license text has a reference to Creative Commons */
7998  if (HASTEXT(_LT_CC_ref, REG_EXTENDED)) {
7999  lmem[_fCCBY] = 1;
8000  }
8001  }
8002  else if (INFILE(_TITLE_GFDL_V13_OR_LATER)) {
8003  lstr = "GFDL-1.3+";
8004  }
8005  else if (INFILE(_TITLE_GFDL_V13_ONLY)) {
8006  lstr = lDebug ? "GFDL-1.3(#1)" : "GFDL-1.3";
8007  }
8008  else if (INFILE(_TITLE_GFDL_V12_FULL_LICENSE)) {
8009  lstr = lDebug ? "GFDL-1.2(#1)" : "GFDL-1.2";
8010  }
8011  else if (INFILE(_PHR_FSF_V12_OR_LATER) ||
8012  INFILE(_TITLE_GFDL_V12_OR_LATER)) {
8013  lstr = "GFDL-1.2+";
8014  }
8015  else if (INFILE(_TITLE_GFDL_V12_ONLY)) {
8016  lstr = lDebug ? "GFDL-1.2(#1)" : "GFDL-1.2";
8017  }
8018  else if (INFILE(_TITLE_GFDL_V11_FULL_LICENSE)) {
8019  lstr = lDebug ? "GFDL-1.1(#1)" : "GFDL-1.1";
8020  }
8021  else if (INFILE(_PHR_FSF_V11_OR_LATER) ||
8022  INFILE(_TITLE_GFDL_V11_OR_LATER)) {
8023  lstr = "GFDL-1.1+";
8024  }
8025  else if (INFILE(_TITLE_GFDL_V11_ONLY)) {
8026  lstr = lDebug ? "GFDL-1.1(#1)" : "GFDL-1.1";
8027  }
8028  else if (INFILE(_PHR_FSF_V12_ONLY)) {
8029  lstr = lDebug ? "GFDL-1.2(#2)" : "GFDL-1.2";
8030  }
8031  else if (INFILE(_PHR_FSF_V11_ONLY)) {
8032  lstr = lDebug ? "GFDL-1.1(#2)" : "GFDL-1.1";
8033  }
8034  else {
8035  lstr = "GFDL";
8036  }
8037  return lstr;
8038 }
8039 
8048 char *lgplVersion(char *filetext, int size, int isML, int isPS)
8049 {
8050  char *lstr = NULL_STR;
8051  /* */
8052 #ifdef PROC_TRACE
8053  traceFunc("== lgplVersion()\n");
8054 #endif /* PROC_TRACE */
8055  /* */
8056  if ((INFILE(_PHR_LGPL21_OR_LATER_1)
8057  || INFILE(_PHR_LGPL21_OR_LATER_2)
8058  || HASTEXT(_PHR_LGPL21_OR_LATER_3, REG_EXTENDED)
8059  || HASTEXT(_PHR_LGPL21_OR_LATER_4, REG_EXTENDED))
8060  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
8061  {
8062  if (INFILE(_TITLE_LGPL_KDE)) {
8063  lstr = "LGPL-2.1+-KDE-exception";
8064  }
8065  else {
8066  lstr = "LGPL-2.1+";
8067  }
8068  }
8069  else if ((INFILE(_PHR_LGPL3_OR_LATER)
8070  || INFILE(_PHR_LGPL3_OR_LATER_ref1)
8071  || INFILE(_PHR_LGPL3_OR_LATER_ref2)
8072  || HASTEXT(_PHR_LGPL3_OR_LATER_ref3, REG_EXTENDED)
8073  || HASTEXT(_SPDX_LGPL_30plus, REG_EXTENDED)
8074  || HASTEXT(_PHR_LGPL_30plus, REG_EXTENDED))
8075  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
8076  {
8077  lstr = "LGPL-3.0+";
8078  }
8079  else if (INFILE(_LT_LGPL3ref) && NOT_INFILE(_PHR_NOT_UNDER_LGPL)) {
8080  lstr = "LGPL-3.0";
8081  lmem[_mLGPL] = 1;
8082  }
8083  else if (GPL_INFILE(_PHR_LGPL3_ONLY)
8084  || INFILE(_FILE_LGPLv3)
8085  || GPL_INFILE(_PHR_LGPL3_ONLY_ref1)
8086  || GPL_INFILE(_PHR_LGPL3_ONLY_ref2))
8087  {
8088  lstr = "LGPL-3.0";
8089  }
8090  else if (INFILE(_PHR_LGPL21_ONLY)
8091  || INFILE(_FILE_LGPLv21)
8092  || URL_INFILE(_URL_LGPL_V21)
8093  || INFILE(_PHR_LGPL21_ONLY_ref)
8094  || INFILE(_PHR_LGPL21_ONLY_ref2)
8095  || INFILE(_PHR_LGPL21_ONLY_ref3)
8096  || INFILE(_PHR_LGPL21_ONLY_ref4))
8097  {
8098  lstr = "LGPL-2.1";
8099  }
8100  else if ((INFILE(_PHR_LGPL2_OR_LATER)
8101  || HASTEXT(_PHR_LGPL2_OR_LATER_2, REG_EXTENDED)
8102  || HASTEXT(_PHR_LGPL2_OR_LATER_3, REG_EXTENDED))
8103  && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED))
8104  {
8105  lstr = "LGPL-2.0+";
8106  }
8107  else if (RM_INFILE(_PHR_LGPL2_ONLY) || RM_INFILE(_PHR_LGPL2_ONLY_ref1) || INFILE(_FILE_LGPLv2)) {
8108  lstr = "LGPL-2.0";
8109  }
8110  else if (INFILE(_PHR_LGPL1_OR_LATER) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8111  lstr = "LGPL-1.0+";
8112  }
8113  else if (INFILE(_PHR_LGPL1_ONLY) || INFILE(_PHR_FSF_V1_ONLY)) {
8114  lstr = "LGPL-1.0";
8115  }
8116  else if (URL_INFILE(_URL_CCLGPL_V21)) {
8117  lstr = lDebug ? "CC-LGPL-2.1" : "LGPL-2.1";
8118  }
8119  else if (INFILE(_LT_CC_GPL) || INFILE(_TITLE_CC_LGPL)) {
8120  lstr = "CC-LGPL";
8121  }
8122  else if (NY_INFILE(_TEXT_LGPLV3) && NOT_INFILE(_TEXT_LGPLV3_FOOTNOTE) &&
8123  HASREGEX(_TEXT_LGPLV3, filetext)) {
8124  lstr = lDebug ? "LGPL-v3(#2)" : "LGPL-3.0";
8125  }
8126  else if (INFILE(_TEXT_LGPLV21) &&
8127  HASREGEX(_TEXT_LGPLV21, filetext)) {
8128  lstr = lDebug ? "LGPL-v2.1(#2)" : "LGPL-2.1";
8129  }
8130  else if (INFILE(_TEXT_LGPLV2) &&
8131  HASREGEX(_TEXT_LGPLV2, filetext)) {
8132  lstr = lDebug ? "LGPL-v2(#2)" : "LGPL-2.0";
8133  }
8134  else if (INFILE(_SPDX_LGPL_20)) {
8135  lstr = "LGPL-2.0";
8136  }
8137  else if (INFILE(_SPDX_LGPL_21)) {
8138  lstr = "LGPL-2.1";
8139  }
8140  else if (INFILE(_SPDX_LGPL_30)) {
8141  lstr = "LGPL-3.0";
8142  }
8143  else {
8144  lstr = "LGPL";
8145  }
8146  return lstr;
8147 }
8148 
8157 char *gplVersion(char *filetext, int size, int isML, int isPS)
8158 {
8159  char *cp, *lstr = NULL_STR;
8160  /* */
8161 #ifdef PROC_TRACE
8162  traceFunc("== gplVersion()\n");
8163 #endif /* PROC_TRACE */
8164  /* */
8165 
8166  if (INFILE(_PHR_GPL21_OR_LATER) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8167  lstr = "GPL-2.1+[sic]";
8168  }
8169  else if ((GPL_INFILE(_PHR_GPL3_ONLY)
8170  || INFILE(_FILE_GPLv3)
8171  || GPL_INFILE(_PHR_GPL3_ONLY_ref1)
8172  || GPL_INFILE(_PHR_GPL3_ONLY_ref2))
8173  && INFILE(_PHR_GPL2_OR_LATER_1))
8174  {
8175  lstr = "GPL-2.0+,GPL-3.0";
8176  }
8177  else if (HASTEXT(_LT_GPL_V2_NAMED_later, REG_EXTENDED) || INFILE(_TITLE_GPL2_ref1_later)) {
8178  lstr = lDebug ? "GPLV2+(named)" : "GPL-2.0+";
8179  }
8180  else if (INFILE(_PHR_GPL2_OR_LATER_1)) {
8181  if (INFILE(_TITLE_GPL_KDE)) {
8182  lstr = "GPL-2.0+KDEupgradeClause";
8183  }
8184  else if (INFILE(_PHR_GPL2_ONLY_2) || INFILE(_PHR_GPL2_ONLY_3)) {
8185  lstr = "GPL-2.0";
8186  }
8187  else if (GPL_INFILE(_PHR_GPL3_OR_LATER_ref2) || GPL_INFILE(_PHR_GPL3_OR_LATER_ref3)
8188  || GPL_INFILE(_PHR_GPL3_OR_LATER) || GPL_INFILE(_PHR_GPL3_OR_LATER_ref1)) {
8189  lstr = "GPL-2.0+,GPL-3.0+";
8190  }
8191  else if (!HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8192  lstr = lDebug ? "PHR(GPL2_OR_LATER#3)" : "GPL-2.0+";
8193  }
8194  else if (INFILE(_TITLE_GPL2_ref1) || INFILE(_TITLE_GPL2_ref2)) {
8195  lstr = lDebug ? "GPL-2.0(title)" : "GPL-2.0";
8196  }
8197  }
8198  else if (INFILE(_PHR_GPL2_ONLY_4)) {
8199  lstr = "GPL-2.0";
8200  }
8201  else if (INFILE(_PHR_GPL2_ONLY_5)) {
8202  lstr = "GPL-2.0";
8203  }
8204  else if (GPL_INFILE(_PHR_GPL2_OR_GPL3)) {
8205  lstr = "GPL-2.0,GPL-3.0";
8206  }
8207  else if (GPL_INFILE(_PHR_GPL3_OR_LATER_ref2)
8208  || GPL_INFILE(_PHR_GPL3_OR_LATER_ref3)
8209  || GPL_INFILE(_PHR_GPL3_OR_LATER)
8210  || GPL_INFILE(_PHR_GPL3_OR_LATER_ref1)
8211  || HASTEXT(_SPDX_GPL_30plus, REG_EXTENDED)
8212  || HASTEXT(_PHR_GPL_30plus, REG_EXTENDED))
8213  {
8214  if (!HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8215  lstr = "GPL-3.0+";
8216  }
8217  }
8218  else if (GPL_INFILE(_PHR_FSF_V3_ONLY) || GPL_INFILE(_PHR_GPL3_ONLY) ||
8219  INFILE(_FILE_GPLv3) || GPL_INFILE(_PHR_GPL3_ONLY_ref1) || GPL_INFILE(_PHR_GPL3_ONLY_ref2)) {
8220  lstr = lDebug ? "GPL-v3(#2)" : "GPL-3.0";
8221  }
8222  else if (INFILE(_PHR_FSF_V21_ONLY) || INFILE(_PHR_GPL21_ONLY)) {
8223  lstr = lDebug ? "GPL-v2.1[sic]" : "GPL-2.1[sic]";
8224  }
8225  else if (INFILE(_PHR_FSF_V2_ONLY) || INFILE(_PHR_GPL2_ONLY) || INFILE(_PHR_GPL2_ONLY_1) ||
8226  INFILE(_FILE_GPLv2) || INFILE(_LT_GPL_V2_NAMED)) {
8227  lstr = lDebug ? "GPL-v2(#2)" : "GPL-2.0";
8228  }
8229  else if (GPL_INFILE(_PHR_FSF_V1_OR_LATER)
8230  || INFILE(_PHR_GPL1_OR_LATER)
8231  || HASTEXT(_SPDX_GPL_10plus, REG_EXTENDED)
8232  || HASTEXT(_PHR_GPL_10plus, REG_EXTENDED))
8233  {
8234  if (INFILE(_TITLE_GPL1)) {
8235  lstr = lDebug ? "GPL-v1(#1)" : "GPL-1.0";
8236  }
8237  else if (!HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8238  lstr = "GPL-1.0+";
8239  }
8240  }
8241  else if (INFILE(_PHR_FSF_V1_ONLY) || INFILE(_PHR_GPL1_ONLY)) {
8242  lstr = lDebug ? "GPL-v1(#2)" : "GPL-1.0";
8243  }
8244  else if (URL_INFILE(_URL_CCGPL_V2)) {
8245  lstr = "GPL-2.0";
8246  }
8247  else if (INFILE(_LT_GPL_V2_ref5)) {
8248  lstr = lDebug ? "GPL-2.0(ref5)" : "GPL-2.0";
8249  }
8250  else if (INFILE(_LT_CC_GPL) || INFILE(_TITLE_CC_GPL)) {
8251  lstr = lDebug ? "GPL(CC_GPL)" : "GPL";
8252  }
8253  else if (NY_INFILE(_TEXT_GPLV3) && NOT_INFILE(_TEXT_GPLV3_FOOTNOTE) &&
8254  HASREGEX(_TEXT_GPLV3, filetext)) {
8255  lstr = lDebug ? "GPL-v3(#3)" : "GPL-3.0";
8256  }
8257  else if (NY_INFILE(_TEXT_GPLV2)) {
8258  lstr = lDebug ? "GPL-v2(#3)" : "GPL-2.0";
8259  }
8260  else if (NY_INFILE(_TEXT_GPLV1) &&
8261  HASREGEX(_TEXT_GPLV1, filetext)) {
8262  lstr = lDebug ? "GPL-v1(#3)" : "GPL-1.0";
8263  }
8264  else if (HASTEXT(_SPDX_GPL_10, REG_EXTENDED)) {
8265  lstr = lDebug ? "GPL-1.0(SPDX)" : "GPL-1.0";
8266  }
8267  else if (HASTEXT(_SPDX_GPL_20, REG_EXTENDED)) {
8268  lstr = lDebug ? "GPL-2.0(SPDX)" : "GPL-2.0";
8269  }
8270  else if (HASTEXT(_SPDX_GPL_30, REG_EXTENDED)) {
8271  lstr = lDebug ? "GPL-3.0(SPDX)" : "GPL-3.0";
8272  }
8273  /* special case for Debian copyright files
8274  Moved from the beginning here under else if ... is this anymore needed
8275  */
8276  else if (INFILE(_TEXT_GPLV3_CR) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
8277  lstr = "GPL-3.0";
8278  }
8279  else if (INFILE(_FILE_GPL1) || INFILE(_FILE_GPL2)) {
8280  lstr = lDebug ? "GPL(deb)" : "GPL";
8281  }
8282  /*
8283  * MODULE("GPL") cannot be unambiguously interpreted as GPL-2.0
8284  * license. Same statement is used also outside Linux kernel.
8285  * Furthermore, many of the files which have this MODULE statement,
8286  * have explicit GPL license statement. Therefore this is changed
8287  * to GPL.
8288  */
8289  else if (INFILE(_TITLE_MODULE_LICENSE_GPL)) {
8290  lstr = lDebug ? "GPL(linux-kernel)" : "GPL";
8291  }
8292  /*
8293  * Special case, HACK: "Debian packaging ... licensed under GPL"
8294  *****
8295  * IF we've scanned the regex that might contain it, then kludge.buf != NULL.
8296  * Make darn sure that pointer IS set to NULL before leaving this routine.
8297  */
8298  if (lstr == NULL_STR && kludge.base != NULL_STR) {
8299 #ifdef PHRASE_DEBUG
8300  printf("GPL-META-CHECK: base %p, so %d eo %d\n",
8301  kludge.base, kludge.sso, kludge.seo);
8302 #endif /* PHRASE_DEBUG */
8303  cp = kludge.base + (kludge.sso < 256 ? 0 : kludge.sso-256);
8304  if (HASREGEX(_LT_GPL_META_DEBIAN, cp)) {
8305  lstr = "GPL-Meta";
8306  }
8307  kludge.base = NULL_STR;
8308  }
8309  if (lstr == NULL_STR && NOT_INFILE(_PHR_JYTHON_NOTGPL) && !HASTEXT(_TITLE_QT_GPL_EXCEPTION_10, 0)) {
8310  lstr = lDebug ? "GPL(NULL)" : "GPL";
8311  }
8312  return lstr;
8313 }
8314 
8323 char *cplVersion(char *filetext, int size, int isML, int isPS)
8324 {
8325  char *lstr = NULL_STR;
8326  /* */
8327 #ifdef PROC_TRACE
8328  traceFunc("== cplVersion()\n");
8329 #endif /* PROC_TRACE */
8330  /* */
8331  if (INFILE(_TITLE_CPL_10)) {
8332  lstr = "CPL-1.0";
8333  }
8334  else if (URL_INFILE(_URL_CPL_10)) {
8335  lstr = "CPL-1.0";
8336  }
8337  else if (INFILE(_TITLE_CPL_05)) {
8338  lstr = "CPL-0.5";
8339  }
8340  else {
8341  lstr = "CPL";
8342  }
8343  return lstr;
8344 }
8345 
8354 char *ccVersion(char *filetext, int size, int isML, int isPS)
8355 {
8356  char *lstr = NULL_STR;
8357  /* */
8358 #ifdef PROC_TRACE
8359  traceFunc("== ccVersion()\n");
8360 #endif /* PROC_TRACE */
8361  /*
8362  * Creative Commons Attribution-ShareAlike
8363  */
8364  if (INFILE(_TITLE_CC_BY_SA_10) || URL_INFILE(_URL_CC_BY_SA_10)) {
8365  lstr = "CC-BY-SA-1.0";
8366  }
8367  else if (INFILE(_TITLE_CC_BY_SA_20) || URL_INFILE(_URL_CC_BY_SA_20)) {
8368  lstr = "CC-BY-SA-2.0";
8369  }
8370  else if (INFILE(_TITLE_CC_BY_SA_25) || URL_INFILE(_URL_CC_BY_SA_25)) {
8371  lstr = "CC-BY-SA-2.5";
8372  }
8373  else if (INFILE(_TITLE_CC_BY_SA_30) || URL_INFILE(_URL_CC_BY_SA_30)) {
8374  lstr = "CC-BY-SA-3.0";
8375  }
8376  else if (INFILE(_PHR_CC_BY_SA_30)) {
8377  lstr = "CC-BY-SA-3.0";
8378  }
8379  else if (INFILE(_TITLE_CC_BY_SA_40) || URL_INFILE(_URL_CC_BY_SA_40)) {
8380  lstr = "CC-BY-SA-4.0";
8381  }
8382  else if (URL_INFILE(_URL_CC_BY_SA_20)) {
8383  lstr = "CC-BY-SA-2.0";
8384  }
8385  else if (INFILE(_TITLE_CC_BY_SA) || URL_INFILE(_URL_CC_BY_SA)) {
8386  lstr = lDebug ? "CCA-SA(1)" : "CC-BY-SA";
8387  }
8388  /*
8389  * Creative Commons Attribution-NonCommercial-ShareAlike
8390  */
8391  else if (INFILE(_TITLE_CC_BY_NC_SA_40) || URL_INFILE(_URL_CC_BY_NC_SA_40)) {
8392  lstr = "CC-BY-NC-SA-4.0";
8393  }
8394  else if (INFILE(_TITLE_CC_BY_NC_SA_30) || URL_INFILE(_URL_CC_BY_NC_SA_30)) {
8395  lstr = "CC-BY-NC-SA-3.0";
8396  }
8397  else if (INFILE(_TITLE_CC_BY_NC_SA_25) || URL_INFILE(_URL_CC_BY_NC_SA_25)) {
8398  lstr = "CC-BY-NC-SA-2.5";
8399  }
8400  else if (INFILE(_TITLE_CC_BY_NC_SA_20) || URL_INFILE(_URL_CC_BY_NC_SA_20)) {
8401  lstr = "CC-BY-NC-SA-2.0";
8402  }
8403  else if (INFILE(_TITLE_CC_BY_NC_SA_10) || URL_INFILE(_URL_CC_BY_NC_SA_10)) {
8404  lstr = "CC-BY-NC-SA-1.0";
8405  }
8406  /*
8407  * Creative Commons NonCommercial NoDerivs
8408  */
8409  else if (INFILE(_TITLE_CC_BY_NC_ND_40) || URL_INFILE(_URL_CC_BY_NC_ND_40)) {
8410  lstr = "CC-BY-NC-ND-4.0";
8411  }
8412  else if (INFILE(_TITLE_CC_BY_NC_ND_30) || URL_INFILE(_URL_CC_BY_NC_ND_30)) {
8413  lstr = "CC-BY-NC-ND-3.0";
8414  }
8415  else if (INFILE(_TITLE_CC_BY_NC_ND_25) || URL_INFILE(_URL_CC_BY_NC_ND_25)) {
8416  lstr = "CC-BY-NC-ND-2.5";
8417  }
8418  else if (INFILE(_TITLE_CC_BY_NC_ND_20) || URL_INFILE(_URL_CC_BY_NC_ND_20)) {
8419  lstr = "CC-BY-NC-ND-2.0";
8420  }
8421  else if (INFILE(_TITLE_CC_BY_NC_ND_10) || INFILE(_TITLE_CC_BY_NC_ND_10_1) || URL_INFILE(_URL_CC_BY_NC_ND_10)) {
8422  lstr = "CC-BY-NC-ND-1.0";
8423  }
8424  /*
8425  * Creative Commons NonCommercial
8426  */
8427  else if (INFILE(_TITLE_CC_BY_NC_40) || URL_INFILE(_URL_CC_BY_NC_40)) {
8428  lstr = "CC-BY-NC-4.0";
8429  }
8430  else if (INFILE(_TITLE_CC_BY_NC_30) || URL_INFILE(_URL_CC_BY_NC_30)) {
8431  lstr = "CC-BY-NC-3.0";
8432  }
8433  else if (INFILE(_TITLE_CC_BY_NC_25) || URL_INFILE(_URL_CC_BY_NC_25)) {
8434  lstr = "CC-BY-NC-2.5";
8435  }
8436  else if (INFILE(_TITLE_CC_BY_NC_20) || URL_INFILE(_URL_CC_BY_NC_20)) {
8437  lstr = "CC-BY-NC-2.0";
8438  }
8439  else if (INFILE(_TITLE_CC_BY_NC_10) || URL_INFILE(_URL_CC_BY_NC_10)) {
8440  lstr = "CC-BY-NC-1.0";
8441  }
8442  /*
8443  * Creative Commons Attribution-NoDerivatives
8444  */
8445  else if (INFILE(_TITLE_CC_BY_ND_40) || URL_INFILE(_URL_CC_BY_ND_40)) {
8446  lstr = "CC-BY-ND-4.0";
8447  }
8448  else if (INFILE(_TITLE_CC_BY_ND_30) || URL_INFILE(_URL_CC_BY_ND_30)) {
8449  lstr = "CC-BY-ND-3.0";
8450  }
8451  else if (INFILE(_TITLE_CC_BY_ND_25) || URL_INFILE(_URL_CC_BY_ND_25)) {
8452  lstr = "CC-BY-ND-2.5";
8453  }
8454  else if (INFILE(_TITLE_CC_BY_ND_20) || URL_INFILE(_URL_CC_BY_ND_20)) {
8455  lstr = "CC-BY-ND-2.0";
8456  }
8457  else if (INFILE(_TITLE_CC_BY_ND_10) || URL_INFILE(_URL_CC_BY_ND_10)) {
8458  lstr = "CC-BY-ND-1.0";
8459  }
8460  /*
8461  * Creative Commons Attribution
8462  */
8463  else if (INFILE(_TITLE_CC_BY_10) || URL_INFILE(_URL_CC_BY_10)) {
8464  lstr = "CC-BY-1.0";
8465  }
8466  else if (INFILE(_TITLE_CC_BY_20) || URL_INFILE(_URL_CC_BY_20)) {
8467  lstr = "CC-BY-2.0";
8468  }
8469  else if (INFILE(_TITLE_CC_BY_25) || URL_INFILE(_URL_CC_BY_25)) {
8470  lstr = "CC-BY-2.5";
8471  }
8472  else if (INFILE(_TITLE_CC_BY_30) || URL_INFILE(_URL_CC_BY_30)) {
8473  lstr = "CC-BY-3.0";
8474  }
8475  else if (INFILE(_TITLE_CC_BY_40) || URL_INFILE(_URL_CC_BY_40)) {
8476  lstr = "CC-BY-4.0";
8477  }
8478  /*
8479  * Creative Commons CC0
8480  */
8481  else if (INFILE(_TITLE_CC0_10_2)) {
8482  lstr = lDebug ? "CC0(2)" : "CC0-1.0";
8483  }
8484  else if (INFILE(_PHR_CC0_2)) {
8485  lstr = lDebug ? "CC0(2)" : "CC0-1.0";
8486  }
8487  else if (URL_INFILE(_URL_CC0)) {
8488  lstr = lDebug ? "CC0(URL)" : "CC0-1.0";
8489  }
8490  else if (URL_INFILE(_URL_CC_PD)) {
8491  lstr = lDebug ? "CC(PD)" : "Public-domain";
8492  }
8493  else if (INFILE(_TITLE_CCPL)) {
8494  INTERESTING("CCPL");
8495  }
8496  else if (INFILE(_TITLE_CC_BY)) {
8497  lstr = lDebug ? "CCA(1)" : "CC-BY";
8498  }
8499  else {
8500  lstr = lDebug ? "CCA(def)" : "CC-BY";
8501  }
8502  lmem[_fCCBY] = 1;
8503  return lstr;
8504 }
8505 
8522 int findPhrase(int index, char *filetext, int size, int isML, int isPS,
8523  int qType)
8524 {
8525  char *ptr = NULL_STR;
8526  char *q = ltsr+index;
8527  char *cp = 0;
8528  int ret;
8529  int i;
8530  int j;
8531  int n;
8532  int wordMatch = 0;
8533  int metaKludge = 0;
8534  int saved = 0;
8535  int sso;
8536  int seo;
8537  item_t *sp;
8538  item_t *op;
8539  list_t *lp;
8540  licText_t *ltp;
8541 #ifdef PARSE_STOPWATCH
8542  DECL_TIMER; /* timer declaration */
8543  char timerName[64];
8544 #endif /* PARSE_STOPWATCH */
8545 
8546 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG) || defined(DOCTOR_DEBUG)
8547  traceFunc("== findPhrase(%d, %p, %d, %d, %d, %d)\n", index, filetext,
8548  size, isML, isPS, qType);
8549  traceFunc("... (regex) \"%s\"\n", _REGEX(index));
8550  traceFunc("... (seed) \"%s\"\n", _SEED(index));
8551 #endif /* PROC_TRACE || PHRASE_DEBUG || DOCTOR_DEBUG */
8552 
8553  ltp = licText + index; /* &licText[index] */
8554  if (ltp->tseed == NULL_STR) {
8555  LOG_FATAL("Regex #%d not suitable for findPhrase()", index)
8556  Bail(-__LINE__);
8557  }
8558  *q |= LTSR_SMASK; /* init: tested, no match */
8559 #ifdef PARSE_STOPWATCH
8560  (void) sprintf(timerName, "findPhrase(%03d): ", index);
8561  START_TIMER;
8562 #endif /* PARSE_STOPWATCH */
8563 #if (DEBUG > 5)
8564  printf("findPhrase: firstword[%d] == \"%s\", used = %d\n", index,
8565  ltp->tseed, searchList.used);
8566 #endif /* DEBUG > 5 */
8567  /*
8568  * See if the first-word of the requested entry has been searched
8569  * previously. The entry we get from listGetItem() refCount (val) field is:
8570  * =0 if this is the first search for this word (non-zero == "seen it"!)
8571  * <0 if the word was NOT FOUND
8572  * >0 if we have doctored-text results cached
8573  */
8574  if ((sp = listGetItem(&searchList, ltp->tseed)) == NULL_ITEM) {
8575  LOG_FATAL("search cache")
8576  Bail(-__LINE__);
8577  }
8578  if (sp->refCount < 0) { /* tseed not found in text */
8579  sp->refCount--;
8580 #ifdef PARSE_STOPWATCH
8581  END_TIMER; /* stop the timer */
8582  (void) strcat(timerName, "Cache-NO - ");
8583  (void) strcat(timerName, ltp->tseed);
8584  PRINT_TIMER(timerName, 0);
8585 #endif /* PARSE_STOPWATCH */
8586  return(0);
8587  }
8588  else if (sp->refCount == 0) { /* e.g., first occurence */
8589 
8590  /*
8591  * Since this is the first search of this word, see if it's in the text.
8592  * NOTE: getInstances() returns a pointer to static (non-allocated) storage
8593  */
8594  if ((cur.nLines) <= 5) {
8595  i = 1;
8596  j = 2;
8597  } else if ((size / cur.nLines) <= 10) {
8598  i = 2;
8599  j = 4;
8600  } else {
8601  i = 3;
8602  j = 6;
8603  }
8604 
8605  /* change to not get record offsets since there is a good sized memory
8606  leak in that code */
8607  //ptr = getInstances(filetext, size, i, j, sp->str, YES);
8608  ptr = getInstances(filetext, size, i, j, sp->str, NO);
8609 
8610  if (ptr == NULL_STR) {
8611  sp->refCount = -1;
8612  /* sp->buf = NULL_STR; */
8613 #ifdef PARSE_STOPWATCH
8614  END_TIMER; /* stop the timer */
8615  (void) strcat(timerName, "tseed-NO - ");
8616  (void) strcat(timerName, ltp->tseed);
8617  PRINT_TIMER(timerName, 0);
8618 #endif /* PARSE_STOPWATCH */
8619  return(0); /* known !match */
8620  }
8621  sp->buf = copyString(ptr, "paragraph");
8622 #ifdef MEMSTATS
8623  printf("... adding %d bytes (search-lookup: \"%s\")\n",
8624  strlen(sp->buf), sp->str);
8625 #endif /* MEMSTATS */
8626  /*
8627  * If the search-seed and regex are the same, we found what we're looking
8628  * for. Else, use doctorBuffer() to strip out punctuation, XML/HTML
8629  * directives, etc.
8630  */
8631 #ifdef PARSE_STOPWATCH
8632  START_TIMER;
8633 #endif /* PARSE_STOPWATCH */
8634 #ifdef DOCTOR_DEBUG
8635  printf(" ... doctoring buffer for \"%s\"\n", sp->str);
8636 #endif /* DOCTOR_DEBUG */
8637  (void) doctorBuffer(sp->buf, isML, isPS, NO);
8638 #ifdef PARSE_STOPWATCH
8639  RESET_TIMER;
8640  (void) sprintf(timerName, "... doctor(%03d): %s (%d)",
8641  index, ltp->tseed, strlen(sp->buf));
8642  PRINT_TIMER(timerName, 0);
8643 #endif /* PARSE_STOPWATCH */
8644  }
8645  sp->refCount++; /* incr ref-count for this seed */
8646  /*
8647  * We need populate the list of "paragraph matches" with offsets in the
8648  * doctored-up buffers; this seems the best place to do it.
8649  */
8650  op = listGetItem(&cur.offList, sp->str);
8651  if (op->nMatch <= 0) {
8652  LOG_FATAL("File-offset list, nMatch(%s): bad entry", sp->str)
8653  Bail(-__LINE__);
8654  }
8655 #if DEBUG>5
8656  printf("matches for key \"%s\": %d\n", sp->str, op->nMatch);
8657 #endif /* DEBUG>5 */
8658  n = strlen(sp->buf);
8659  lp = (list_t *)op->bList;
8660  if ((lp) && (lp->items[0].bDocLen == 0)) {
8661  if (op->nMatch == 1) {
8662  lp->items[0].bDocLen = n;
8663  } else {
8664  ptr = sp->buf;
8665  i = j = 0; /* i is index, j is total offset */
8666  while (strGrep(" xyzzy ", ptr, REG_ICASE)) {
8667  lp->items[i++].bDocLen = j + cur.regm.rm_so;
8668  ptr += cur.regm.rm_eo;
8669  j += (cur.regm.rm_eo + 7); /* strlen(" xyzzy ") */
8670  }
8671  lp->items[i].bDocLen = n + 7; /* last paragraph */
8672  }
8673  }
8674  if (ltp->tseed == ltp->regex) { /* e.g., regex IS seed/key */
8675  wordMatch++;
8676  ret = 1;
8677  } else {
8678  metaKludge = ((qType == 2) && (index == _LT_GPLref1));
8679  if (metaKludge || qType == 4) {
8680  saved = 1;
8681  gl.flags |= FL_SAVEBASE;
8682  }
8683  ret = HASREGEX_RI(index, sp->buf);
8684  if (saved) {
8685  if (ret) {
8686  kludge.base = cur.matchBase;
8687  kludge.sso = cur.regm.rm_so;
8688  kludge.seo = cur.regm.rm_eo;
8689  }
8690  gl.flags &= ~FL_SAVEBASE;
8691  }
8692  }
8693  sso = cur.regm.rm_so; /* do NOT modify this!! */
8694  seo = cur.regm.rm_eo; /* ... or this, either! */
8695  if (ret && !wordMatch) {
8696  *q = LTSR_YES; /* remember this "yes" search result */
8697 
8698  /*
8699  * VERY low-level string-search kludges happen here. This is VERY ugly!!
8700  *****
8701  * If we used idxGrep to search for "GPL" in a "doctored" buffer, we do NOT
8702  * want to match "lesser GPL" or "library GPL" in our searches (it's the
8703  * wrong license name/title). Unfortunately, two aliases for LGPL are
8704  * exactly those above. If we match "GPL" with a wildcard preceeding it, it
8705  * JUST MIGHT BE those words. Rather than perform 2 exclusionary searches
8706  * one for "lesser gpl" and another for "library gpl", look here and if we
8707  * find it, (ugh) KLUDGE the return value to indicate "no match"...
8708  *****
8709  * However, since it's here, it's now extensible. Next search-string kludge
8710  * (that cannot be quickly fixed via changing a regex) should be number 2.
8711  * Just make a new macro (defined above parseLicenses), ala GPL_INFILE().
8712  */
8713  if ((qType > 0) && !wordMatch) {
8714  if ((qType > 4) || (qType < 0)) {
8715  LOG_FATAL("Unknown string-search kludge %d", qType)
8716  Bail(-__LINE__);
8717  }
8718  /*
8719  * Special filter #1: over-write matched text with commas -- this choice is
8720  * significant because doctorBuffer() ensures 'stripped' text has no commas
8721  */
8722  if (qType == 1) { /* destroy text-match */
8723  cp = sp->buf+seo;
8724  ptr = sp->buf+sso;
8725  ltsr[index] = 0; /* reset search cache */
8726  while (ptr <= cp) {
8727  *ptr++ = ',';
8728  }
8729 #ifdef DEBUG
8730  if (lDiags) {
8731  printf("Now, buf %p contains:\n%s\n",
8732  sp->buf, (char *)sp->buf);
8733  }
8734 #endif /* DEBUG */
8735  /*
8736  * Special filter #2: various checks to make sure LGPL/GFDL/GPL license
8737  * references are not confused -- they CAN look quite similar. Specifically
8738  * we don't want to confuse a SINGLE reference to the LGPL as a reference to
8739  * the GPL. BUT -- sometimes references to BOTH are in the same file.
8740  */
8741  }
8742  if ((qType == 2) &&
8743  HASREGEX(_TEXT_LGPL_NOT_GPL, sp->buf+sso) &&
8744  !HASREGEX(_TEXT_GPL_NOT_LGPL, sp->buf+sso) &&
8745  NOT_INFILE(_TEXT_LGPL_DETAILS) &&
8746  NOT_INFILE(_TEXT_LICSET)) {
8747  if (lDiags) {
8748  printf("... \"GPL\" -> LGPL (%d)\n",
8749  index);
8750  }
8751  ltsr[_TEXT_LGPL_NOT_GPL] = LTSR_YES;
8752  ret = 0;
8753  *q = LTSR_NO; /* oops, make that a "no" */
8754  } else if ((qType == 2) &&
8755  HASREGEX(_TEXT_GFDL_NOT_GPL, sp->buf+sso)) {
8756  if (lDiags) {
8757  printf("... \"GPL\" -> GFDL (%d)\n",
8758  index);
8759  }
8760  ltsr[_TEXT_GFDL_NOT_GPL] = LTSR_YES;
8761  ret = 0;
8762  *q = LTSR_NO;
8763  } else if ((index == _LT_GPL3ref) && (qType == 2)) {
8764  if (HASREGEX(_PHR_QEMU_NOT_GPLV3, sp->buf+sso)) {
8765  if (lDiags) {
8766  printf("... \"GPL\" -> QEMU\n");
8767  }
8768  ltsr[_PHR_QEMU_NOT_GPLV3] = LTSR_YES;
8769  ret = 0;
8770  *q = LTSR_NO;
8771  } else if (INFILE(_PHR_SCF_HOWTO)) {
8772  if (lDiags) {
8773  printf("... SCF-Howto\n");
8774  }
8775  ret = 0;
8776  *q = LTSR_NO;
8777  } else if (HASREGEX(_TEXT_DRBD_NOT_GPL3, sp->buf)) {
8778  if (lDiags) {
8779  printf("... mysgl/DRBD\n");
8780  }
8781  ltsr[_TEXT_DRBD_NOT_GPL3] = LTSR_YES;
8782  ret = 0;
8783  *q = LTSR_NO;
8784  }
8785 #ifdef GPLV2_BEATS_GPLV3
8786  else if (strNbuf(sp->buf+sso, "version 2")) {
8787  if (sp->buf + sso + cur.regm.rm_eo <
8788  sp->buf + seo) {
8789  if (lDiags) {
8790  printf("... v%c!\n", *cp);
8791  }
8792  ret = 0;
8793  *q = LTSR_NO;
8794  }
8795  }
8796 #endif /* GPLV2_BEATS_GPLV3 */
8797  } else if ((index == _PHR_GPL3_OR_LATER) &&
8798  (qType == 2) &&
8799  strNbuf(sp->buf+sso, "v2 ")) {
8800  if (lDiags) {
8801  printf("... v2 and version 3\"\n");
8802  }
8803  ret = 0;
8804  *q = LTSR_NO;
8805  } else if ((index == _PHR_GPL3_OR_LATER) &&
8806  (qType == 2) &&
8807  HASREGEX(_TEXT_NOT_GPLV3_DRAFT, sp->buf+sso)) {
8808  if (lDiags) {
8809  printf("... exclude \"GPLv3 draft\"\n");
8810  }
8811  ltsr[_TEXT_NOT_GPLV3_DRAFT] = LTSR_YES;
8812  ret = 0;
8813  *q = LTSR_NO;
8814  } else if ((index == _PHR_GPL3_ONLY) &&
8815  (qType == 2) &&
8816  HASREGEX(_TEXT_NOT_LIBSTDC, sp->buf+sso)) {
8817  if (lDiags) {
8818  printf("... exclude libstdc vers\"\n");
8819  }
8820  ltsr[_TEXT_NOT_LIBSTDC] = LTSR_YES;
8821  ret = 0;
8822  *q = LTSR_NO;
8823  }
8824  /*
8825  * POSIX regex matches the longest string possible, and a '3' can follow a
8826  * "version 2 or later phrase" -- we want to match the '2'. "Vim" has this:
8827  *****
8828  * e) When the GNU General Public License (GPL) applies to the changes,
8829  * you may distribute the modified code under the GNU GPL version 2 or
8830  * any later version.
8831  * 3) A message must be added, at least in the output of the ":version"
8832  * command and in the intro screen, such that the user ...
8833  *****
8834  * So... if there's a NUMBER (!= '3') between the word "version" and the
8835  * end-of-match (at sp->buf+seo), that matches the number AND NOT the 3.
8836  */
8837  else if ((qType == 2) &&
8838  ((index == _PHR_GPL3_ONLY) || (index == _PHR_LGPL3_ONLY))) {
8839  if (strNbuf(sp->buf+sso, "version") ||
8840  strNbuf(sp->buf+sso, "v3")) {
8841  cp = sp->buf + cur.regm.rm_eo;
8842  } else {
8843  cp = sp->buf + seo; /* "nil" loop */
8844  }
8845  for (ptr = sp->buf+seo; cp < ptr; cp++) {
8846  if (isdigit(*cp) && *cp != '3') {
8847  if (lDiags) {
8848  printf("... vers %c!\n",
8849  *cp);
8850  }
8851  ret = 0;
8852  *q = LTSR_NO;
8853  break;
8854  }
8855  }
8856  } else if (index == _PHR_FSF_V3_ONLY && qType == 2) {
8857  if (strNbuf(sp->buf+sso, "version")) {
8858 #ifdef GPLV2_BEATS_GPLV3
8859  ptr = sp->buf + sso + cur.regm.rm_so + 7;
8860 #endif /* GPLV2_BEATS_GPLV3 */
8861  cp = strchr(sp->buf+sso, '3');
8862  if (strncasecmp(cp, "3 tlb", 5) == 0) {
8863  if (lDiags) {
8864  printf("... v3 tlb\n");
8865  }
8866  ret = 0;
8867  *q = LTSR_NO;
8868  }
8869 #ifdef GPLV2_BEATS_GPLV3
8870  else if ((*ptr == ' ') && (*(ptr+1) == '2')) {
8871  if (lDiags) {
8872  printf("... v2, !v3\n");
8873  }
8874  ret = 0;
8875  *q = LTSR_NO;
8876  }
8877 #endif /* GPLV2_BEATS_GPLV3 */
8878  }
8879  else if (strNbuf(sp->buf+sso, "v3")) {
8880  cp = sp->buf + sso + cur.regm.rm_so;
8881  if (strncasecmp(cp-4, "arm ", 4) == 0) {
8882  if (lDiags) {
8883  printf("... arm v3\n");
8884  }
8885  ret = 0;
8886  *q = LTSR_NO;
8887  } else if (strncasecmp(cp, "v3020 ",
8888  6) == 0) {
8889  if (lDiags) {
8890  printf("... v3020\n");
8891  }
8892  ret = 0;
8893  *q = LTSR_NO;
8894  }
8895  }
8896  } else if ((index == _LT_LGPL_OR) &&
8897  (strncasecmp(sp->buf+sso, "or fitness f", 12) == 0)) {
8898  if (lDiags) {
8899  printf("... merch-or-fitness\n");
8900  }
8901  ret = 0;
8902  *q = LTSR_NO;
8903  } else if ((index == _LT_GPLref1) &&
8904  (qType == 2) &&
8905  INFILE(_PHR_LIC_CHANGE)) {
8906  if (lDiags) {
8907  printf("... exclude lic-change\"\n");
8908  }
8909  ret = 0;
8910  *q = LTSR_NO;
8911  } else if ((qType == 2) && (sso > 4)) {
8912  cp = sp->buf+sso-4;
8913  if (strncasecmp(cp, "not ", 4) == 0) {
8914  if (lDiags) {
8915  printf("... NOT l?gpl-ish\n");
8916  }
8917  ret = 0;
8918  *q = LTSR_NO; /* "no" */
8919  }
8920  } else if (qType == 3 && INFILE(_PHR_ARTISTIC_DESC1)) {
8921  /*
8922  Special filter #3: match specific versions of Perl
8923  references, but not all
8924  */
8925  if (lDiags) {
8926  printf("... exclude artistic defn\"\n");
8927  }
8928  ret = 0;
8929  *q = LTSR_NO;
8930  } else if (qType == 4) {
8931  /*
8932  Special filter #4: look for a numerical version
8933  number IFF NOT IN a string of (at least) 4 numerical
8934  characters (signifying a year/datestamp)
8935  */
8936  char *x;
8937  x = cp = cur.matchBase + sso;
8938  ptr = cp - (sso < 100 ? sso : 100);
8939  while (!isdigit(*cp)) {
8940  cp++;
8941  }
8942  if (isdigit(*(cp+1)) && isdigit(*(cp+2)) && isdigit(*(cp+3))) {
8943  if (lDiags) {
8944  printf("... don't want year\n");
8945  }
8946  ret = 0;
8947  *q = LTSR_NO;
8948  } else if (HASREGEX(_TEXT_GNU_HELLO_23, ptr)) {
8949  if (lDiags) {
8950  printf("... gnu example\n");
8951  }
8952  ret = 0;
8953  *q = LTSR_NO;
8954  }
8955 #ifdef GPLV2_BEATS_GPLV3
8956  else if (strncasecmp(x-5, "v2 or ", 5) == 0) {
8957  if (lDiags) {
8958  printf("... v2 or v3\n");
8959  }
8960  ret = 0;
8961  *q = LTSR_NO;
8962  }
8963 #endif /* GPLV2_BEATS_GPLV3 */
8964  /*
8965  * Special case - don't know where better to look for this... other strings
8966  * match TEXT_GPLV3 and should be filtered. This should be a fairly low
8967  * frequency check.
8968  */
8969  else if (index == _TEXT_GPLV3) {
8970  x = cur.matchBase + seo;
8971  if (isdigit(*x) && *x != '0') {
8972  if (lDiags) {
8973  printf("... v3#!0\n");
8974  }
8975  ret = 0;
8976  *q = LTSR_NO;
8977  }
8978  }
8979  }
8980  }
8981 #if (DEBUG > 5)
8982  printf(">>===> \"%s\"\n", ltp->regex);
8983 #endif /* DEBUG > 5 */
8984  }
8985 #ifdef PARSE_STOPWATCH
8986  END_TIMER; /* stop the timer */
8987  (void) sprintf(timerName, "findPhrase(%03d): RET=%d (%s:%d)", index,
8988  ret, ltp->tseed, strlen(sp->buf));
8989  PRINT_TIMER(timerName, 0);
8990 #endif /* PARSE_STOPWATCH */
8991  if (lDiags && ret) {
8992  printRegexMatch(index, NO);
8993  /* locateRegex(filetext, op, index, size, sso, seo); */
8994  }
8995  return(ret);
8996 }
8997 
9012 void locateRegex(char *text, item_t *op, int index, int size, int sso, int seo)
9013 {
9014  int i;
9015  int j;
9016  int n;
9017  int off;
9018  int len;
9019  item_t *sp;
9020  list_t *lp = (list_t *)op->bList;
9021  char *cp;
9022  char *ptr;
9023  char *start;
9024  char save;
9025 
9026 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG)
9027  traceFunc("== locateRegex(%p, %p, %d, %d, %d, %d)\n", text, op, index,
9028  size, sso, seo);
9029 #endif /* PROC_TRACE || PHRASE_DEBUG */
9030 
9031  /*
9032  * First step, simplest case - try to locate the regex in the file. It
9033  * *might* be that easy (but not very often, it turns out).
9034  */
9035  if (idxGrep(index, text, REG_ICASE|REG_EXTENDED)) {
9036  saveRegexLocation(index, cur.regm.rm_so,
9037  cur.regm.rm_eo - cur.regm.rm_so, YES);
9038  return;
9039  }
9040  /*
9041  * Regex is not directly in the raw text file, so now we need to try to
9042  * map a location from a 'doctored buffer' to a location in the original
9043  * text file. Not impossible, yet not overly straight-forward.
9044  */
9045 #ifdef DEBUG
9046  listDump(lp, NO);
9047  printf("Doc-buffer match @ %d:%d\n", sso, seo);
9048  printf("Possible \"%s\" entries to search: %d (%d)\n", op->str,
9049  op->nMatch, lp->used);
9050  for (n = i = 0; (sp=listIterate(lp)); i++) {
9051  printf("Ent[%d]: bDocLen %d (len %d) == file %d+%d (%d)\n",
9052  i, sp->bDocLen, (sp->bDocLen)-n, sp->bStart, sp->bLen,
9053  sp->bStart+sp->bLen);
9054  n = sp->bDocLen;
9055  }
9056 #endif /* DEBUG */
9057  /*
9058  * At this point, the matched phrase should be bounded by {sso} and {seo}
9059  * as offsets within the doctored buffer we're scanning. We also have a
9060  * mapping of offsets within the doctored buffer to more-or-less where it
9061  * exists in the original (raw text) file -- so go find it. Walk through the
9062  * offsets-list; the entry with the LOWEST end-of-doctored-buffer offset
9063  * exceeding the value of 'sso' IS the paragraph where we found the regex.
9064  */
9065  i = -1;
9066  j = -1;
9067  n = 0;
9068  while ((sp = listIterate(lp))) {
9069  if (sso > sp->bDocLen) {
9070  n = sp->bDocLen;
9071  continue;
9072  }
9073  i = sp->bStart;
9074  j = sp->bLen;
9075 #ifdef DEBUG
9076  printf("sso(%d), limit(%d), Possible: @%d+%d\n", sso,
9077  sp->bDocLen, i, j);
9078 #endif /* DEBUG */
9079  listIterationReset(lp);
9080  break;
9081  }
9082  if (i < 0) { /* something is wrong... */
9083  LOG_FATAL("Cannot map reduced-text to raw file contents (#%d)", index)
9084  Bail(-__LINE__);
9085  }
9086  /*
9087  * Remember, the length of text matched in the doctored-buffer will likely
9088  * not match the length of the "same" (unmodified) text in the raw file!
9089  * And, an offset within the doctored buffer CANNOT be any larger than the
9090  * corresponding text segment in the raw file (we only _remove_ characters).
9091  * Next, find the last occurrence (in the raw file) of the last word in
9092  * the license-footprint
9093  */
9094  sso -= n;
9095  seo -= n;
9096  off = i + sso;
9097  len = j - sso;
9098 #ifdef DEBUG
9099  printf("WINDOW-first: offset %d, len %d\n", off, len);
9100 #endif /* DEBUG */
9101  /*printf("BUF: %s\n", sp->buf);*/
9102  start = _REGEX(index);
9103  cp = start + licSpec[index].text.csLen - 1; /* 'end' of regex */
9104 #ifdef DEBUG
9105  printf("EO-Regex, cp == '%c'\n", *cp);
9106 #endif /* DEBUG */
9107  n = 0;
9108  while (*cp == ' ') {
9109  cp--;
9110  }
9111  while ((n == 1) || ((cp != start) && (*cp != ' ') && (*cp != ')') &&
9112  (*cp != '}'))) {
9113  if (*cp == ']') {
9114  n = 1;
9115  } else if (*cp == '[') {
9116  n = 0;
9117  }
9118  if (cp == _REGEX(index)) {
9119  cp = ":no:match";
9120  break;
9121  }
9122  cp--;
9123  }
9124  if (*cp == ')') {
9125  cp--;
9126  n = 1;
9127  while (n) {
9128  if (*cp == '(') {
9129  n--;
9130  } else if (*cp == ')') {
9131  n++;
9132  }
9133  /*printf("'%c' -- n %d\n", *cp, n);*/
9134  if (cp != start) {
9135  cp--;
9136  }
9137  }
9138  while ((cp != start) && (*cp != ' ') && (*cp != '.') && (*cp != ')')
9139  && (*cp != ']') && (*cp != '}')) {
9140  /*printf("skip '%c'...\n", *cp);*/
9141  cp--;
9142  }
9143 #ifdef DEBUG
9144  printf("_END_@%ld '%c'\n", cp-_REGEX(index), *cp);
9145 #endif /* DEBUG */
9146  }
9147  if (cp != start) {
9148  if (*cp != '.') {
9149  cp++;
9150  }
9151  if ((*cp == '?') || (*cp == '+')) {
9152  cp++;
9153  }
9154  }
9155  ptr = sp->buf + sso;
9156  i = j = 0;
9157 #ifdef DEBUG
9158  printf("SEARCH @foot is now \"%s\"\n", cp);
9159 #endif /* DEBUG */
9160  while (strGrep(cp, ptr, REG_ICASE|REG_EXTENDED)) {
9161  i++;
9162  ptr += cur.regm.rm_eo;
9163  j += cur.regm.rm_eo;
9164 #ifdef DEBUG
9165  printf("Found match (%d bytes) @ offset %d (%d tot)\n",
9166  cur.regm.rm_eo - cur.regm.rm_so, cur.regm.rm_so, j);
9167 #endif /* DEBUG */
9168  }
9169 #ifdef DEBUG
9170  printf("Total # of matches == %d\n", i);
9171 #endif /* DEBUG */
9172  if (i && j) {
9173  len = j;
9174 #ifdef DEBUG
9175  printf("WINDOW-adjst: offset %d, len %d\n", off, len);
9176 #endif /* DEBUG */
9177  } else {
9178  Assert(NO, "Regex \"%s\" (foot-end) not in raw text", cp);
9179  }
9180  /*
9181  * Then, find the first occurrence (in the raw file) of the first word
9182  * in the license-footprint; the exception here is that if the "last word"
9183  * turned out to be the entire regex, then the "first word" will be, too.
9184  */
9185  if (cp != start) {
9186  cp = _REGEX(index);
9187  j = 1;
9188 #ifdef DEBUG
9189  printf("BO-Regex, cp == '%c'\n", *cp);
9190 #endif /* DEBUG */
9191  while (*cp == ' ') {
9192  cp++;
9193  }
9194  while (*cp && (*cp != ' ') && (*cp != '.') && (*cp != '(') &&
9195  (*cp != '{')) {
9196  if (*cp == '[') {
9197  if (*(cp + 1) == '^') {
9198  j = 0;
9199  }
9200  while (*cp && (*cp != ']')) {
9201  cp++;
9202  }
9203  if (*(cp+1) && (*(cp+1) == '?')) {
9204  cp++;
9205  }
9206  if (j) {
9207  cp++;
9208  break;
9209  }
9210  }
9211  cp++;
9212  }
9213  if (*cp == '(') {
9214  /*printf("Start@%d '%c'\n", cp-_REGEX(index), *cp);*/
9215  for (n = 1, cp++; n; cp++) {
9216  /*printf("... '%c'\n", *cp);*/
9217  if ((*cp == '(') && (*(cp-1) != '\\')) {
9218  n++;
9219  } else if ((*cp == ')') && (*(cp-1) != '\\')) {
9220  n--;
9221  }
9222  }
9223  while (*cp && (*cp != ' ') && (*cp != '.') && (*cp != '(') &&
9224  (*cp != '[')) {
9225  cp++;
9226  }
9227  /*printf("_END_@%d '%c'\n", cp-_REGEX(index), *cp);*/
9228  }
9229  if ((*cp == '?') ||
9230  (*cp == '+') ||
9231  ((*cp == '.') && (*(cp-1) == '\\'))) {
9232  cp++;
9233  }
9234  if (*cp) {
9235  save = *cp;
9236  *cp = NULL_CHAR;
9237 #ifdef DEBUG
9238  printf("SEARCH @head is now \"%s\"\n", _REGEX(index));
9239 #endif /* DEBUG */
9240  ptr = sp->buf+sso;
9241  if (strGrep(_REGEX(index), ptr,
9242  REG_ICASE|REG_EXTENDED)) {
9243  len -= cur.regm.rm_so;
9244  off += cur.regm.rm_so;
9245  } else {
9246  LOG_NOTICE("Regex \"%s\" (foot-start) not in raw text", _REGEX(index));
9247  }
9248  *cp = save; /* restore to original text */
9249  }
9250 #ifdef DEBUG
9251  else {
9252  LOG_NOTICE("Nothing to trim from the front (*cp == NULL)");
9253  }
9254 #endif /* DEBUG */
9255  }
9256 #ifdef DEBUG
9257  else {
9258  printf("Hey, last-word IS the entire regex!\n");
9259  }
9260 #endif /* DEBUG */
9261  saveRegexLocation(index, off, len, YES);
9262 #ifdef DEBUG
9263  printf("WINDOW-FINAL: offset %d, len %d\n", off, len);
9264 #endif /* DEBUG */
9265  /*
9266  * At this point, the window is as small as we can (reasonably) make it,
9267  * given that we mundged the original file-text and didn't make a complete
9268  * map of every character. The variable off contains the start of the
9269  * window (the absolute offset within the raw file) and the variable len
9270  * contains the length of the text window.
9271  *****
9272  * DON'T FORGET that some license-footprints are determined merely by
9273  * searching for a string in the raw-text file (calling idxGrep()), e.g.,
9274  * not using the doctored buffers. See fileHasPatt() for details.
9275  *****
9276  * And finally, note how the list of entries matched (in 'whereList') is
9277  * manipulated -- see the very bottom of "addRef()".
9278  */
9279  if ((off + len) > size) {
9280  LOG_FATAL("off %d + len %d (== %d) exceeds filesize %d!", off, len, off + len, size);
9281  Bail(-__LINE__);
9282  }
9283  return;
9284 }
9285 
9293 void saveRegexLocation(int index, int offset, int length, int saveCache)
9294 {
9295  item_t *ip;
9296  item_t *sp;
9297 
9298 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG)
9299  traceFunc("== saveRegexLocation(%d, %d, %d, %d)\n", index, offset, length,
9300  saveCache);
9301 #endif /* PROC_TRACE || PHRASE_DEBUG */
9302 
9303  (void) sprintf(name, "reg%04d", index);
9304  sp = listGetItem(&whereList, name);
9305  sp->bIndex = whereList.used;
9306  sp->bStart = offset;
9307  sp->bLen = length;
9308  if (saveCache) {
9309  ip = listGetItem(&whCacheList, name);
9310  ip->bIndex = index;
9311  ip->bStart = offset;
9312  ip->bLen = length;
9313  }
9314  return;
9315 }
9316 
9317 
9318 void saveUnclBufLocation(int bufNum)
9319 {
9320  item_t *p;
9321  item_t *bp;
9322  list_t *lp;
9323 
9324 #if defined(PROC_TRACE) || defined(PHRASE_DEBUG)
9325  traceFunc("== saveUnclBufLocation(%d, %d, %d, %d)\n", bufNum);
9326 #endif /* PROC_TRACE || PHRASE_DEBUG */
9327 
9328  listClear(&whereList, NO); /* empty all prior matches */
9329  p = listGetItem(&cur.offList, _REGEX(_LEGAL_first));
9330  lp = (list_t *) p->bList;
9331  (void) sprintf(name, "buf%05d", bufNum);
9332  p = listGetItem(lp, name);
9333  bp = listGetItem(&whereList, LS_UNCL);
9334  bp->bStart = p->bStart;
9335  bp->bLen = p->bLen;
9336  bp->bIndex = -1;
9337  return;
9338 }
9339 
9345 void addRef(char *str, int interest)
9346 {
9347  item_t *p;
9348  char *bp;
9349  char *sp = str;
9350  if(!(str && str[0]))
9351  return;
9352 
9353 #ifdef PROC_TRACE
9354  traceFunc("== addRef(\"%s\", %d)\n", str, interest);
9355 #endif /* PROC_TRACE */
9356 
9357 #if defined(DEBUG)
9358  listDump(&whereList, YES);
9359 #endif /* DEBUG */
9360  /*
9361  * Add this to the list of individual pieces found, and mark the license
9362  * to make generating a license-summary easier. The general strategy is
9363  * to COMPLETELY ignore anything NOT considered 'noteworthy'. So if the
9364  * license is noteworthy, we add one to the count, so that we can call
9365  * listCount() on the list to find if there's a 'real license' in here.
9366  * see makeLicenseSummary() in license.c for more details.
9367  *****
9368  * This little trick is also used in distroReport() and rawSourceReport(),
9369  * see report.c
9370  */
9371  if (str == NULL_STR) {
9372  Assert(YES, "license detected != NULL");
9373  }
9374  if (*str == NULL_CHAR) {
9375  Assert(YES, "license string not start with NULL");
9376  }
9377  bp = licStr+refOffset;
9378  *bp++ = ',';
9379  /*
9380  CDB - Opportunity for optimization via memcpy
9381  */
9382  while (*sp) {
9383  *bp++ = *sp++;
9384  }
9385  *bp = NULL_CHAR;
9386  refOffset = bp - licStr;
9387  /*
9388  * Stuff this license in to several lists:
9389  * - parseList is used to create a package "computed license summary"
9390  * - briefList is used to compute a "terse/brief" license summary
9391  */
9392  p = listGetItem(&cur.parseList, str);
9393  if (interest) {
9394  p->iFlag++;
9395  if (interest > IL_LOW) {
9396  p->iLevel = interest;
9397  }
9398  }
9399  if (interest > maxInterest) {
9400  maxInterest = interest;
9401  }
9402  if (lDiags && whereList.used) {
9403  int i = 0;
9404  listSort(&whereList, SORT_BY_COUNT_ASC);
9405  printf("WINDOW for \"%s\": ", str);
9406  while ((p = listIterate(&whereList))) {
9407  if (i++ > 0) {
9408  printf(", ");
9409  }
9410  printf("%d+%d", p->bStart, p->bLen);
9411  }
9412  printf("\n");
9413  }
9414  listClear(&whereList, NO);
9415 #ifdef DEBUG
9416  if (lDiags) {
9417  printf("++ \"%s\" [int=%d]\n", str, interest);
9418  }
9419 #endif /* DEBUG */
9420 
9421  addLicence(cur.theMatches,str);
9422 
9423  return;
9424 }
9425 
9431 int famOPENLDAP(char *filetext, int size, int isML, int isPS)
9432 {
9433  int ret = 0;
9434 
9435  if (lmem[_tOPENLDAP]) {
9436  if (INFILE(_TITLE_OPENLDAP25)) {
9437  INTERESTING("OLDAP-2.5");
9438  ret = 1;
9439  }
9440  else if (INFILE(_TITLE_OPENLDAP26)) {
9441  INTERESTING("OLDAP-2.6");
9442  ret = 1;
9443  }
9444  else if (INFILE(_TITLE_OPENLDAP27)) {
9445  INTERESTING("OLDAP-2.7");
9446  ret = 1;
9447  }
9448  else if (INFILE(_TITLE_OPENLDAP28)) {
9449  INTERESTING("OLDAP-2.8");
9450  ret = 1;
9451  }
9452  else if (INFILE(_TITLE_OPENLDAP201)) {
9453  INTERESTING("OLDAP-2.0.1");
9454  ret = 1;
9455  }
9456  else if (INFILE(_TITLE_OPENLDAP20)) {
9457  INTERESTING("OLDAP-2.0");
9458  ret = 1;
9459  }
9460  else if (INFILE(_TITLE_OPENLDAP21)) {
9461  INTERESTING("OLDAP-2.1");
9462  ret = 1;
9463  }
9464  else if (INFILE(_TITLE_OPENLDAP221) || INFILE(_SPDX_OLDAP_221)) {
9465  INTERESTING("OLDAP-2.2.1");
9466  ret = 1;
9467  }
9468  else if (INFILE(_TITLE_OPENLDAP222) || INFILE(_SPDX_OLDAP_222)) {
9469  INTERESTING("OLDAP-2.2.2");
9470  ret = 1;
9471  }
9472  else if (INFILE(_TITLE_OPENLDAP22)) {
9473  INTERESTING("OLDAP-2.2");
9474  ret = 1;
9475  }
9476  else if (INFILE(_TITLE_OPENLDAP11)) {
9477  INTERESTING("OLDAP-1.1");
9478  ret = 1;
9479  }
9480  else if (INFILE(_TITLE_OPENLDAP23)) {
9481  INTERESTING("OLDAP-2.3");
9482  ret = 1;
9483  }
9484  else if (INFILE(_TITLE_OPENLDAP24)) {
9485  INTERESTING("OLDAP-2.4");
9486  ret = 1;
9487  }
9488  else if (INFILE(_TITLE_OPENLDAP12)) {
9489  INTERESTING("OLDAP-1.2");
9490  ret = 1;
9491  }
9492  else if (INFILE(_TITLE_OPENLDAP13)) {
9493  INTERESTING("OLDAP-1.3");
9494  ret = 1;
9495  }
9496  else if (INFILE(_TITLE_OPENLDAP14)) {
9497  INTERESTING("OLDAP-1.4");
9498  ret = 1;
9499  }
9500  else if (INFILE(_CR_OPENLDAP) && INFILE(_TITLE_OPENLDAP)) {
9501  INTERESTING("OLDAP");
9502  ret = 1;
9503  }
9504  }
9505  lmem[_fOPENLDAP] = ret;
9506  return(ret);
9507 }
9508 
9509 
9533 int checkUnclassified(char *filetext, int size, int score,
9534  int isML, int isPS, int nw)
9535 {
9536  char *buf;
9537  char *curptr;
9538  char *cp;
9539  int m = 0;
9540 #ifdef UNKNOWN_CHECK_DEBUG
9541  int pNum = 0;
9542 #endif /* UNKNOWN_CHECK_DEBUG */
9543  int i = 0;
9544 
9545 #ifdef PROC_TRACE
9546  traceFunc("== checkUnclassified(%p, %d, %d, %d, %d, %d)\n", filetext,
9547  size, score, isML, isPS, nw);
9548 #endif /* PROC_TRACE */
9549 
9550  /*
9551  * Based on experience, this is a good place to look for false-positives:
9552  *****
9553  * Occasionally IETF documents (RFCs, technical descriptions and the like)
9554  * have enough text to trip the unclassified-license detector falsely.
9555  * As a first quick check, see if there's an IETF copyright in the file
9556  * and if so, avoid this (somewhat expensive) check.
9557  *****
9558  * The "Debian social contract" has some very legal-looking verbage, too.
9559  */
9560  if (mCR_IETF()) {
9561  return(0);
9562  }
9563  if (INFILE(_LT_DEB_CONTRACT) || INFILE(_LT_DEB_CONTRACTref)){
9564  INTERESTING("Debian-social-DFSG");
9565  return(0);
9566  }
9567  if (INFILE(_LT_TROLLTECH)) {
9568  return(1);
9569  }
9570 
9571  /*
9572  * A Generic EULA 'qualifies' as an UnclassifiedLicense, or the clause 'License agreement' as an UnclassifiedLicense, check this
9573  * one before trying the word-matching magic checks (below).
9574  */
9575  gl.flags |= FL_SAVEBASE; /* save match buffer (if any) */
9576  m = INFILE(_LT_GEN_EULA) || INFILE(_LT_LG) || INFILE(_LT_GENERIC_UNCLASSIFIED);
9577  /* gl.flags & ~FL_SAVEBASE; CDB -- This makes no sense, given line above */
9578  if (m) {
9579  if (cur.licPara == NULL_STR && cur.matchBase) {
9580  saveLicenseParagraph(cur.matchBase, isML, isPS, NO);
9581  }
9582  return(1);
9583  }
9584  checknw = nw;
9585  /*
9586  * Look for paragraphs of text that could be licenses. We'll check the
9587  * resulting text for 4 types of different words (all in proximity leads
9588  * us to believe it's a license of some sort). If we don't get a paragraph
9589  * to search based on the first set of words, look no further.
9590  */
9591 #ifdef UNKNOWN_CHECK_DEBUG
9592  printf("... first regex: \"%s\"\n", _REGEX(_LEGAL_first));
9593 #endif /* UNKNOWN_CHECK_DEBUG */
9594  if ((buf = getInstances(filetext, size, gl.uPsize, gl.uPsize,
9595  _REGEX(_LEGAL_first), YES)) == NULL_STR) {
9596 #ifdef UNKNOWN_CHECK_DEBUG
9597  printf("... getInstances returns NULL\n");
9598 #endif /* UNKNOWN_CHECK_DEBUG */
9599  return(0);
9600  }
9601  if (lDiags) {
9602  printRegexMatch(_LEGAL_first, NO);
9603  }
9604  /*
9605  * Without examining each paragraph, make sure the file contains the
9606  * components we're looking for... if not, don't check any further.
9607  */
9608  if (/*size > 102400 && */
9609  !match3(_LEGAL_first, buf, score, NO, isML, isPS)) {
9610 #ifdef UNKNOWN_CHECK_DEBUG
9611  printf("... first check fails\n");
9612 #endif /* UNKNOWN_CHECK_DEBUG */
9613  return(0);
9614  }
9615  /*
9616  * buf now points to a series of paragraphs that have 6 lines above
9617  * AND below the regex we've matched, PLUS a separator line between
9618  * each paragraph. The LAST paragraph doesn't have a separator-line.
9619  *****
9620  * For the sake of the search, make the separator line 'disappear'.
9621  */
9622  curptr = buf;
9623  while (idxGrep(_UTIL_XYZZY, curptr, 0)) {
9624  cp = curptr + cur.regm.rm_so;
9625  *cp = NULL_CHAR;
9626 #ifdef UNKNOWN_CHECK_DEBUG
9627  printf("DEBUG: paragraph #%d:\n[START-PARA]\n%s\n[END-PARA]\n",
9628  ++pNum, curptr);
9629 #endif /* UNKNOWN_CHECK_DEBUG */
9630  i++;
9631  /*
9632  * Now that we have our 'paragraph span', check the contents of the
9633  * paragraph for the other 3 groups of words. A match in EACH group
9634  * (plus other criteria checked, of course) means we've likely found
9635  * as-of-yet unclassified license.
9636  *****
9637  * A generic "no warranty" paragraph also looks like a license, so in
9638  * that case don't return a false positive.
9639  */
9640  if (match3(_LEGAL_first, curptr, score, YES, isML, isPS)) {
9641  saveUnclBufLocation(i);
9642  return(1);
9643  }
9644 #ifdef UNKNOWN_CHECK_DEBUG
9645  else {
9646  printf("DEBUG: match() returns 0, look again\n");
9647  }
9648 #endif /* UNKNOWN_CHECK_DEBUG */
9649  /*
9650  * NO-match means this paragraph doesn't contain the magic words we
9651  * seek. However, this file still _may_ contain the magic paragraph --
9652  * it'll be searched in this while-loop until either the magic OR
9653  * end-of-file is found)...
9654  */
9655  *cp++ = '='; /* reset line */
9656  if ((cp = findEol(cp)) == NULL_STR) {
9657  LOG_FATAL("Cannot find delimeter!")
9658  Bail(-__LINE__);
9659  }
9660  curptr = cp+1;
9661  }
9662  /*
9663  * One last buffer to try...
9664  */
9665 #ifdef UNKNOWN_CHECK_DEBUG
9666  printf("DEBUG: %s paragraph (#%d):\n[START-PARA]\n%s\n[END-PARA]\n",
9667  pNum == 0 ? "ONLY" : "LAST", ++pNum, curptr);
9668 #endif /* UNKNOWN_CHECK_DEBUG */
9669  if (match3(_LEGAL_first, curptr, score, YES, isML, isPS)) {
9670  saveUnclBufLocation(++i);
9671  return(1);
9672  }
9673  return(0);
9674 }
9675 
9676 
9680 void checkFileReferences(char *filetext, int size, int score, int kwbm,
9681  int isML, int isPS)
9682 {
9683  int i;
9684 
9685 #ifdef PROC_TRACE
9686  traceFunc("== checkFileReferences(%p, %d, %d, 0x%x, %d, %d)\n", filetext,
9687  size, score, kwbm, isML, isPS);
9688 #endif /* PROC_TRACE */
9689  for (i = 0; i < NSEECOPYING; i++) {
9690  if (INFILE(_SEECOPYING_first+i)) {
9691  if (lDebug) {
9692  (void) sprintf(name, "Gen-CPY-%d", ++i);
9693  INTERESTING(name);
9694  } else {
9695  INTERESTING("See-file.COPYING");
9696  }
9697  return;
9698  }
9699  }
9700  /* */
9701  for (i = 0; i < NSEELICENSE; i++) {
9702  if (INFILE(_SEELICENSE_first+i)) {
9703  if (lDebug) {
9704  (void) sprintf(name, "Gen-CPY-%d", ++i);
9705  INTERESTING(name);
9706  } else {
9707  INTERESTING("See-file.LICENSE");
9708  }
9709  return;
9710  }
9711  }
9712  /* */
9713  for (i = 0; i < NSEEREADME; i++) {
9714  if (INFILE(_SEEREADME_first+i)) {
9715  if (lDebug) {
9716  (void) sprintf(name, "Gen-CPY-%d", ++i);
9717  INTERESTING(name);
9718  } else {
9719  INTERESTING("See-file.README");
9720  }
9721  return;
9722  }
9723  }
9724  /* */
9725  for (i = 0; i < NSEEOTHER; i++) {
9726  if (INFILE(_SEEOTHER_first+i)) {
9727  if (lDebug) {
9728  (void) sprintf(name, "Gen-CPY-%d", ++i);
9729  INTERESTING(name);
9730  } else {
9731  INTERESTING("See-doc.OTHER");
9732  }
9733  return;
9734  }
9735  }
9736  /* */
9737  if (INFILE(_LT_SEE_OUTPUT_1)) {
9738  INTERESTING(lDebug ? "Gen-EXC-1" : "GNU-style.EXECUTE");
9739  }
9740 #if 0
9741  else if (INFILE(_LT_SEE_OUTPUT_2)) {
9742  INTERESTING(lDebug ? "Gen-EXC-2" : "Free-SW.run-COMMAND");
9743  } else if (INFILE(_LT_SEE_OUTPUT_3)) {
9744  INTERESTING(lDebug ? "Gen-EXC-3" : "Free-SW.run-COMMAND");
9745  }
9746 #endif
9747  if(HASTEXT(_LT_SEE_COPYING_LICENSE_1, REG_EXTENDED) || HASTEXT(_LT_SEE_COPYING_LICENSE_2, REG_EXTENDED)) {
9748  INTERESTING("See-file");
9749  }
9750  else if (HASTEXT(_LT_SEE_URL, REG_EXTENDED) || HASTEXT(_LT_SEE_URL_ref1, REG_EXTENDED)) {
9751  INTERESTING("See-URL");
9752  }
9753  return;
9754 
9755 #ifdef OLD_VERSION
9756  if (INFILE(_LT_SEE_COPYING_1)) {
9757  INTERESTING(lDebug ? "Gen-CPY-1" : "See-file.COPYING");
9758  }
9759  else if (INFILE(_LT_SEE_COPYING_2)) {
9760  INTERESTING(lDebug ? "Gen-CPY-2" : "See-file.COPYING");
9761  }
9762  else if (INFILE(_LT_SEE_COPYING_3)) {
9763  INTERESTING(lDebug ? "Gen-CPY-3" : "See-file.COPYING");
9764  }
9765  else if (INFILE(_LT_SEE_COPYING_4)) {
9766  INTERESTING(lDebug ? "Gen-CPY-4" : "See-file.COPYING");
9767  }
9768  else if (INFILE(_LT_SEE_COPYING_5)) {
9769  INTERESTING(lDebug ? "Gen-CPY-5" : "See-file.COPYING");
9770  }
9771  else if (INFILE(_LT_SEE_COPYING_6)) {
9772  INTERESTING(lDebug ? "Gen-CPY-6" : "See-file.COPYING");
9773  }
9774  else if (INFILE(_LT_SEE_COPYING_7)) {
9775  INTERESTING(lDebug ? "Gen-CPY-7" : "See-file.COPYING");
9776  }
9777  else if (INFILE(_LT_SEE_COPYING_8)) {
9778  INTERESTING(lDebug ? "Gen-CPY-8" : "See-file.COPYING");
9779  }
9780  else if (INFILE(_LT_SEE_COPYING_9)) {
9781  INTERESTING(lDebug ? "Gen-CPY-9" : "See-file.COPYING");
9782  }
9783  else if (INFILE(_LT_SEE_COPYING_10)) {
9784  INTERESTING(lDebug ? "Gen-CPY-10" : "See-file.COPYING");
9785  }
9786  else if (INFILE(_LT_SEE_COPYING_LAST1)) {
9787  INTERESTING(lDebug ? "Gen-CPY-L1" : "See-file.COPYING");
9788  }
9789  else if (INFILE(_LT_SEE_COPYING_LAST2)) {
9790  INTERESTING(lDebug ? "Gen-CPY-L2" : "See-file.COPYING");
9791  }
9792  else if (INFILE(_LT_SEE_LICENSE_1)) {
9793  INTERESTING(lDebug ? "Gen-LIC-1" : "See-file.LICENSE");
9794  }
9795  else if (INFILE(_LT_SEE_LICENSE_2)) {
9796  INTERESTING(lDebug ? "Gen-LIC-2" : "See-file.LICENSE");
9797  }
9798  else if (INFILE(_LT_SEE_LICENSE_3)) {
9799  INTERESTING(lDebug ? "Gen-LIC-3" : "See-file.LICENSE");
9800  }
9801  else if (INFILE(_LT_SEE_LICENSE_4)) {
9802  INTERESTING(lDebug ? "Gen-LIC-4" : "See-file.LICENSE");
9803  }
9804  else if (INFILE(_LT_SEE_LICENSE_5)) {
9805  INTERESTING(lDebug ? "Gen-LIC-5" : "See-file.LICENSE");
9806  }
9807  else if (INFILE(_LT_SEE_LICENSE_6)) {
9808  INTERESTING(lDebug ? "Gen-LIC-6" : "See-file.LICENSE");
9809  }
9810  else if (INFILE(_LT_SEE_LICENSE_7)) {
9811  INTERESTING(lDebug ? "Gen-LIC-7" : "See-file.LICENSE");
9812  }
9813  else if (INFILE(_LT_SEE_LICENSE_8)) {
9814  INTERESTING(lDebug ? "Gen-LIC-8" : "See-file.LICENSE");
9815  }
9816  else if (INFILE(_LT_SEE_LICENSE_9)) {
9817  INTERESTING(lDebug ? "Gen-LIC-9" : "See-file.LICENSE");
9818  }
9819  else if (INFILE(_LT_SEE_LICENSE_10)) {
9820  INTERESTING(lDebug ? "Gen-LIC-10" : "See-file.LICENSE");
9821  }
9822  else if (INFILE(_LT_SEE_LICENSE_LAST1)) {
9823  INTERESTING(lDebug ? "Gen-LIC-L1" : "See-file.LICENSE");
9824  }
9825  else if (INFILE(_LT_SEE_LICENSE_LAST2)) {
9826  INTERESTING(lDebug ? "Gen-LIC-L2" : "See-file.LICENSE");
9827  }
9828  else if (INFILE(_LT_SEE_README_1)) {
9829  INTERESTING(lDebug ? "Gen-RDM-1" : "See-file.README");
9830  }
9831  else if (INFILE(_LT_SEE_README_2)) {
9832  INTERESTING(lDebug ? "Gen-RDM-2" : "See-file.README");
9833  }
9834  else if (INFILE(_LT_SEE_README_3)) {
9835  INTERESTING(lDebug ? "Gen-RDM-3" : "See-file.README");
9836  }
9837  else if (INFILE(_LT_SEE_README_4)) {
9838  INTERESTING(lDebug ? "Gen-RDM-4" : "See-file.README");
9839  }
9840  else if (INFILE(_LT_SEE_README_5)) {
9841  INTERESTING(lDebug ? "Gen-RDM-5" : "See-file.README");
9842  }
9843  else if (INFILE(_LT_SEE_README_6)) {
9844  INTERESTING(lDebug ? "Gen-RDM-6" : "See-file.README");
9845  }
9846  else if (INFILE(_LT_SEE_README_7)) {
9847  INTERESTING(lDebug ? "Gen-RDM-7" : "See-file.README");
9848  }
9849  else if (INFILE(_LT_SEE_README_LAST1)) {
9850  INTERESTING(lDebug ? "Gen-RDM-L1" : "See-file.README");
9851  }
9852  else if (INFILE(_LT_SEE_README_LAST2)) {
9853  INTERESTING(lDebug ? "Gen-RDM-L2" : "See-file.README");
9854  }
9855  else if (INFILE(_LT_SEE_OTHER_1)) {
9856  INTERESTING(lDebug ? "Gen-OTH-1" : "See-doc.OTHER");
9857  }
9858  else if (INFILE(_LT_SEE_OTHER_2)) {
9859  INTERESTING(lDebug ? "Gen-OTH-2" : "See-doc.OTHER");
9860  }
9861  else if (INFILE(_LT_SEE_OTHER_3)) {
9862  INTERESTING(lDebug ? "Gen-OTH-3" : "See-doc.OTHER");
9863  }
9864  else if (INFILE(_LT_SEE_OTHER_4)) {
9865  INTERESTING(lDebug ? "Gen-OTH-4" : "See-doc.OTHER");
9866  }
9867  else if (INFILE(_LT_SEE_OTHER_5)) {
9868  INTERESTING(lDebug ? "Gen-OTH-5" : "See-doc.OTHER");
9869  }
9870  else if (INFILE(_LT_SEE_OTHER_6)) {
9871  INTERESTING(lDebug ? "Gen-OTH-6" : "See-doc.OTHER");
9872  }
9873  else if (INFILE(_LT_SEE_OTHER_7)) {
9874  INTERESTING(lDebug ? "Gen-OTH-7" : "See-doc.OTHER");
9875  }
9876  else if (INFILE(_LT_SEE_OTHER_8)) {
9877  INTERESTING(lDebug ? "Gen-OTH-8" : "See-doc.OTHER");
9878  }
9879  else if (INFILE(_LT_SEE_OTHER_9)) {
9880  INTERESTING(lDebug ? "Gen-OTH-9" : "See-doc.OTHER");
9881  }
9882  else if (INFILE(_LT_SEE_OTHER_10)) {
9883  INTERESTING(lDebug ? "Gen-OTH-10" : "See-doc.OTHER");
9884  }
9885  else if (INFILE(_LT_SEE_OTHER_11)) {
9886  INTERESTING(lDebug ? "Gen-OTH-11" : "See-doc.OTHER");
9887  }
9888  else if (INFILE(_LT_SEE_OTHER_12)) {
9889  INTERESTING(lDebug ? "Gen-OTH-12" : "See-doc.OTHER");
9890  }
9891  else if (INFILE(_LT_SEE_OTHER_13)) {
9892  INTERESTING(lDebug ? "Gen-OTH-13" : "See-doc.OTHER");
9893  }
9894  else if (INFILE(_LT_SEE_OTHER_14)) {
9895  INTERESTING(lDebug ? "Gen-OTH-14" : "See-doc.OTHER");
9896  }
9897  else if (INFILE(_LT_SEE_OTHER_15)) {
9898  INTERESTING(lDebug ? "Gen-OTH-15" : "See-doc.OTHER");
9899  }
9900  else if (INFILE(_LT_SEE_OTHER_LAST1)) {
9901  INTERESTING(lDebug ? "Gen-OTH-L1" : "See-doc.OTHER");
9902  }
9903  else if (INFILE(_LT_SEE_OTHER_LAST2)) {
9904  INTERESTING(lDebug ? "Gen-OTH-L2" : "See-doc.OTHER");
9905  }
9906  else if (INFILE(_LT_SEE_OTHER_LAST3)) {
9907  INTERESTING(lDebug ? "Gen-OTH-L3" : "See-doc.OTHER");
9908  }
9909  else if (INFILE(_LT_SEE_OUTPUT_1)) {
9910  INTERESTING(lDebug ? "Gen-EXC-1" : "GNU-style.interactive");
9911  }
9912  return;
9913 #endif /* OLD_VERSION */
9914 }
9915 
9916 
9917 int checkPublicDomain(char *filetext, int size, int score, int kwbm,
9918  int isML, int isPS)
9919 {
9920  int ret;
9921 
9922 #ifdef PROC_TRACE
9923  traceFunc("== checkPublicDomain(%p, %d, %d, 0x%x, %d, %d)\n", filetext,
9924  size, score, kwbm, isML, isPS);
9925 #endif /* PROC_TRACE */
9926 
9927  if (pd >= 0) { /* already tried? */
9928  return(pd);
9929  }
9930  ret = 0; /* default answer is "no" */
9931  if (INFILE(_LT_PUBDOM_CC)) {
9932  INTERESTING(lDebug ? "Pubdom(CC)" : LS_PD_CLM);
9933  ret = 1;
9934  } else if (INFILE(_LT_PUBDOM_ODC)) {
9935  INTERESTING(lDebug ? "Pubdom(ODC)" : LS_PD_CLM);
9936  ret = 1;
9937  } else if (INFILE(_LT_PUBDOM_PDD)) {
9938  INTERESTING(lDebug ? "Pubdom(PDD)" : LS_PD_CLM);
9939  ret = 1;
9940  } else if (INFILE(_LT_PUBDOM_USE)) {
9941  INTERESTING(lDebug ? "Pubdom(use)" : LS_PD_CLM);
9942  ret = 1;
9943  } else if (HASTEXT(_LT_PUBDOM_NOTclaim, REG_EXTENDED)) {
9944  INTERESTING(LS_NOT_PD);
9945  ret = 1;
9946  } else if (INFILE(_CR_PUBDOM)) {
9947  if (INFILE(_LT_PUBDOMNOTcpyrt)) {
9948  INTERESTING(LS_PD_CLM);
9949  } else {
9950  INTERESTING(LS_PD_CPRT);
9951  }
9952  ret = 1;
9953  } else if (INFILE(_CR_NONE)) {
9954  INTERESTING(lDebug ? "Pubdom(no-CR)" : LS_PD_CLM);
9955  ret = 1;
9956  } else if (INFILE(_LT_UNLIN) || URL_INFILE(_URL_UNLINref) || URL_INFILE(_URL_UNLIN)) {
9957  INTERESTING("Unlicense");
9958  ret = 1;
9959  } else if (INFILE(_LT_PUBDOM_1)) {
9960  INTERESTING(lDebug ? "Pubdom(1)" : LS_PD_CLM);
9961  ret = 1;
9962  } else if (INFILE(_LT_PUBDOM_2) && NOT_INFILE(_PHR_PUBLIC_FUNCT) && NOT_INFILE(_LT_NOTPUBDOM_1)) {
9963  INTERESTING(lDebug ? "Pubdom(2)" : LS_PD_CLM);
9964  ret = 1;
9965  } else if (INFILE(_LT_PUBDOM_3)) {
9966  INTERESTING(lDebug ? "Pubdom(3)" : LS_PD_CLM);
9967  ret = 1;
9968 #ifdef REMOVED_AS_TOO_BROAD
9969  } else if (INFILE(_LT_PUBDOM_4)) {
9970  INTERESTING(lDebug ? "Pubdom(4)" : LS_PD_CLM);
9971  ret = 1;
9972  } else if (INFILE(_LT_PUBDOM_5)) {
9973  INTERESTING(lDebug ? "Pubdom(5)" : LS_PD_CLM);
9974  ret = 1;
9975  } else if (INFILE(_LT_PUBDOM_6)) {
9976  INTERESTING(lDebug ? "No-more-copyright" : LS_PD_CLM);
9977  ret = 1;
9978 #endif // done removing too broad signatures
9979  } else if (INFILE(_LT_PUBDOM_7)) {
9980  INTERESTING(lDebug ? "Pubdom(7)" : LS_PD_CLM);
9981  ret = 1;
9982  } else if (INFILE(_LT_PUBDOM_8)) {
9983  INTERESTING(lDebug ? "Pubdom(8)" : LS_PD_CLM);
9984  ret = 1;
9985  } else if (INFILE(_LT_PUBDOM_9)) {
9986  INTERESTING(lDebug ? "Pubdom(9)" : LS_PD_CLM);
9987  ret = 1;
9988  } else if (INFILE(_LT_PUBDOM_10)) {
9989  INTERESTING(lDebug ? "Pubdom(10)" : LS_PD_CLM);
9990  ret = 1;
9991  } else if (INFILE(_URL_PUBDOM)) {
9992  INTERESTING(lDebug ? "Pubdom(URL)" : LS_PD_CLM);
9993  ret = 1;
9994  } else if (HASKW(kwbm, _KW_public_domain) && score <= 3) {
9995  INTERESTING(LS_PD_ONLY);
9996  ret = 1;
9997  }
9998  return(ret);
9999 }
10000 
10001 
10009 void checkCornerCases(char *filetext, int size, int score,
10010  int kwbm, int isML, int isPS, int nw, int force)
10011 {
10012 
10013 #ifdef PROC_TRACE
10014  traceFunc("== checkCornerCases(%p, %d, %d, %d, %d, %d, %d, %d)\n",
10015  filetext, size, score, kwbm, isML, isPS, nw, force);
10016 #endif /* PROC_TRACE */
10017 
10018  if (crCheck++) { /* only need to check this once */
10019  return;
10020  }
10021  if (INFILE(_LT_NOTATT_NOTBSD)) {
10022  LOWINTEREST("non-ATT-BSD");
10023  }
10024 
10025  /*
10026  * FINAL cases: (close to giving up) -- lowest-importance items
10027  */
10034  /*
10035  if (!(*licStr)) {
10036  if (HASTEXT(_TEXT_TRADEMARK, 0)) {
10037  LOWINTEREST(LS_TDMKONLY);
10038  }
10039  }
10040  */
10041  if (!(*licStr)) {
10042  /*
10043  * We may have matched something but ultimately determined there's nothing
10044  * significant or of any interest, so empty the list of any matches we may
10045  * have observed to this point.
10046  */
10047  listClear(&whereList, NO); /* force 'nothing to report' */
10048  }
10049  return;
10050 }
10051 
10052 int match3(int base, char *buf, int score, int save, int isML, int isPS)
10053 {
10054  int i;
10055  int j;
10056  char *cp;
10057  /* */
10058 #ifdef PROC_TRACE
10059 #ifdef PROC_TRACE_SWITCH
10060  if (gl.ptswitch)
10061 #endif /* PROC_TRACE_SWITCH */
10062  printf("== match3(%d, %p, %d, %d, %d, %d)\n", base, buf, score, save,
10063  isML, isPS);
10064 #else /* not PROC_TRACE */
10065 #ifdef UNKNOWN_CHECK_DEBUG
10066  printf("== match3(%d, %p, %d, %d, %d, %d)\n", base, buf, score, save,
10067  isML, isPS);
10068 #endif /* UNKNOWN_CHECK_DEBUG */
10069 #endif /* not PROC_TRACE */
10070  /* */
10071  for (i = 1; i <= 3; i++) {
10072  if (dbgIdxGrep(base+i, buf, (save && lDiags)) == 0) {
10073 #ifdef UNKNOWN_CHECK_DEBUG
10074  printf("match3: FAILED regex (%d)!\n", base+i);
10075 #endif /* UNKNOWN_CHECK_DEBUG */
10076  return(0);
10077  }
10078  }
10079 #ifdef UNKNOWN_CHECK_DEBUG
10080  printf("match3: Success (%s)!\n",
10081  (save ? "buffer-for-real" : "file-initial-check"));
10082 #endif /* UNKNOWN_CHECK_DEBUG */
10083  /*
10084  * Some "possible licenses" are technical descriptions that share some words
10085  * that typically appear in licenses (distribution, terms, permission(s)).
10086  *****
10087  * If we're checking a paragraph (e.g., "save" is non-zero), see if there are
10088  * other engineering-development-technical terms in the paragraph that tend
10089  * to NOT be present in licenses...
10090  */
10091  if (save) {
10092  for (j = i = 0, cp = buf; *cp; i++, cp++) {
10093  if (*cp & 0200) {
10094  j++;
10095  }
10096  }
10097 #ifdef UNKNOWN_CHECK_DEBUG
10098  printf("DEEBUG: %d bytes, %d 8-bit\n", i, j);
10099 #endif /* UNKNOWN_CHECK_DEBUG */
10100  if (j >= (i/2)) {
10101  if (lDiags) {
10102  printf("... no, >= 50 percent 8-bit characters\n");
10103  }
10104  return(0);
10105  }
10106  /*
10107  We need to allocate space for a doctored-up version of the candidate
10108  unknown-license paragraph, but it's ONLY used in this function. E.g.,
10109  make darn sure we free it up before exiting this function...
10110  */
10111  cp = copyString(buf, MTAG_TEXTPARA);
10112  doctorBuffer(cp, isML, isPS, NO);
10113  /*
10114  If we detected a no-warraty statement earlier, "checknw" is != 0.
10115  Look for a no-warrany statement in this candidate paragraph.
10116  If we find it, report failure for the paragraph and remember
10117  finding the no--warranty.
10118  */
10119  if (checknw && !idxGrep(checknw, cp, REG_ICASE|REG_EXTENDED)) {
10120  if (lDiags) {
10121  printf("... no, warranty regex %d\n", checknw);
10122  }
10123  checknw = 0;
10124  memFree(cp, MTAG_TEXTPARA);
10125  return(0);
10126  }
10127  /*
10128  False-positive-check: GNU/FSF template (often see in ".po"
10129  and ".c" files
10130 
10131  "This file is distributed under the same license as the
10132  package PACKAGE"
10133  */
10134  if (dbgIdxGrep(_LT_BOGUSTMPL, cp, lDiags)) {
10135  if (lDiags) {
10136  printf("... no, FSF-GNU template\n");
10137  }
10138  memFree(cp, MTAG_TEXTPARA);
10139  return(0);
10140  }
10141  /*
10142  * False-positive-check: GNU GPL preamble statements; these have been
10143  * "sprinkled" throughout files seen before, so check ALL of them.
10144  */
10145  if (dbgIdxGrep(_PHR_GNU_FREEDOM, cp, lDiags) ||
10146  dbgIdxGrep(_PHR_GNU_COPYING, cp, lDiags) ||
10147  dbgIdxGrep(_PHR_GNU_PROTECT, cp, lDiags)) {
10148  if (lDiags) {
10149  printf("... no, GNU-GPL preamble\n");
10150  }
10151  memFree(cp, MTAG_TEXTPARA);
10152  return(0);
10153  }
10154  if (lDiags) {
10155  printf("... candidate paragraph analysis:\n");
10156  }
10157  for (i = j = 0; i < NKEYWORDS; i++) {
10158  if (idxGrep_recordPositionDoctored(i + _KW_first, cp, REG_EXTENDED | REG_ICASE)) {
10159  if (lDiags) {
10160  printf("%s", j ? ", " : "KEYWORDS: ");
10161  printf("%s", _REGEX(i+_KW_first));
10162  }
10163  j++;
10164  }
10165  }
10166  if (lDiags) {
10167  if (j) {
10168  printf("\n");
10169  }
10170  printf("SCORES: para %d, file %d == %05.2f%% ", j,
10171  score, 100.0 * (float) j / (float) score);
10172  }
10173  /*
10174  Here, we guess that an UnclassifiedLicense exists in a paragraph
10175  when:
10176  + a paragraph has a keyword-score of at least 3 -OR-
10177  + ... a keyword-score of 2 *AND* is >= 50% of the file's
10178  total score
10179 
10180  It's likely we'll see a few false-positives with a
10181  keyword-score of 2 but there are cases where this works.
10182  We can filter out the 2-scores we see
10183  with the FILTER checks below...
10184  */
10185  if (j == 0) { /* no license-like keywords */
10186  if (lDiags) {
10187  printf("(ZERO legal keywords)\n");
10188  }
10189  memFree(cp, MTAG_TEXTPARA);
10190  return(0);
10191  }
10192  if (j >= 3 || (j == 2 && j*2 >= score)) {
10193  if (j >= 3 && lDiags) {
10194  printf("(LIKELY: para-score >= 2)\n");
10195  }
10196  else if (lDiags) {
10197  printf("(MAYBE: local percentage)\n");
10198  }
10199  }
10200  else {
10201  if (lDiags) {
10202  printf("(NOT LIKELY a license)\n");
10203 #if 0
10204 #endif
10205  printf("[FAILED]\n%s\n[/FAILED]\n", buf);
10206  }
10207  memFree(cp, MTAG_TEXTPARA);
10208  return(0);
10209  }
10210  /*
10211  Sure, there ARE paragraphs with these words that do NOT constitute a
10212  real license. Look for key words and phrases of them HERE. This list
10213  of filters will likely grow over time.
10214  */
10215  for (i = 0; i < NFILTER; i++) {
10216  if (dbgIdxGrep(_FILTER_first+i, buf, lDiags)) {
10217  if (lDiags) {
10218  printf("!! NO-LIC: filter %d\n", ++i);
10219  }
10220  memFree(cp, MTAG_TEXTPARA);
10221  return(0);
10222  }
10223  }
10224  if (cur.licPara == NULL_STR) {
10225  saveLicenseParagraph(buf, isML, isPS, YES);
10226  }
10227  memFree(cp, MTAG_TEXTPARA);
10228  }
10229 #ifdef UNKNOWN_CHECK_DEBUG
10230  else {
10231  printf("match3: Initial-check only (save == %d)\n", save);
10232  }
10233 #endif /* UNKNOWN_CHECK_DEBUG */
10234  return(1);
10235 }
10236 
10237 void saveLicenseParagraph(char *mtext, int isML, int isPS, int entireBuf)
10238 {
10239  char *cp;
10240  char *start;
10241  int index=0;
10242  int len;
10243  start = copyString(mtext, MTAG_TEXTPARA);
10244  if(!start)
10245  {
10246  LOG_FATAL("called saveLicenseParagraph without text")
10247  Bail(-__LINE__);
10248  }
10249 #ifdef PROC_TRACE
10250 #ifdef PROC_TRACE_SWITCH
10251  if (gl.ptswitch)
10252 #endif /* PROC_TRACE_SWITCH */
10253  printf("== saveLicenseParagraph(%p, %d, %d, %d)\n", mtext, isML, isPS, entireBuf);
10254 #endif /* PROC_TRACE */
10255  /* */
10256  if (entireBuf) {
10257  cur.licPara = copyString(mtext, MTAG_TEXTPARA);
10258  } else {
10259  if (cur.regm.rm_so < 50) {
10260  len = cur.regm.rm_eo + 80;
10261  } else {
10262  len = cur.regm.rm_eo + 130 - cur.regm.rm_so;
10263  index = cur.regm.rm_so - 50;
10264  }
10265  cur.licPara = memAlloc(len + 9, MTAG_TEXTPARA);
10266  (void) strcpy(cur.licPara, "... ");
10267  (void) strncpy(cur.licPara + 4, start + index, len);
10268  (void) strcpy(cur.licPara + len + 4, " ...");
10269  memFree(start, MTAG_TEXTPARA);
10270  }
10271 
10272  /*
10273  * Convert double-line-feed chars ("\r" and "\n" combos) to a single "\n"
10274  */
10275  for (cp = cur.licPara; *cp; cp++) {
10276  if ((*cp == '\n' || *cp == '\r') &&
10277  (*(cp+1) == '\r' || *(cp+1) == '\n')) {
10278  *cp = ' ';
10279  *(cp+1) = '\n';
10280  }
10281  }
10282  if (lDiags) {
10283  printf("[PERHAPS] (%p)\n%s\n[/PERHAPS]\n", cur.licPara, cur.licPara);
10284  }
10285  return;
10286 }
10287 
10296 void spdxReference(char *filetext, int size, int isML, int isPS)
10297 {
10298  if (INFILE(_SPDX_Glide)) {
10299  INTERESTING("Glide");
10300  }
10301  if (INFILE(_SPDX_Abstyles)) {
10302  INTERESTING("Abstyles");
10303  }
10304  if (INFILE(_SPDX_AFL_11)) {
10305  INTERESTING("AFL-1.1");
10306  }
10307  if (INFILE(_SPDX_AFL_12)) {
10308  INTERESTING("AFL-1.2");
10309  }
10310  if (INFILE(_SPDX_AFL_20)) {
10311  INTERESTING("AFL-2.0");
10312  }
10313  if (INFILE(_SPDX_AFL_21)) {
10314  INTERESTING("AFL-2.1");
10315  }
10316  if (INFILE(_SPDX_AFL_30)) {
10317  INTERESTING("AFL-3.0");
10318  }
10319  if (INFILE(_SPDX_AMPAS)) {
10320  INTERESTING("AMPAS");
10321  }
10322  if (INFILE(_SPDX_APL_10)) {
10323  INTERESTING("APL-1.0");
10324  }
10325  if (INFILE(_SPDX_Adobe_Glyph)) {
10326  INTERESTING("Adobe-Glyph");
10327  }
10328  if (INFILE(_SPDX_APAFML)) {
10329  INTERESTING("APAFML");
10330  }
10331  if (INFILE(_SPDX_Adobe_2006)) {
10332  INTERESTING("Adobe-2006");
10333  }
10334  if (INFILE(_SPDX_Afmparse)) {
10335  INTERESTING("Afmparse");
10336  }
10337  if (INFILE(_SPDX_Aladdin)) {
10338  INTERESTING("Aladdin");
10339  }
10340  if (INFILE(_SPDX_ADSL)) {
10341  INTERESTING("ADSL");
10342  }
10343  if (INFILE(_SPDX_AMDPLPA)) {
10344  INTERESTING("AMDPLPA");
10345  }
10346  if (INFILE(_SPDX_ANTLR_PD)) {
10347  INTERESTING("ANTLR-PD");
10348  }
10349  if (INFILE(_SPDX_AML)) {
10350  INTERESTING("AML");
10351  }
10352  if (INFILE(_SPDX_APSL_10)) {
10353  INTERESTING("APSL-1.0");
10354  }
10355  if (INFILE(_SPDX_APSL_11)) {
10356  INTERESTING("APSL-1.1");
10357  }
10358  if (INFILE(_SPDX_APSL_12)) {
10359  INTERESTING("APSL-1.2");
10360  }
10361  if (INFILE(_SPDX_APSL_20)) {
10362  INTERESTING("APSL-2.0");
10363  }
10364  if (INFILE(_SPDX_Artistic_10_Perl)) {
10365  INTERESTING("Artistic-1.0-Perl");
10366  }
10367  else if (INFILE(_SPDX_Artistic_10_cl8)) {
10368  INTERESTING("Artistic-1.0-cl8");
10369  }
10370  else if (INFILE(_SPDX_Artistic_10)) {
10371  INTERESTING("Artistic-1.0");
10372  }
10373  if (INFILE(_SPDX_Artistic_20)) {
10374  INTERESTING("Artistic-2.0");
10375  }
10376  if (INFILE(_SPDX_AAL)) {
10377  INTERESTING("AAL");
10378  }
10379  if (INFILE(_SPDX_Bahyph)) {
10380  INTERESTING("Bahyph");
10381  }
10382  if (INFILE(_SPDX_Barr)) {
10383  INTERESTING("Barr");
10384  }
10385  if (INFILE(_SPDX_Beerware)) {
10386  INTERESTING("Beerware");
10387  }
10388  if (INFILE(_SPDX_BitTorrent_10)) {
10389  INTERESTING("BitTorrent-1.0");
10390  }
10391  else if (INFILE(_SPDX_BitTorrent_11)) {
10392  INTERESTING("BitTorrent-1.1");
10393  }
10394  if (INFILE(_SPDX_BSL_10)) {
10395  INTERESTING("BSL-1.0");
10396  }
10397  if (INFILE(_SPDX_Borceux)) {
10398  INTERESTING("Borceux");
10399  }
10400  if (INFILE(_SPDX_0BSD)) {
10401  INTERESTING("0BSD");
10402  }
10403  if (INFILE(_SPDX_bzip2_105)) {
10404  INTERESTING("bzip2-1.0.5");
10405  }
10406  else if (INFILE(_SPDX_bzip2_106)) {
10407  INTERESTING("bzip2-1.0.6");
10408  }
10409  if (INFILE(_SPDX_Caldera)) {
10410  INTERESTING("Caldera");
10411  }
10412  if (INFILE(_SPDX_ClArtistic)) {
10413  INTERESTING("ClArtistic");
10414  }
10415  if (INFILE(_SPDX_CNRI_Jython)) {
10416  INTERESTING("CNRI-Jython");
10417  }
10418  if (INFILE(_SPDX_CPOL_102)) {
10419  INTERESTING("CPOL-1.02");
10420  }
10421  if (INFILE(_SPDX_CPAL_10)) {
10422  INTERESTING("CPAL-1.0");
10423  }
10424  if (INFILE(_SPDX_CPL_10)) {
10425  INTERESTING("CPL-1.0");
10426  }
10427  if (INFILE(_SPDX_CATOSL_11)) {
10428  INTERESTING("CATOSL-1.1");
10429  }
10430  if (INFILE(_SPDX_Condor_11)) {
10431  INTERESTING("Condor-1.1");
10432  }
10433  if (INFILE(_SPDX_CC_BY_10)) {
10434  INTERESTING("CC-BY-1.0");
10435  }
10436  else if (INFILE(_SPDX_CC_BY_20)) {
10437  INTERESTING("CC-BY-2.0");
10438  }
10439  else if (INFILE(_SPDX_CC_BY_25)) {
10440  INTERESTING("CC-BY-2.5");
10441  }
10442  else if (INFILE(_SPDX_CC_BY_30)) {
10443  INTERESTING("CC-BY-3.0");
10444  }
10445  else if (INFILE(_SPDX_CC_BY_40)) {
10446  INTERESTING("CC-BY-4.0");
10447  }
10448  if (INFILE(_SPDX_CC_BY_ND_10)) {
10449  INTERESTING("CC-BY-ND-1.0");
10450  }
10451  else if (INFILE(_SPDX_CC_BY_ND_20)) {
10452  INTERESTING("CC-BY-ND-2.0");
10453  }
10454  else if (INFILE(_SPDX_CC_BY_ND_25)) {
10455  INTERESTING("CC-BY-ND-2.5");
10456  }
10457  else if (INFILE(_SPDX_CC_BY_ND_30)) {
10458  INTERESTING("CC-BY-ND-3.0");
10459  }
10460  else if (INFILE(_SPDX_CC_BY_ND_40)) {
10461  INTERESTING("CC-BY-ND-4.0");
10462  }
10463  if (INFILE(_SPDX_CC_BY_NC_10)) {
10464  INTERESTING("CC-BY-NC-1.0");
10465  }
10466  else if (INFILE(_SPDX_CC_BY_NC_20)) {
10467  INTERESTING("CC-BY-NC-2.0");
10468  }
10469  else if (INFILE(_SPDX_CC_BY_NC_25)) {
10470  INTERESTING("CC-BY-NC-2.5");
10471  }
10472  else if (INFILE(_SPDX_CC_BY_NC_30)) {
10473  INTERESTING("CC-BY-NC-3.0");
10474  }
10475  else if (INFILE(_SPDX_CC_BY_NC_40)) {
10476  INTERESTING("CC-BY-NC-4.0");
10477  }
10478  if (INFILE(_SPDX_CC_BY_NC_ND_10)) {
10479  INTERESTING("CC-BY-NC-ND-1.0");
10480  }
10481  else if (INFILE(_SPDX_CC_BY_NC_ND_20)) {
10482  INTERESTING("CC-BY-NC-ND-2.0");
10483  }
10484  else if (INFILE(_SPDX_CC_BY_NC_ND_25)) {
10485  INTERESTING("CC-BY-NC-ND-2.5");
10486  }
10487  else if (INFILE(_SPDX_CC_BY_NC_ND_30)) {
10488  INTERESTING("CC-BY-NC-ND-3.0");
10489  }
10490  else if (INFILE(_SPDX_CC_BY_NC_ND_40)) {
10491  INTERESTING("CC-BY-NC-ND-4.0");
10492  }
10493  if (INFILE(_SPDX_CC_BY_NC_SA_10)) {
10494  INTERESTING("CC-BY-NC-SA-1.0");
10495  }
10496  else if (INFILE(_SPDX_CC_BY_NC_SA_20)) {
10497  INTERESTING("CC-BY-NC-SA-2.0");
10498  }
10499  else if (INFILE(_SPDX_CC_BY_NC_SA_25)) {
10500  INTERESTING("CC-BY-NC-SA-2.5");
10501  }
10502  else if (INFILE(_SPDX_CC_BY_NC_SA_30)) {
10503  INTERESTING("CC-BY-NC-SA-3.0");
10504  }
10505  else if (INFILE(_SPDX_CC_BY_NC_SA_40)) {
10506  INTERESTING("CC-BY-NC-SA-4.0");
10507  }
10508  if (INFILE(_SPDX_CC_BY_SA_10)) {
10509  INTERESTING("CC-BY-SA-1.0");
10510  }
10511  else if (INFILE(_SPDX_CC_BY_SA_20)) {
10512  INTERESTING("CC-BY-SA-2.0");
10513  }
10514  else if (INFILE(_SPDX_CC_BY_SA_25)) {
10515  INTERESTING("CC-BY-SA-2.5");
10516  }
10517  else if (INFILE(_SPDX_CC_BY_SA_30)) {
10518  INTERESTING("CC-BY-SA-3.0");
10519  }
10520  else if (INFILE(_SPDX_CC_BY_SA_40)) {
10521  INTERESTING("CC-BY-SA-4.0");
10522  }
10523  if (INFILE(_SPDX_CDLA_Permissive_10)) {
10524  INTERESTING("CDLA-Permissive-1.0");
10525  }
10526  if (INFILE(_SPDX_CDLA_Sharing_10)) {
10527  INTERESTING("CDLA-Sharing-1.0");
10528  }
10529  if (INFILE(_SPDX_Crossword)) {
10530  INTERESTING("Crossword");
10531  }
10532  if (INFILE(_SPDX_CrystalStacker)) {
10533  INTERESTING("CrystalStacker");
10534  }
10535  if (INFILE(_SPDX_CUA_OPL_10)) {
10536  INTERESTING("CUA-OPL-1.0");
10537  }
10538  if (INFILE(_SPDX_Cube)) {
10539  INTERESTING("Cube");
10540  }
10541  if (INFILE(_SPDX_curl)) {
10542  INTERESTING("curl");
10543  }
10544  if (INFILE(_SPDX_D_FSL_10)) {
10545  INTERESTING("D-FSL-1.0");
10546  }
10547  if (INFILE(_SPDX_diffmark)) {
10548  INTERESTING("diffmark");
10549  }
10550  if (INFILE(_SPDX_WTFPL)) {
10551  INTERESTING("WTFPL");
10552  }
10553  if (HASTEXT(_SPDX_DOC, REG_EXTENDED) || HASTEXT(_PHR_DOC, REG_EXTENDED)) {
10554  INTERESTING("DOC");
10555  }
10556  if (INFILE(_SPDX_Dotseqn)) {
10557  INTERESTING("Dotseqn");
10558  }
10559  if (INFILE(_SPDX_DSDP)) {
10560  INTERESTING("DSDP");
10561  }
10562  if (INFILE(_SPDX_dvipdfm)) {
10563  INTERESTING("dvipdfm");
10564  }
10565  if (INFILE(_SPDX_EPL_10)) {
10566  INTERESTING("EPL-1.0");
10567  }
10568  else if (INFILE(_SPDX_EPL_20)) {
10569  INTERESTING("EPL-2.0");
10570  }
10571  if (INFILE(_SPDX_ECL_10)) {
10572  INTERESTING("ECL-1.0");
10573  }
10574  if (INFILE(_SPDX_ECL_20)) {
10575  INTERESTING("ECL-2.0");
10576  }
10577  if (INFILE(_SPDX_eGenix)) {
10578  INTERESTING("eGenix");
10579  }
10580  if (INFILE(_SPDX_EFL_10)) {
10581  INTERESTING("EFL-1.0");
10582  }
10583  if (INFILE(_SPDX_EFL_20)) {
10584  INTERESTING("EFL-2.0");
10585  }
10586  if (INFILE(_SPDX_Entessa)) {
10587  INTERESTING("Entessa");
10588  }
10589  if (INFILE(_SPDX_ErlPL_11)) {
10590  INTERESTING("ErlPL-1.1");
10591  }
10592  if (INFILE(_SPDX_EUDatagrid)) {
10593  INTERESTING("EUDatagrid");
10594  }
10595  if (INFILE(_SPDX_EUPL_10)) {
10596  INTERESTING("EUPL-1.0");
10597  }
10598  else if (INFILE(_SPDX_EUPL_11)) {
10599  INTERESTING("EUPL-1.1");
10600  }
10601  else if (INFILE(_SPDX_EUPL_12)) {
10602  INTERESTING("EUPL-1.2");
10603  }
10604  if (INFILE(_SPDX_Eurosym)) {
10605  INTERESTING("Eurosym");
10606  }
10607  if (HASTEXT(_SPDX_Fair, REG_EXTENDED) || HASTEXT(_PHR_Fair, REG_EXTENDED)) {
10608  INTERESTING("Fair");
10609  }
10610  if (INFILE(_SPDX_Frameworx_10)) {
10611  INTERESTING("Frameworx-1.0");
10612  }
10613  if (INFILE(_SPDX_FreeImage)) {
10614  INTERESTING("FreeImage");
10615  }
10616  if (INFILE(_SPDX_FSFAP)) {
10617  INTERESTING("FSFAP");
10618  }
10619  if (INFILE(_SPDX_FSFULLR)) {
10620  INTERESTING("FSFULLR");
10621  }
10622  else if (INFILE(_SPDX_FSFUL)) {
10623  INTERESTING("FSFUL");
10624  }
10625  if (INFILE(_SPDX_Giftware)) {
10626  INTERESTING("Giftware");
10627  }
10628  if (INFILE(_SPDX_GL2PS)) {
10629  INTERESTING("GL2PS");
10630  }
10631  if (INFILE(_SPDX_Glulxe)) {
10632  INTERESTING("Glulxe");
10633  }
10634  if (INFILE(_SPDX_GFDL_11_or_later)
10635  || HASTEXT(_SPDX_GFDL_11plus, REG_EXTENDED)
10636  || HASTEXT(_PHR_GFDL_11plus, REG_EXTENDED))
10637  {
10638  INTERESTING("GFDL-1.1+");
10639  }
10640  else if (INFILE(_SPDX_GFDL_11)) {
10641  INTERESTING("GFDL-1.1");
10642  }
10643  else if (INFILE(_SPDX_GFDL_12_or_later)
10644  || HASTEXT(_SPDX_GFDL_12plus, REG_EXTENDED)
10645  || HASTEXT(_PHR_GFDL_12plus, REG_EXTENDED))
10646  {
10647  INTERESTING("GFDL-1.2+");
10648  }
10649  else if (INFILE(_SPDX_GFDL_12)) {
10650  INTERESTING("GFDL-1.2");
10651  }
10652  else if (INFILE(_SPDX_GFDL_13_or_later)
10653  || HASTEXT(_SPDX_GFDL_13plus, REG_EXTENDED)
10654  || HASTEXT(_PHR_GFDL_13plus, REG_EXTENDED))
10655  {
10656  INTERESTING("GFDL-1.3+");
10657  }
10658  else if (INFILE(_SPDX_GFDL_13)) {
10659  INTERESTING("GFDL-1.3");
10660  }
10661  if (INFILE(_SPDX_gnuplot)) {
10662  INTERESTING("gnuplot");
10663  }
10664  if (INFILE(_SPDX_gSOAP_13b)) {
10665  INTERESTING("gSOAP-1.3b");
10666  }
10667  if (INFILE(_SPDX_HaskellReport)) {
10668  INTERESTING("HaskellReport");
10669  }
10670  if (INFILE(_SPDX_HPND)) {
10671  INTERESTING("HPND");
10672  }
10673  if (INFILE(_SPDX_IBM_pibs)) {
10674  INTERESTING("IBM-pibs");
10675  }
10676  if (INFILE(_SPDX_IPL_10)) {
10677  INTERESTING("IPL-1.0");
10678  }
10679  if (INFILE(_SPDX_ImageMagick)) {
10680  INTERESTING("ImageMagick");
10681  }
10682  if (INFILE(_SPDX_iMatix)) {
10683  INTERESTING("iMatix");
10684  }
10685  if (INFILE(_SPDX_Imlib2)) {
10686  INTERESTING("Imlib2");
10687  }
10688  if (INFILE(_SPDX_IJG)) {
10689  INTERESTING("IJG");
10690  }
10691  if (INFILE(_SPDX_Info_ZIP)) {
10692  INTERESTING("Info-ZIP");
10693  }
10694  if (INFILE(_SPDX_Interbase_10)) {
10695  INTERESTING("Interbase-1.0");
10696  }
10697  if (INFILE(_SPDX_IPA)) {
10698  INTERESTING("IPA");
10699  }
10700  if (INFILE(_SPDX_ISC)) {
10701  INTERESTING("ISC");
10702  }
10703  if (INFILE(_SPDX_JasPer_20)) {
10704  INTERESTING("JasPer-2.0");
10705  }
10706  if (INFILE(_SPDX_JSON)) {
10707  INTERESTING("JSON");
10708  }
10709  if (INFILE(_SPDX_Latex2e)) {
10710  INTERESTING("Latex2e");
10711  }
10712  if (INFILE(_SPDX_Leptonica)) {
10713  INTERESTING("Leptonica");
10714  }
10715  if (INFILE(_SPDX_LGPLLR)) {
10716  INTERESTING("LGPLLR");
10717  }
10718  if (INFILE(_SPDX_Libpng)) {
10719  INTERESTING("Libpng");
10720  }
10721  if (INFILE(_SPDX_libtiff)) {
10722  INTERESTING("libtiff");
10723  }
10724  if (INFILE(_SPDX_LAL_12)) {
10725  INTERESTING("LAL-1.2");
10726  }
10727  if (INFILE(_SPDX_LAL_13)) {
10728  INTERESTING("LAL-1.3");
10729  }
10730  if (INFILE(_SPDX_LiLiQ_P_11)) {
10731  INTERESTING("LiLiQ-P-1.1");
10732  }
10733  if (INFILE(_SPDX_LiLiQ_Rplus_11)) {
10734  INTERESTING("LiLiQ-Rplus-1.1");
10735  }
10736  if (INFILE(_SPDX_LiLiQ_R_11)) {
10737  INTERESTING("LiLiQ-R-1.1");
10738  }
10739  if (INFILE(_SPDX_Linux_OpenIB)) {
10740  INTERESTING("Linux-OpenIB");
10741  }
10742  if (INFILE(_SPDX_LPL_102)) {
10743  INTERESTING("LPL-1.02");
10744  }
10745  else if (INFILE(_SPDX_LPL_10)) {
10746  INTERESTING("LPL-1.0");
10747  }
10748  if (INFILE(_SPDX_LPPL_10)) {
10749  INTERESTING("LPPL-1.0");
10750  }
10751  if (INFILE(_SPDX_LPPL_11)) {
10752  INTERESTING("LPPL-1.1");
10753  }
10754  if (INFILE(_SPDX_LPPL_12)) {
10755  INTERESTING("LPPL-1.2");
10756  }
10757  if (INFILE(_SPDX_LPPL_13a)) {
10758  INTERESTING("LPPL-1.3a");
10759  }
10760  if (INFILE(_SPDX_LPPL_13c)) {
10761  INTERESTING("LPPL-1.3c");
10762  }
10763  if (INFILE(_SPDX_MakeIndex)) {
10764  INTERESTING("MakeIndex");
10765  }
10766  if (INFILE(_SPDX_MTLL)) {
10767  INTERESTING("MTLL");
10768  }
10769  if (INFILE(_SPDX_MS_PL)) {
10770  INTERESTING("MS-PL");
10771  }
10772  if (INFILE(_SPDX_MS_RL)) {
10773  INTERESTING("MS-RL");
10774  }
10775  if (INFILE(_SPDX_MirOS)) {
10776  INTERESTING("MirOS");
10777  }
10778  if (INFILE(_SPDX_MITNFA)) {
10779  INTERESTING("MITNFA");
10780  }
10781  if (!lmem[_fREAL] && INFILE(_SPDX_Motosoto)) {
10782  INTERESTING("Motosoto");
10783  }
10784  if (INFILE(_SPDX_mpich2)) {
10785  INTERESTING("mpich2");
10786  }
10787  if (INFILE(_SPDX_Multics)) {
10788  INTERESTING("Multics");
10789  }
10790  if (INFILE(_SPDX_Mup)) {
10791  INTERESTING("Mup");
10792  }
10793  if (INFILE(_SPDX_NASA_13)) {
10794  INTERESTING("NASA-1.3");
10795  }
10796  if (INFILE(_SPDX_Naumen)) {
10797  INTERESTING("Naumen");
10798  }
10799  if (INFILE(_SPDX_NBPL_10)) {
10800  INTERESTING("NBPL-1.0");
10801  }
10802  if (INFILE(_SPDX_Net_SNMP)) {
10803  INTERESTING("Net-SNMP");
10804  }
10805  if (INFILE(_SPDX_NetCDF)) {
10806  INTERESTING("NetCDF");
10807  }
10808  if (INFILE(_SPDX_NGPL)) {
10809  INTERESTING("NGPL");
10810  }
10811  if (INFILE(_SPDX_NOSL)) {
10812  INTERESTING("NOSL");
10813  }
10814  if (INFILE(_SPDX_NPL_10)) {
10815  INTERESTING("NPL-1.0");
10816  }
10817  if (INFILE(_SPDX_NPL_11)) {
10818  INTERESTING("NPL-1.1");
10819  }
10820  if (INFILE(_SPDX_Newsletr)) {
10821  INTERESTING("Newsletr");
10822  }
10823  if (INFILE(_SPDX_NLPL)) {
10824  INTERESTING("NLPL");
10825  }
10826  if (INFILE(_SPDX_Nokia) && NOT_INFILE(_LT_OPENSSL_NOKIA)) {
10827  INTERESTING("Nokia");
10828  }
10829  if (INFILE(_SPDX_NPOSL_30)) {
10830  INTERESTING("NPOSL-3.0");
10831  }
10832  if (INFILE(_SPDX_NLOD_10)) {
10833  INTERESTING("NLOD-1.0");
10834  }
10835  if (INFILE(_SPDX_Noweb)) {
10836  INTERESTING("Noweb");
10837  }
10838  if (INFILE(_SPDX_NRL)) {
10839  INTERESTING("NRL");
10840  }
10841  if (INFILE(_SPDX_NTP)) {
10842  INTERESTING("NTP");
10843  }
10844  if (INFILE(_SPDX_Nunit)) {
10845  INTERESTING("Nunit");
10846  }
10847  if (INFILE(_SPDX_OCLC_20)) {
10848  INTERESTING("OCLC-2.0");
10849  }
10850  if (INFILE(_SPDX_ODbL_10)) {
10851  INTERESTING("ODbL-1.0");
10852  }
10853  if (INFILE(_SPDX_PDDL_10)) {
10854  INTERESTING("PDDL-1.0");
10855  }
10856  if (INFILE(_SPDX_OCCT_PL)) {
10857  INTERESTING("OCCT-PL");
10858  }
10859  if (INFILE(_SPDX_ODC_By_10)) {
10860  INTERESTING("ODC-By-1.0");
10861  }
10862  if (INFILE(_SPDX_OGL_UK_10)) {
10863  INTERESTING("OGL-UK-1.0");
10864  }
10865  else if (INFILE(_SPDX_OGL_UK_20)) {
10866  INTERESTING("OGL-UK-2.0");
10867  }
10868  else if (INFILE(_SPDX_OGL_UK_30)) {
10869  INTERESTING("OGL-UK-3.0");
10870  }
10871  if (INFILE(_SPDX_OGTSL)) {
10872  INTERESTING("OGTSL");
10873  }
10874  if (INFILE(_SPDX_OLDAP_11)) {
10875  INTERESTING("OLDAP-1.1");
10876  }
10877  else if (INFILE(_SPDX_OLDAP_12)) {
10878  INTERESTING("OLDAP-1.2");
10879  }
10880  else if (INFILE(_SPDX_OLDAP_13)) {
10881  INTERESTING("OLDAP-1.3");
10882  }
10883  else if (INFILE(_SPDX_OLDAP_14)) {
10884  INTERESTING("OLDAP-1.4");
10885  }
10886  else if (INFILE(_SPDX_OLDAP_201)) {
10887  INTERESTING("OLDAP-2.0.1");
10888  }
10889  else if (INFILE(_SPDX_OLDAP_20)) {
10890  INTERESTING("OLDAP-2.0");
10891  }
10892  else if (INFILE(_SPDX_OLDAP_21)) {
10893  INTERESTING("OLDAP-2.1");
10894  }
10895  else if (INFILE(_SPDX_OLDAP_221)) {
10896  INTERESTING("OLDAP-2.2.1");
10897  }
10898  else if (INFILE(_SPDX_OLDAP_222)) {
10899  INTERESTING("OLDAP-2.2.2");
10900  }
10901  else if (INFILE(_SPDX_OLDAP_22)) {
10902  INTERESTING("OLDAP-2.2");
10903  }
10904  else if (INFILE(_SPDX_OLDAP_23)) {
10905  INTERESTING("OLDAP-2.3");
10906  }
10907  else if (INFILE(_SPDX_OLDAP_24)) {
10908  INTERESTING("OLDAP-2.4");
10909  }
10910  else if (INFILE(_SPDX_OLDAP_25)) {
10911  INTERESTING("OLDAP-2.5");
10912  }
10913  else if (INFILE(_SPDX_OLDAP_26)) {
10914  INTERESTING("OLDAP-2.6");
10915  }
10916  else if (INFILE(_SPDX_OLDAP_27)) {
10917  INTERESTING("OLDAP-2.7");
10918  }
10919  else if (INFILE(_SPDX_OLDAP_28)) {
10920  INTERESTING("OLDAP-2.8");
10921  }
10922  if (INFILE(_SPDX_OML)) {
10923  INTERESTING("OML");
10924  }
10925  if (INFILE(_SPDX_OPL_10)) {
10926  INTERESTING("OPL-1.0");
10927  }
10928  if (INFILE(_SPDX_OSL_10)) {
10929  INTERESTING("OSL-1.0");
10930  }
10931  if (INFILE(_SPDX_OSL_11)) {
10932  INTERESTING("OSL-1.1");
10933  }
10934  if (INFILE(_SPDX_OSL_20)) {
10935  INTERESTING("OSL-2.0");
10936  }
10937  if (INFILE(_SPDX_OSL_21)) {
10938  INTERESTING("OSL-2.1");
10939  }
10940  if (INFILE(_SPDX_OSL_30)) {
10941  INTERESTING("OSL-3.0");
10942  }
10943  if (INFILE(_SPDX_OSET_PL_21)) {
10944  INTERESTING("OSET-PL-2.1");
10945  }
10946  if (INFILE(_SPDX_PHP_301)) {
10947  INTERESTING("PHP-3.01");
10948  }
10949  else if (INFILE(_SPDX_PHP_30)) {
10950  INTERESTING("PHP-3.0");
10951  }
10952  if (INFILE(_SPDX_Plexus)) {
10953  INTERESTING("Plexus");
10954  }
10955  if (INFILE(_SPDX_PostgreSQL)) {
10956  INTERESTING("PostgreSQL");
10957  }
10958  if (INFILE(_SPDX_psfrag)) {
10959  INTERESTING("psfrag");
10960  }
10961  if (INFILE(_SPDX_psutils)) {
10962  INTERESTING("psutils");
10963  }
10964  if (INFILE(_SPDX_Python_20)) {
10965  INTERESTING("Python-2.0");
10966  }
10967  if (INFILE(_SPDX_QPL_10)) {
10968  INTERESTING("QPL-1.0");
10969  }
10970  if (INFILE(_SPDX_Qhull)) {
10971  INTERESTING("Qhull");
10972  }
10973  if (INFILE(_SPDX_Rdisc)) {
10974  INTERESTING("Rdisc");
10975  }
10976  if (INFILE(_SPDX_RPSL_10)) {
10977  INTERESTING("RPSL-1.0");
10978  }
10979  if (INFILE(_SPDX_RPL_11)) {
10980  INTERESTING("RPL-1.1");
10981  }
10982  if (INFILE(_SPDX_RPL_15)) {
10983  INTERESTING("RPL-1.5");
10984  }
10985  if (INFILE(_SPDX_RHeCos_11)) {
10986  INTERESTING("RHeCos-1.1");
10987  }
10988  if (INFILE(_SPDX_RSCPL)) {
10989  INTERESTING("RSCPL");
10990  }
10991  if (INFILE(_SPDX_RSA_MD)) {
10992  INTERESTING("RSA-MD");
10993  }
10994  if (INFILE(_SPDX_Ruby)) {
10995  INTERESTING("Ruby");
10996  }
10997  if (INFILE(_SPDX_SAX_PD)) {
10998  INTERESTING("SAX-PD");
10999  }
11000  if (INFILE(_SPDX_Saxpath)) {
11001  INTERESTING("Saxpath");
11002  }
11003  if (INFILE(_SPDX_SCEA)) {
11004  INTERESTING("SCEA");
11005  }
11006  if (INFILE(_SPDX_SWL)) {
11007  INTERESTING("SWL");
11008  }
11009  if (INFILE(_SPDX_SMPPL)) {
11010  INTERESTING("SMPPL");
11011  }
11012  if (INFILE(_SPDX_Sendmail_823)) {
11013  INTERESTING("Sendmail-8.23");
11014  }
11015  else if (INFILE(_SPDX_Sendmail)) {
11016  INTERESTING("Sendmail");
11017  }
11018  if (INFILE(_SPDX_SGI_B_10)) {
11019  INTERESTING("SGI-B-1.0");
11020  }
11021  if (INFILE(_SPDX_SGI_B_11)) {
11022  INTERESTING("SGI-B-1.1");
11023  }
11024  if (INFILE(_SPDX_SGI_B_20)) {
11025  INTERESTING("SGI-B-2.0");
11026  }
11027  if (INFILE(_SPDX_OFL_10)) {
11028  INTERESTING("OFL-1.0");
11029  }
11030  if (INFILE(_SPDX_OFL_11)) {
11031  INTERESTING("OFL-1.1");
11032  }
11033  if (INFILE(_SPDX_SimPL_20)) {
11034  INTERESTING("SimPL-2.0");
11035  }
11036  if (INFILE(_SPDX_Sleepycat)) {
11037  INTERESTING("Sleepycat");
11038  }
11039  if (INFILE(_SPDX_SNIA)) {
11040  INTERESTING("SNIA");
11041  }
11042  if (INFILE(_SPDX_Spencer_86)) {
11043  INTERESTING("Spencer-86");
11044  }
11045  if (INFILE(_SPDX_Spencer_94)) {
11046  INTERESTING("Spencer-94");
11047  }
11048  if (INFILE(_SPDX_Spencer_99)) {
11049  INTERESTING("Spencer-99");
11050  }
11051  if (INFILE(_SPDX_SMLNJ)) {
11052  INTERESTING("SMLNJ");
11053  }
11054  if (INFILE(_SPDX_SugarCRM_113)) {
11055  INTERESTING("SugarCRM-1.1.3");
11056  }
11057  if (INFILE(_SPDX_SISSL_12)) {
11058  INTERESTING("SISSL-1.2");
11059  }
11060  else if (!lmem[_fREAL] && INFILE(_SPDX_SISSL)) {
11061  INTERESTING("SISSL");
11062  }
11063  if (INFILE(_SPDX_SPL_10)) {
11064  INTERESTING("SPL-1.0");
11065  }
11066  if (INFILE(_SPDX_Watcom_10)) {
11067  INTERESTING("Watcom-1.0");
11068  }
11069  if (INFILE(_SPDX_TCP_wrappers)) {
11070  INTERESTING("TCP-wrappers");
11071  }
11072  if (INFILE(_SPDX_Unlicense)) {
11073  INTERESTING("Unlicense");
11074  }
11075  if (INFILE(_SPDX_TMate)) {
11076  INTERESTING("TMate");
11077  }
11078  if (INFILE(_SPDX_TORQUE_11)) {
11079  INTERESTING("TORQUE-1.1");
11080  }
11081  if (INFILE(_SPDX_TOSL)) {
11082  INTERESTING("TOSL");
11083  }
11084  if (INFILE(_SPDX_TU_Berlin_10)) {
11085  INTERESTING("TU-Berlin-1.0");
11086  }
11087  else if (INFILE(_SPDX_TU_Berlin_20)) {
11088  INTERESTING("TU-Berlin-2.0");
11089  }
11090  if (INFILE(_SPDX_Unicode_DFS_2015)) {
11091  INTERESTING("Unicode-DFS-2015");
11092  }
11093  if (INFILE(_SPDX_Unicode_DFS_2016)) {
11094  INTERESTING("Unicode-DFS-2016");
11095  }
11096  if (INFILE(_SPDX_Unicode_TOU)) {
11097  INTERESTING("Unicode-TOU");
11098  }
11099  if (INFILE(_SPDX_UPL_10)) {
11100  INTERESTING("UPL-1.0");
11101  }
11102  if (INFILE(_SPDX_NCSA)) {
11103  INTERESTING("NCSA");
11104  }
11105  if (INFILE(_SPDX_Vim)) {
11106  INTERESTING("Vim");
11107  }
11108  if (INFILE(_SPDX_VOSTROM)) {
11109  INTERESTING("VOSTROM");
11110  }
11111  if (INFILE(_SPDX_VSL_10)) {
11112  INTERESTING("VSL-1.0");
11113  }
11114  if (INFILE(_SPDX_W3C_20150513)) {
11115  INTERESTING("W3C-20150513");
11116  }
11117  else if (INFILE(_SPDX_W3C_19980720)) {
11118  INTERESTING("W3C-19980720");
11119  }
11120  else if (INFILE(_SPDX_W3C)) {
11121  INTERESTING("W3C");
11122  }
11123  if (INFILE(_SPDX_Wsuipa)) {
11124  INTERESTING("Wsuipa");
11125  }
11126  if (!lmem[_fREAL] && INFILE(_SPDX_Xnet)) {
11127  INTERESTING("Xnet");
11128  }
11129  if (INFILE(_SPDX_X11)) {
11130  INTERESTING("X11");
11131  }
11132  if (INFILE(_SPDX_Xerox)) {
11133  INTERESTING("Xerox");
11134  }
11135  if (INFILE(_SPDX_XFree86_11)) {
11136  INTERESTING("XFree86-1.1");
11137  }
11138  if (INFILE(_SPDX_xinetd)) {
11139  INTERESTING("xinetd");
11140  }
11141  if (INFILE(_SPDX_xpp)) {
11142  INTERESTING("xpp");
11143  }
11144  if (INFILE(_SPDX_XSkat)) {
11145  INTERESTING("XSkat");
11146  }
11147  if (INFILE(_SPDX_YPL_10)) {
11148  INTERESTING("YPL-1.0");
11149  }
11150  if (INFILE(_SPDX_YPL_11)) {
11151  INTERESTING("YPL-1.1");
11152  }
11153  if (INFILE(_SPDX_Zed)) {
11154  INTERESTING("Zed");
11155  }
11156  if (INFILE(_SPDX_Zend_20)) {
11157  INTERESTING("Zend-2.0");
11158  }
11159  if (INFILE(_SPDX_Zimbra_13)) {
11160  INTERESTING("Zimbra-1.3");
11161  }
11162  if (INFILE(_SPDX_Zimbra_14)) {
11163  INTERESTING("Zimbra-1.4");
11164  }
11165  return;
11166 }
11167 
11172 void copyleftExceptions(char *filetext, int size, int isML, int isPS)
11173 {
11174  if (INFILE(_SPDX_389_exception)) {
11175  INTERESTING("389-exception");
11176  }
11177  if (INFILE(_SPDX_Autoconf_exception_20)) {
11178  INTERESTING("Autoconf-exception-2.0");
11179  }
11180  if (INFILE(_SPDX_Autoconf_exception_30)) {
11181  INTERESTING("Autoconf-exception-3.0");
11182  }
11183  if (INFILE(_SPDX_Bison_exception_22)) {
11184  INTERESTING("Bison-exception-2.2");
11185  }
11186  if (INFILE(_SPDX_Bootloader_exception)) {
11187  INTERESTING("Bootloader-exception");
11188  }
11189  if (INFILE(_SPDX_Classpath_exception_20)) {
11190  INTERESTING("Classpath-exception-2.0");
11191  }
11192  if (INFILE(_SPDX_CLISP_exception_20)) {
11193  INTERESTING("CLISP-exception-2.0");
11194  }
11195  if (INFILE(_SPDX_DigiRule_FOSS_exception)) {
11196  INTERESTING("DigiRule-FOSS-exception");
11197  }
11198  if (INFILE(_SPDX_eCos_exception_20)) {
11199  INTERESTING("eCos-exception-2.0");
11200  }
11201  if (INFILE(_SPDX_Fawkes_Runtime_exception)) {
11202  INTERESTING("Fawkes-Runtime-exception");
11203  }
11204  if (INFILE(_SPDX_FLTK_exception)) {
11205  INTERESTING("FLTK-exception");
11206  }
11207  if (INFILE(_SPDX_Font_exception_20)) {
11208  INTERESTING("Font-exception-2.0");
11209  }
11210  if (INFILE(_SPDX_freertos_exception_20)) {
11211  INTERESTING("freertos-exception-2.0");
11212  }
11213  if (INFILE(_SPDX_GCC_exception_20)) {
11214  INTERESTING("GCC-exception-2.0");
11215  }
11216  if (INFILE(_SPDX_GCC_exception_31)) {
11217  INTERESTING("GCC-exception-3.1");
11218  }
11219  if (INFILE(_SPDX_gnu_javamail_exception)) {
11220  INTERESTING("gnu-javamail-exception");
11221  }
11222  if (INFILE(_SPDX_i2p_gpl_java_exception)) {
11223  INTERESTING("i2p-gpl-java-exception");
11224  }
11225  if (INFILE(_SPDX_Libtool_exception)) {
11226  INTERESTING("Libtool-exception");
11227  }
11228  if (INFILE(_SPDX_Linux_syscall_note)) {
11229  INTERESTING("Linux-syscall-note");
11230  }
11231  if (INFILE(_SPDX_LLVM_exception)) {
11232  INTERESTING("LLVM-exception");
11233  }
11234  if (INFILE(_SPDX_LZMA_exception)) {
11235  INTERESTING("LZMA-exception");
11236  }
11237  if (INFILE(_SPDX_mif_exception)) {
11238  INTERESTING("mif-exception");
11239  }
11240  if (INFILE(_SPDX_Nokia_Qt_exception_11)) {
11241  INTERESTING("Nokia-Qt-exception-1.1");
11242  }
11243  if (INFILE(_SPDX_OCCT_exception_10)) {
11244  INTERESTING("OCCT-exception-1.0");
11245  }
11246  if (INFILE(_SPDX_OpenJDK_assembly_exception_10)) {
11247  INTERESTING("OpenJDK-assembly-exception-1.0");
11248  }
11249  if (INFILE(_SPDX_openvpn_openssl_exception)) {
11250  INTERESTING("openvpn-openssl-exception");
11251  }
11252  if (INFILE(_SPDX_Qwt_exception_10)) {
11253  INTERESTING("Qwt-exception-1.0");
11254  }
11255  if (INFILE(_SPDX_u_boot_exception_20)) {
11256  INTERESTING("u-boot-exception-2.0");
11257  }
11258  if (INFILE(_SPDX_WxWindows_exception_31)) {
11259  INTERESTING("WxWindows-exception-3.1");
11260  }
11261  /*
11262  * Find exception phrases. There are similar phrases
11263  * in exception clauses. Therefore 'else if' structure
11264  * has to be used to get correct detections.
11265  */
11266  if (INFILE(_LT_389_exception)) {
11267  INTERESTING("389-exception");
11268  }
11269  else if (INFILE(_LT_Autoconf_exception_20)) {
11270  INTERESTING("Autoconf-exception-2.0");
11271  }
11272  else if (INFILE(_LT_GPL_EXCEPT_5) && INFILE(_LT_Autoconf_exception_30)) {
11273  INTERESTING("Autoconf-exception-3.0");
11274  }
11275  else if (INFILE(_LT_Autoconf_exception_3)) {
11276  INTERESTING("Autoconf-exception");
11277  }
11278  else if (INFILE(_LT_Bison_exception_22)) {
11279  INTERESTING("Bison-exception-2.2");
11280  }
11281  else if (INFILE(_LT_Bison_exception_1) || INFILE(_LT_Bison_exception_2)) {
11282  INTERESTING("Bison-exception");
11283  }
11284  else if (INFILE(_LT_Bootloader_exception)) {
11285  INTERESTING("Bootloader-exception");
11286  }
11287  /* Contains similar text to classpath-exception */
11288  else if (INFILE(_LT_OpenJDK_assembly_exception_10_1) || HASTEXT(_LT_OpenJDK_assembly_exception_10_2, 0)) {
11289  INTERESTING("OpenJDK-assembly-exception-1.0");
11290  }
11291  else if (INFILE(_LT_GPL_EXCEPT_6)) {
11292  if (INFILE(_LT_mif_exception)) {
11293  INTERESTING("Fawkes-Runtime-exception");
11294  }
11295  else {
11296  INTERESTING("Classpath-exception-2.0");
11297  }
11298  }
11299  else if (INFILE(_LT_classpath_exception_1)) {
11300  INTERESTING("Classpath-exception-2.0");
11301  }
11302  else if (HASTEXT(_LT_CLISP_exception_20_1, 0) && INFILE(_LT_CLISP_exception_20_2)) {
11303  INTERESTING("CLISP-exception-2.0");
11304  }
11305  else if (HASTEXT(_TITLE_DigiRule_FOSS_exception, 0) || INFILE(_LT_DigiRule_FOSS_exception)) {
11306  INTERESTING("DigiRule-FOSS-exception");
11307  }
11308  else if (INFILE(_LT_eCos_exception) && INFILE(_LT_GPL_EXCEPT_7)) {
11309  INTERESTING("eCos-exception-2.0");
11310  }
11311  else if (HASTEXT(_LT_FLTK_exception, 0)) {
11312  INTERESTING("FLTK-exception");
11313  }
11314  else if (HASTEXT(_TEXT_FONT, REG_EXTENDED) || INFILE(_LT_FONT_EXCEPTION_20)) {
11315  INTERESTING("Font-exception-2.0");
11316  }
11317  else if (HASTEXT(_LT_freertos_exception_20, 0)) {
11318  INTERESTING("freertos-exception-2.0");
11319  }
11320  else if (INFILE(_LT_freertos_exception_1) || INFILE(_LT_freertos_exception_2)) {
11321  INTERESTING("freertos-exception");
11322  }
11323  else if (INFILE(_LT_GCC_exception_31_1) || INFILE(_LT_GCC_exception_31_2)) {
11324  INTERESTING("GCC-exception-3.1");
11325  }
11326  else if (INFILE(_LT_GCC_exception_20)) {
11327  INTERESTING("GCC-exception-2.0");
11328  }
11329  /* This wording is very similar to GCC_exception_20 */
11330  else if (INFILE(_LT_linking_exception_1)) {
11331  INTERESTING("linking-exception");
11332  }
11333  else if (HASTEXT(_TEXT_GCC, REG_EXTENDED)) {
11334  INTERESTING("GCC-exception");
11335  }
11336  else if (INFILE(_LT_gnu_javamail_exception_1) || INFILE(_LT_gnu_javamail_exception_2)) {
11337  INTERESTING("gnu-javamail-exception");
11338  }
11339  else if (INFILE(_LT_i2p_gpl_java_exception)) {
11340  INTERESTING("i2p-gpl-java-exception");
11341  }
11342  else if (INFILE(_LT_GPL_EXCEPT_1) || INFILE(_LT_GPL_EXCEPT_2)) {
11343  if (HASTEXT(_LT_Libtool_exception, 0)) {
11344  INTERESTING("Libtool-exception");
11345  }
11346  if (HASTEXT(_LT_Autoconf_exception_2, REG_EXTENDED) || INFILE(_LT_Autoconf_exception_1)) {
11347  INTERESTING("Autoconf-exception");
11348  }
11349  }
11350  else if (INFILE(_LT_Linux_syscall_note)) {
11351  INTERESTING("Linux-syscall-note");
11352  }
11353  else if (HASTEXT(_LT_LLVM_exception_1, 0) || HASTEXT(_LT_LLVM_exception_2, 0)) {
11354  INTERESTING("LLVM-exception");
11355  }
11356  else if (INFILE(_LT_LZMA_exception)) {
11357  INTERESTING("LZMA-exception");
11358  }
11359  else if (INFILE(_LT_mif_exception)) {
11360  INTERESTING("mif-exception");
11361  }
11362  else if (HASTEXT(_LT_OCCT_exception_10_1, REG_EXTENDED) || INFILE(_LT_OCCT_exception_10_2)) {
11363  INTERESTING("OCCT-exception-1.0");
11364  }
11365  else if (INFILE(_LT_openvpn_openssl_exception)) {
11366  INTERESTING("openvpn-openssl-exception");
11367  }
11368  else if (HASTEXT(_TITLE_QT_GPL_EXCEPTION_10, 0)) {
11369  INTERESTING("Qt-GPL-exception-1.0");
11370  }
11371  else if (HASTEXT(_LT_QT_GPL_EXCEPTION_10_1, 0) && INFILE(_LT_QT_GPL_EXCEPTION_10_2)) {
11372  INTERESTING("Qt-GPL-exception-1.0");
11373  }
11374  else if (HASTEXT(_LT_QT_GPL_EXCEPTION, 0) && HASTEXT(_LT_QT_GPL_EXCEPTION_10_3, 0)) {
11375  INTERESTING("Qt-GPL-exception-1.0");
11376  }
11377  else if (INFILE(_TITLE_Nokia_Qt_LGPL_exception_11)) {
11378  INTERESTING("Nokia-Qt-exception-1.1");
11379  }
11380  else if (INFILE(_TITLE_QT_LGPL_EXCEPTION_11)) {
11381  INTERESTING("Qt-LGPL-exception-1.1");
11382  }
11383  else if (INFILE(_LT_Qwt_exception_10_1)) {
11384  INTERESTING("Qwt-exception-1.0");
11385  }
11386  else if (HASTEXT(_LT_Qwt_exception_10_2, 0)) {
11387  INTERESTING("Qwt-exception-1.0");
11388  }
11389  else if (INFILE(_LT_WxWindows_exception_31)) {
11390  INTERESTING("WxWindows-exception-3.1");
11391  }
11392  /*
11393  * Full license text includes reference to LGPL-2.0
11394  * exception clause.
11395  */
11396  else if (INFILE(_PHR_WXWINDOWS_31)) {
11397  INTERESTING("WxWindows-exception-3.1");
11398  INTERESTING("LGPL-2.0+");
11399  }
11400  /*
11401  * This is a vague reference to WxWindows license without
11402  * an exception reference.
11403  */
11404  else if (INFILE(_PHR_WXWINDOWS)) {
11405  INTERESTING("WxWindows");
11406  }
11407  else if (HASTEXT(_LT_u_boot_exception_20, REG_EXTENDED)) {
11408  INTERESTING("u-boot-exception-2.0");
11409  }
11410  else if (HASTEXT(_LT_GPL_EXCEPT_Trolltech, REG_EXTENDED)) {
11411  INTERESTING("trolltech-exception");
11412  }
11413  else if (INFILE(_LT_OpenSSL_exception_1) || INFILE(_LT_OpenSSL_exception_2)) {
11414  INTERESTING("OpenSSL-exception");
11415  }
11416  else if (INFILE(_LT_GPL_UPX_EXCEPT) && !HASTEXT(_LT_IGNORE_CLAUSE, REG_EXTENDED)) {
11417  INTERESTING("UPX-exception");
11418  }
11419  else if (INFILE(_URL_mysql_floss_exception) || HASTEXT(_TITLE_mysql_floss_exception, 0)) {
11420  INTERESTING(lDebug ? "mysql-floss-exception(URL)" : "mysql-floss-exception");
11421  }
11422  else if (INFILE(_TITLE_Oracle_foss_exception) || INFILE(_LT_Oracle_foss_exception)) {
11423  INTERESTING("Oracle-foss-exception");
11424  }
11425  else if (INFILE(_LT_linking_exception_2) || (INFILE(_LT_linking_exception_3) && INFILE(_LT_GPL_EXCEPT_7))) {
11426  INTERESTING("linking-exception");
11427  }
11428  else if (HASTEXT(_TITLE_universal_foss_exception_10, 0)
11429  || URL_INFILE(_URL_universal_foss_exception_10)
11430  || INFILE(_LT_universal_foss_exception_10)) {
11431  INTERESTING("universal-foss-exception-1.0");
11432  }
11433  else if (INFILE(_LT_GPL_EXCEPT_1)) {
11434  INTERESTING(lDebug ? "GPL-except-1" : "GPL-exception");
11435  }
11436  else if (INFILE(_LT_GPL_EXCEPT_2)) {
11437  INTERESTING(lDebug ? "GPL-except-2" : "GPL-exception");
11438  }
11439  else if (INFILE(_LT_GPL_EXCEPT_3)) {
11440  INTERESTING(lDebug ? "GPL-except-3" : "GPL-exception");
11441  }
11442  else if (INFILE(_LT_GPL_EXCEPT_4)) {
11443  INTERESTING(lDebug ? "GPL-except-4" : "GPL-exception");
11444  }
11445  else if (INFILE(_LT_GPL_EXCEPT_7)) {
11446  INTERESTING("linking-exception");
11447  }
11448  else if (INFILE(_LT_GPL_SWI_PROLOG_EXCEPT)) {
11449  INTERESTING(lDebug ? "GPL-swi-prolog" : "GPL-exception");
11450  }
11451 
11452  return;
11453 }
11454 
11455 #ifdef LTSR_DEBUG
11456 #define LT_TARGET 1299 /* set to -1 OR the string# to track */
11457 void showLTCache(char *msg)
11458 {
11459  int i = 0;
11460  int nCached = 0;
11461  int nMatch = 0;
11462 
11463  printf("%s\n", msg);
11464  if (LT_TARGET >= 0) {
11465  printf("... tracking string #%d\n", LT_TARGET);
11466  }
11467  while (i < NFOOTPRINTS) {
11468  if (ltsr[i] < LTSR_SMASK) {
11469  printf(i == LT_TARGET ? "x" : ".");
11470  } else if (ltsr[i] == LTSR_YES) {
11471  printf("%%");
11472  nMatch++;
11473  nCached++;
11474  } else {
11475  printf(i == LT_TARGET ? "0" : ":");
11476  nCached++;
11477  }
11478  if ((++i % 75) == 0) {
11479  printf("|%04d\n", i);
11480  }
11481  }
11482  printf("\nLTSR-matches: %d, Cached: %d\n", nMatch, nCached);
11483  return;
11484 }
11485 #endif /* LTSR_DEBUG */
11486 
11487 #ifdef DOCTOR_DEBUG
11488 /*
11489  Debugging
11490  */
11491 void dumpMatch(char *text, char *label)
11492 {
11493  char *x = text + cur.regm.rm_so;
11494  char *cp = text + cur.regm.rm_eo;
11495 
11496  if (label) {
11497  printf("%s ", label);
11498  }
11499  printf("@ %d [", cur.regm.rm_so);
11500  for (; x < cp; x++) {
11501  if (!isEOL(*x)) {
11502  printf("%c", *x);
11503  }
11504  }
11505  printf("]\n");
11506  return;
11507 }
11508 
11509 #endif /* DOCTOR_DEBUG */
void saveRegexLocation(int, int, int, int)
Save a regex in whereList.
Definition: parse.c:9293
char * oslVersion(char *, int, int, int)
Check for OSL versions.
Definition: parse.c:7718
char * str
Definition: nomos.h:291
#define YES
Definition: nomos.h:188
static int lDebug
Definition: parse.c:191
void doctorBuffer(char *buf, int isML, int isPS, int isCR)
Convert a buffer of multiple stuff to text-only, separated by spaces.
static int pd
Definition: parse.c:187
int optionIsSet(int val)
Check if an CLI option is set.
Definition: nomos_utils.c:568
static struct @1 kludge
#define NOT_INFILE(x)
Calls fileHasPatt()
Definition: parse.c:204
tricky data structure used for a list of &#39;items&#39;
Definition: nomos.h:287
#define URL_INFILE(x)
Check in file with qType 0|1.
Definition: parse.c:214
int famOPENLDAP(char *, int, int, int)
Utility function to search for OpenLDAP licenses. So many different footprints are used by OpenLDAP...
Definition: parse.c:9431
searchString_t text
License text.
Definition: nomos.h:348
int idxGrep_recordPosition(int index, char *data, int flags)
compile a regex, perform the search and record findings
Definition: nomos_regex.c:231
char * lgplVersion(char *, int, int, int)
Check for LGPL versions.
Definition: parse.c:8048
char * tseed
unencrypted license text
Definition: nomos.h:449
#define RM_INFILE(x)
Calls fileHasPatt() with qType 1.
Definition: parse.c:205
#define LTSR_SMASK
Definition: nomos.h:210
static int lDiags
Definition: parse.c:192
#define LTSR_RMASK
Definition: nomos.h:209
int used
Definition: nomos.h:323
int score
License match score.
Definition: nomos.h:470
static char licStr[myBUFSIZ]
Definition: parse.c:176
void Bail(int exitval)
Close connections and exit.
Definition: nomos_utils.c:541
#define INFILE(x)
Calls fileHasPatt()
Definition: parse.c:203
char * getInstances(char *textp, int size, int nBefore, int nAfter, char *regex, int recordOffsets)
Get occurrence of a regex in a given string pointer.
Definition: util.c:642
if(!preg_match("/\s$projectGroup\s/", $groups)&&(posix_getgid()!=$gInfo['gid']))
get monk license list of one specified uploadtree_id
Definition: migratetest.php:44
#define memFree(x, y)
Definition: nomos.h:544
static int dbgIdxGrep(int, char *, int)
Debugging call for idxGrep()
Definition: parse.c:328
int idxGrep_recordPositionDoctored(int index, char *data, int flags)
compile a regex, perform the search and record findings
Definition: nomos_regex.c:252
void copyleftExceptions(char *, int, int, int)
Definition: parse.c:11172
#define HASREGEX_RI(x, cp)
Calls idxGrep_recordIndex()
Definition: parse.c:212
void listInit(list_t *l, int size, char *label)
intialize a list, if the list is not empty, empty it (initialize it to zero&#39;s).
Definition: list.c:67
int csLen
String length.
Definition: nomos.h:338
GArray * theMatches
Definition: nomos.h:430
void checkFileReferences(char *, int, int, int, int, int)
Generic license-phrases referring to other files or running commands.
Definition: parse.c:9680
item_t * listGetItem(list_t *l, char *s)
get an item from the itemlist. If the item is not in the itemlist, then add it to the itemlist...
Definition: list.c:259
int strNbuf(char *data, char *str)
Check if a string exists in buffer (case insensitive)
Definition: nomos_regex.c:539
static char * gplVersion(char *, int, int, int)
Check for GPL versions.
Definition: parse.c:8157
int flags
Flags.
Definition: nomos.h:361
#define NULL_CHAR
NULL character.
Definition: nomos.h:247
int findPhrase(int, char *, int, int, int, int)
Check for the presence of a phrase in a file by first searching for the search key provided...
Definition: parse.c:8522
int uPsize
Size.
Definition: nomos.h:362
void Assert(int fatalFlag, const char *fmt,...)
Raise an assert.
Definition: util.c:1407
start($application)
start the application Assumes application is restartable via /etc/init.d/<script>. The application passed in should match the script name in /etc/init.d
Definition: pkgConfig.php:1225
char * lpplVersion(char *, int, int, int)
Check for LPPL versions.
Definition: parse.c:7798
#define _REGEX(x)
Definition: nomos.h:460
char * cplVersion(char *, int, int, int)
Check for CPL versions.
Definition: parse.c:8323
static char ltsr[NFOOTPRINTS]
Definition: parse.c:178
char * ccVersion(char *, int, int, int)
Check for CC_BY-X versions.
Definition: parse.c:8354
void printRegexMatch(int n, int cached)
CDB – Need to review this code, particularly for the use of an external file (Nomos.strings.txt). Despite the fact that variable is named debugStr, the file appears to be used for more than just debugging.
Definition: util.c:998
FUNCTION void addLicence(GArray *theMatches, char *licenceName)
Add a license to the matches array.
Definition: nomos_utils.c:999
int idxGrep(int index, char *data, int flags)
compile a regex, and perform the search (on data?)
Definition: nomos_regex.c:216
char * parseLicenses(char *filetext, int size, scanres_t *scp, int isML, int isPS)
Parse a file to check all the possible licenses and add them to matches.
Definition: parse.c:371
static char * realVersion(char *, int, int, int, int)
Check for RPSL versions.
Definition: parse.c:7573
void spdxReference(char *, int, int, int)
Definition: parse.c:10296
#define isEOL(x)
Check if x points to a EOL character.
Definition: nomos.h:253
char * cddlVersion(char *, int, int, int)
Check for CDDL versions.
Definition: parse.c:7758
char * copyString(char *s, char *label)
Create a copy of a string.
Definition: util.c:605
#define HASTEXT(x, fl)
Calls idxGrep_recordIndex()
Definition: parse.c:213
void addRef(char *, int)
This function fills in a character-buffer for a license of a CURRENT file being evaluated, and enqueues a list if components to help make a package-level summary.
Definition: parse.c:9345
char * gfdlVersion(char *, int, int, int)
Check for GFDL versions.
Definition: parse.c:7982
void listIterationReset(list_t *l)
Rest list ix to -1.
Definition: list.c:526
void checkCornerCases(char *, int, int, int, int, int, int, int)
If we call this function, we still don&#39;t know anything about a license.
Definition: parse.c:10009
#define SEEN(x)
Check LTSR_SMASK on lstr[x].
Definition: parse.c:202
#define HASREGEX(x, cp)
Calls idxGrep()
Definition: parse.c:211
char * agplVersion(char *, int, int, int)
Check for AGPL versions.
Definition: parse.c:7904
licText_t licText[]
#define GPL_INFILE(x)
Calls fileHasPatt() with qType 2.
Definition: parse.c:206
#define PERL_INFILE(x)
Calls fileHasPatt() with qType 3.
Definition: parse.c:207
char * aslVersion(char *, int, int, int)
Check for ASL Apache versions.
Definition: parse.c:7272
#define LVAL(x)
Check LTSR_RMASK on lstr[x].
Definition: parse.c:201
void listSort(list_t *l, int sortType)
Sort the list as per the sortType passed.
Definition: list.c:644
#define NULL_STR
NULL string.
Definition: nomos.h:248
void locateRegex(char *, item_t *, int, int, int, int)
Locate a regex in a given file.
Definition: parse.c:9012
static int fileHasPatt(int licTextIdx, char *filetext, int size, int isML, int isPS, int qType)
Checks for a phrase in a file.
Definition: parse.c:260
#define PARSE_ARGS
Arguments to parse.
Definition: parse.c:200
#define NY_INFILE(x)
Calls fileHasPatt() with qType 4.
Definition: parse.c:208
#define _SEED(x)
Definition: nomos.h:464
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Definition: nomos.h:321
static char * sisslVersion(char *, int, int, int)
Check for SISSL versions.
Definition: parse.c:7245
int strGrep(char *regex, char *data, int flags)
General-purpose grep function, used for one-time-only searches.
Definition: nomos_regex.c:150
char * pythonVersion(char *, int, int, int)
Check for python versions.
Definition: parse.c:7623
char * findEol(char *s)
Find first ROL in a string.
Definition: util.c:390
#define FL_SAVEBASE
Definition: nomos.h:168
char * aflVersion(char *, int, int, int)
Check for AFL versions.
Definition: parse.c:7678
Nomos header file.
void cleanLicenceBuffer()
Clean the license buffer.
Definition: nomos_utils.c:1014
void listDump(list_t *l, int verbose)
print the passed in list
Definition: list.c:842
item_t * items
Definition: nomos.h:330
#define LTSR_NO
Definition: nomos.h:212
void listClear(list_t *l, int deallocFlag)
Destroy list_t.
Definition: list.c:119
#define NULL_ITEM
NULL item.
Definition: nomos.h:244
#define OPTS_DEBUG
Definition: nomos.h:151
int checkUnclassified(char *, int, int, int, int, int)
This function is called when all the above license-checks don&#39;t turn up anything useful. Now we need to determine if the current file likely contains a license or not.
Definition: parse.c:9533
#define LTSR_YES
Definition: nomos.h:211
#define NO
Definition: nomos.h:184
void * buf
Definition: nomos.h:292
char * regex
License regex.
Definition: nomos.h:448
item_t * listIterate(list_t *l)
return a pointer to listitem, returns a NULL_ITEM when no more items to return.
Definition: list.c:490
char * mplNplVersion(char *, int, int, int)
Check for MPL|NPL versions.
Definition: parse.c:7456
char progName[64]
Program name.
Definition: nomos.h:359