1#!/bin/sh
2
3# A script to replace the full text of the MIT license with a reference to the
4# license URL. Saved for posterity.
5#
6# TODO: also add support for C++ style versions
7
8REPLACELINE=" \* Permission is hereby granted, free of charge, to any person obtaining\n"\
9" \* a copy of this software and associated documentation files\n"\
10" \* \(the \"Software\"\), to deal in the Software without restriction,\n"\
11" \* including without limitation the rights to use, copy, modify, merge,\n"\
12" \* publish, distribute, sublicense, and\/or sell copies of the Software,\n"\
13" \* and to permit persons to whom the Software is furnished to do so,\n"\
14" \* subject to the following conditions:\n"\
15" \*\n"\
16" \* The above copyright notice and this permission notice shall be\n"\
17" \* included in all copies or substantial portions of the Software.\n"\
18" \*\n"\
19" \* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n"\
20" \* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n"\
21" \* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n"\
22" \* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n"\
23" \* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n"\
24" \* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n"\
25" \* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
26
27REPLACEWITH=" \* Use of this source code is governed by a MIT-style\n"\
28" \* license that can be found in the LICENSE file or at\n"\
29" \* https:\/\/opensource.org\/licenses\/MIT\n"
30
31FILES=$(find . -name *.[chS] -or -name \*.cpp | grep -v external | grep -v build-)
32echo $FILES
33
34for f in $FILES; do
35    echo $f
36    perl -0777 -pi -e "s/${REPLACELINE}/${REPLACEWITH}/g" $f
37done
38
39