3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy is of the CDDL is also available via the Internet
10 # at http://www.illumos.org/license/CDDL.
14 # Copyright 2010 Nexenta Systems, Inc. All rights reserved.
15 # Copyright 2014 Garett D'Amore <garrett@damore.org>
16 # Copyright 2016 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
20 # This extracts all the BSD copyrights (excluding the CDDL licenses)
21 # for use in a THIRDPARTYLICENSE file. It tries hard to avoid duplicates.
43 cat $file |
while IFS
="" read line
; do
44 if [[ "$line" == /* ]] ; then
51 if [[ -z $comment ]]; then
57 # We don't want to know about CDDL files. They don't
58 # require an explicit THIRDPARTYLICENSE file.
60 if [[ "$line" == *CDDL
* ]]
65 if [[ "$line" == *Copyright
* ]]
70 if [[ "$line" != */ ]]
75 # append to block array
76 block
="${block}${line}"'\n'
81 # We have reached the end of the comment now.
85 # Check to see if we saw a copyright.
86 if [[ -z "$copyr" ]]; then
90 license
="${license}${block}"
94 if [[ -n "$license" ]]
96 LICENSE
["${license}"]="${LICENSE["${license}"]} $file"
100 find "$@" -type f
-name '*.[chs]' -print |
sort |
while read f
105 for lic
in "${!LICENSE[@]}"; do
106 print
"The following files from the C library:"
107 for f
in ${LICENSE[$lic]}; do
110 print
"are provided under the following terms:"