Skip to content

Commit

Permalink
Add script to update copyright years.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Borodin <[email protected]>
  • Loading branch information
aborodin committed Mar 13, 2022
1 parent 9489b5e commit 67542c6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions maint/utils/update-years.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 67542c6

Please sign in to comment.