diff options
author | Jeff Ames | 2007-12-14 02:53:15 +0000 |
---|---|---|
committer | Jeff Ames | 2007-12-14 02:53:15 +0000 |
commit | c65b2a38d8d838579920aed08de619cc3e8229b5 (patch) | |
tree | 15c8769028bd016b1a030ea124fb310a06d84846 /add-copyright.sh | |
parent | patch from justincc for Mantis #163 - Opening a script in inventory longer th... (diff) | |
download | opensim-SC_OLD-c65b2a38d8d838579920aed08de619cc3e8229b5.zip opensim-SC_OLD-c65b2a38d8d838579920aed08de619cc3e8229b5.tar.gz opensim-SC_OLD-c65b2a38d8d838579920aed08de619cc3e8229b5.tar.bz2 opensim-SC_OLD-c65b2a38d8d838579920aed08de619cc3e8229b5.tar.xz |
Added copyright notice.
Added script (add-copyright.sh) to make doing this relatively painless.
Diffstat (limited to '')
-rwxr-xr-x | add-copyright.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/add-copyright.sh b/add-copyright.sh new file mode 100755 index 0000000..ce5072a --- /dev/null +++ b/add-copyright.sh | |||
@@ -0,0 +1,73 @@ | |||
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 | |||
38 | EOF | ||
39 | |||
40 | has_bom() { | ||
41 | CHARS=`hexdump -c $1 | head -n1 | cut -d\ -f1-4` | ||
42 | BOMMARK="0000000 357 273 277" | ||
43 | if [ "${CHARS}" == "${BOMMARK}" ]; then | ||
44 | echo 1 | ||
45 | else | ||
46 | echo 0 | ||
47 | fi | ||
48 | } | ||
49 | |||
50 | for f in `find . -iname "*.cs"`; do | ||
51 | head -n2 $f | tail -n1 > ${TEMPNAME} | ||
52 | grep -q Copyright ${TEMPNAME} | ||
53 | if [ $? == 1 ]; then | ||
54 | BOMSTATUS=`has_bom $f` | ||
55 | rm ${TEMPNAME} | ||
56 | |||
57 | if [ ${BOMSTATUS} == 1 ]; then | ||
58 | echo -ne \\0357\\0273\\0277 > ${TEMPNAME} | ||
59 | fi | ||
60 | |||
61 | cat ${COPYNAME} >> ${TEMPNAME} | ||
62 | |||
63 | if [ ${BOMSTATUS} == 1 ]; then | ||
64 | cat $f | perl -p -e "s/^\\xEF\\xBB\\xBF//" >> ${TEMPNAME} | ||
65 | else | ||
66 | cat $f >> ${TEMPNAME} | ||
67 | fi | ||
68 | |||
69 | mv ${TEMPNAME} $f | ||
70 | fi | ||
71 | done | ||
72 | |||
73 | rm -f ${COPYNAME} ${TEMPNAME} | ||