Commit e0984ff7 authored by Claes Sjofors's avatar Claes Sjofors

Script for license text replacement added

parent 62a5f6e4
BEGIN {
inlicense = 0;
rowcnt = 0;
}
{
if ( $2 == "This" && $3 == "file" && $4 == "is" && $5 == "part" && $6 == "of" && $7 == "Proview.") {
inlicense = 1;
printf( "%s\n", $0);
}
else if ( inlicense) {
rowcnt++;
if ( rowcnt == 21) {
printf( " * Proview give you permission to, from the build function in the\n");
}
else if ( rowcnt == 22) {
printf( " * Proview Configurator, combine Proview with modules generated by the\n");
}
else if ( rowcnt == 23) {
printf( " * Proview PLC Editor to a PLC program, regardless of the license\n");
}
else if ( rowcnt == 24) {
printf( " * terms of these modules. You may copy and distribute the resulting\n");
inlicense = 0;
}
else
printf( "%s\n", $0);
}
else
printf( "%s\n", $0);
}
BEGIN {
inlicense = 0;
rowcnt = 0;
}
{
if ( $2 == "This" && $3 == "file" && $4 == "is" && $5 == "part" && $6 == "of" && $7 == "Proview.") {
inlicense = 1;
printf( "%s\n", $0);
}
else if ( inlicense) {
rowcnt++;
if ( rowcnt == 21) {
printf( "# Proview give you permission to, from the build function in the\n");
}
else if ( rowcnt == 22) {
printf( "# Proview Configurator, combine Proview with modules generated by the\n");
}
else if ( rowcnt == 23) {
printf( "# Proview PLC Editor to a PLC program, regardless of the license\n");
}
else if ( rowcnt == 24) {
printf( "# terms of these modules. You may copy and distribute the resulting\n");
inlicense = 0;
}
else
printf( "%s\n", $0);
}
else
printf( "%s\n", $0);
}
BEGIN {
inlicense = 0;
rowcnt = 0;
}
{
if ( $2 == "This" && $3 == "file" && $4 == "is" && $5 == "part" && $6 == "of" && $7 == "Proview.") {
inlicense = 1;
printf( "%s\n", $0);
}
else if ( inlicense) {
rowcnt++;
if ( rowcnt == 21) {
printf( "! Proview give you permission to, from the build function in the\n");
}
else if ( rowcnt == 22) {
printf( "! Proview Configurator, combine Proview with modules generated by the\n");
}
else if ( rowcnt == 23) {
printf( "! Proview PLC Editor to a PLC program, regardless of the license\n");
}
else if ( rowcnt == 24) {
printf( "! terms of these modules. You may copy and distribute the resulting\n");
inlicense = 0;
}
else
printf( "%s\n", $0);
}
else
printf( "%s\n", $0);
}
#set -o xtrace
if [ "$1" == "cpp" ]; then
file="*.cpp"
ftype="c"
elif [ "$1" == "c" ]; then
file="*.c"
ftype="c"
elif [ "$1" == "h" ]; then
file="*.h"
ftype="c"
elif [ "$1" == "hpp" ]; then
file="*.hpp"
ftype="c"
elif [ "$1" == "java" ]; then
file="*.java"
ftype="c"
elif [ "$1" == "sh" ]; then
file="*.sh"
ftype="sh"
elif [ "$1" == "pwr_com" ]; then
file="*.pwr_com"
ftype="sh"
elif [ "$1" == "wb_load" ]; then
file="*.wb_load"
ftype="wbl"
elif [ "$1" == "msg" ]; then
file="*.msg"
ftype="wbl"
elif [ "$1" == "uil" ]; then
file="*.uil"
ftype="wbl"
elif [ "$1" == "xxx" ]; then
file="*.xxx"
ftype="c"
else
echo ""
echo "Replace a string in all files of a certain type"
echo "Note! Edit the awk-files first."
echo ""
echo "Usage: replace_all.sh 'filetype'"
echo ""
echo "filetype c, cpp, h, hpp, java, sh, pwr_com, wb_load, msg, uil"
echo " or xxx (for test)"
echo ""
exit
fi
find $pwre_croot -name "$file" -exec ./replace_all_exec.sh {} $ftype \;
if [ "$2" == "c" ]; then
echo "executing $1"
awk -f license.awk $1 > t.tmp
mv t.tmp $1
elif [ "$2" == "sh" ]; then
echo "executing $1"
awk -f license_sh.awk $1 > t.tmp
mv t.tmp $1
elif [ "$2" == "wbl" ]; then
echo "executing $1"
awk -f license_wbl.awk $1 > t.tmp
mv t.tmp $1
else
echo "Unknown filtype"
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment