diff options
Diffstat (limited to 'add-copyright.sh')
-rwxr-xr-x | add-copyright.sh | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/add-copyright.sh b/add-copyright.sh deleted file mode 100755 index f567412..0000000 --- a/add-copyright.sh +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | TEMPNAME="copyright_script_temp_file" | ||
4 | COPYNAME="copyright_script_copyright_notice" | ||
5 | |||
6 | URL="http://opensimulator.org/" | ||
7 | PROJNAME="OpenSim" | ||
8 | |||
9 | cat > ${COPYNAME} <<EOF | ||
10 | /* | ||
11 | * Copyright (c) Contributors, ${URL} | ||
12 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
13 | * | ||
14 | * Redistribution and use in source and binary forms, with or without | ||
15 | * modification, are permitted provided that the following conditions are met: | ||
16 | * * Redistributions of source code must retain the above copyright | ||
17 | * notice, this list of conditions and the following disclaimer. | ||
18 | * * Redistributions in binary form must reproduce the above copyright | ||
19 | * notice, this list of conditions and the following disclaimer in the | ||
20 | * documentation and/or other materials provided with the distribution. | ||
21 | * * Neither the name of the ${PROJNAME} Project nor the | ||
22 | * names of its contributors may be used to endorse or promote products | ||
23 | * derived from this software without specific prior written permission. | ||
24 | * | ||
25 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS \`\`AS IS'' AND ANY | ||
26 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
27 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
28 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
29 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
30 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
31 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
32 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
35 | */ | ||
36 | |||
37 | EOF | ||
38 | |||
39 | has_bom() { | ||
40 | CHARS=`hexdump -c $1 | head -n1 | cut -d\ -f1-4` | ||
41 | BOMMARK="0000000 357 273 277" | ||
42 | if [ "${CHARS}" == "${BOMMARK}" ]; then | ||
43 | echo 1 | ||
44 | else | ||
45 | echo 0 | ||
46 | fi | ||
47 | } | ||
48 | |||
49 | for f in `find . -iname "*.cs"`; do | ||
50 | head -n2 $f | tail -n1 > ${TEMPNAME} | ||
51 | grep -q Copyright ${TEMPNAME} | ||
52 | if [ $? == 1 ]; then | ||
53 | BOMSTATUS=`has_bom $f` | ||
54 | rm ${TEMPNAME} | ||
55 | |||
56 | if [ ${BOMSTATUS} == 1 ]; then | ||
57 | echo -ne \\0357\\0273\\0277 > ${TEMPNAME} | ||
58 | fi | ||
59 | |||
60 | cat ${COPYNAME} >> ${TEMPNAME} | ||
61 | |||
62 | if [ ${BOMSTATUS} == 1 ]; then | ||
63 | cat $f | perl -p -e "s/^\\xEF\\xBB\\xBF//" >> ${TEMPNAME} | ||
64 | else | ||
65 | cat $f >> ${TEMPNAME} | ||
66 | fi | ||
67 | |||
68 | mv ${TEMPNAME} $f | ||
69 | fi | ||
70 | done | ||
71 | |||
72 | rm -f ${COPYNAME} ${TEMPNAME} | ||