From 67542c64b2bdbcdb47d5c6eadcd6bd8f71178a2f Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 2 Jan 2022 11:01:09 +0300 Subject: [PATCH] Add script to update copyright years. Signed-off-by: Andrew Borodin --- maint/utils/update-years.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 maint/utils/update-years.sh diff --git a/maint/utils/update-years.sh b/maint/utils/update-years.sh new file mode 100755 index 000000000..1188fb1c8 --- /dev/null +++ b/maint/utils/update-years.sh @@ -0,0 +1,22 @@ +#! /bin/sh + +YEAR=`date +%Y` + +SOURCES="`find lib src tests -name '*.c'`" + +LINE="Copyright (C)" + +for i in "$SOURCES"; do + # replace year: XXXX-YYYY -> XXXX-ZZZZ + # add year: XXXX -> XXXX-ZZZZ + sed -i -e " + 1,20 { + /$LINE/s/-[0-9]\{4\}$/-$YEAR/ + }; + 1,20 { + /$LINE/s/ [0-9]\{4\}$/&-$YEAR/ + }" $i +done + +# special case +sed -i -e "/$LINE/s/-[0-9]\{4\} the/-$YEAR the/" src/editor/editwidget.c