Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
4802b4be
Commit
4802b4be
authored
Feb 25, 2015
by
Peter Barker
Committed by
Rusty Russell
Mar 30, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ccanlint - avoid e.g. GPL vs LGPL mismatch in license checking
Signed-off-by:
Rusty Russell
<
rusty@rustcorp.com.au
>
parent
c2fbfe52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
tools/ccanlint/tests/license_comment.c
tools/ccanlint/tests/license_comment.c
+36
-2
No files found.
tools/ccanlint/tests/license_comment.c
View file @
4802b4be
...
...
@@ -11,6 +11,40 @@
#include <err.h>
#include <ccan/str/str.h>
static
char
*
xstrdup
(
const
char
*
s
)
{
char
*
ret
=
strdup
(
s
);
if
(
ret
==
NULL
)
{
perror
(
"strdup"
);
abort
();
}
return
ret
;
}
/**
* line_has_license_flavour - returns true if line contains a <flavour> license
* @line: line to look for license in
* @shortname: license to find
* @note ("LGPLv2.0","LGPL") returns true
* @note ("LGPLv2.0","GPL") returns false
*/
static
bool
line_has_license_flavour
(
const
char
*
line
,
const
char
*
flavour
)
{
char
*
strtok_line
,
*
strtok_tmp
,
*
token
;
bool
ret
=
false
;
const
size_t
flavour_len
=
strlen
(
flavour
);
strtok_line
=
strtok_tmp
=
xstrdup
(
line
);
while
((
token
=
strtok
(
strtok_tmp
,
"
\t
-:"
))
!=
NULL
)
{
if
(
!
strncmp
(
token
,
flavour
,
flavour_len
))
{
ret
=
true
;
break
;
}
strtok_tmp
=
NULL
;
}
free
(
strtok_line
);
return
ret
;
}
static
void
check_license_comment
(
struct
manifest
*
m
,
unsigned
int
*
timeleft
,
struct
score
*
score
)
{
...
...
@@ -38,8 +72,8 @@ static void check_license_comment(struct manifest *m,
break
;
if
(
strstr
(
lines
[
i
],
"LICENSE"
))
found_license
=
true
;
if
(
strst
r
(
lines
[
i
],
licenses
[
m
->
license
].
shortname
))
if
(
line_has_license_flavou
r
(
lines
[
i
],
licenses
[
m
->
license
].
shortname
))
found_flavor
=
true
;
}
if
((
!
found_license
||
!
found_flavor
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment