blob: 4edd8955a7c880d5a96176f0d4bfe378371d0a6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
##
# Copyright (c) 2024, Konstantin Aladyshev <aladyshev22@gmail.com>
#
# SPDX-License-Identifier: MIT
##
COPYRIGHT_C="\
/*
* Copyright (c) 2024, Konstantin Aladyshev <aladyshev22@gmail.com>
*
* SPDX-License-Identifier: MIT
*/
"
COPYRIGHT_UNI="\
//
// Copyright (c) 2024, Konstantin Aladyshev <aladyshev22@gmail.com>
//
// SPDX-License-Identifier: MIT
//
"
COPYRIGHT_META="\
##
# Copyright (c) 2024, Konstantin Aladyshev <aladyshev22@gmail.com>
#
# SPDX-License-Identifier: MIT
##
"
if [ ! -z "$1" ]; then
DIR="$(readlink -f "$1")"
else
DIR="$(dirname $(dirname "$(readlink -f "$0")"))"
fi
function insertCopyright {
FILENAME=${1}
COPYRIGHT=${2}
grep "Copyright" "${FILENAME}" > /dev/null
if [ $? -eq 1 ]; then
echo "${COPYRIGHT}" | cat - "${FILENAME}" > /tmp/out && mv /tmp/out "${FILENAME}";
fi
}
for i in $(find ${DIR} -type f -name "*.c");
do
insertCopyright "${i}" "${COPYRIGHT_C}"
done
for i in $(find ${DIR} -type f -name "*.uni");
do
insertCopyright "${i}" "${COPYRIGHT_UNI}"
done
for i in $(find ${DIR} -type f -name "*.dsc" -o -name "*.dec" -o -name "*.inf");
do
insertCopyright "${i}" "${COPYRIGHT_META}"
done
|