update-years.sh 682 B

12345678910111213141516171819202122232425
  1. #! /bin/sh
  2. YEAR=`date +%Y`
  3. SOURCES="`find lib src tests -name '*.c'`"
  4. SOURCES="$SOURCES src/man2hlp/man2hlp.in"
  5. SOURCES="$SOURCES tests/src/vfs/extfs/helpers-list/test_all"
  6. LINE="Copyright (C)"
  7. for i in $SOURCES; do
  8. # replace year: XXXX-YYYY -> XXXX-ZZZZ
  9. # add year: XXXX -> XXXX-ZZZZ
  10. ${SED-sed} -e "
  11. 1,20 {
  12. /$LINE/s/-[0-9]\{4\}$/-$YEAR/
  13. };
  14. 1,20 {
  15. /$LINE/s/ [0-9]\{4\}$/&-$YEAR/
  16. }" $i > $i.tmp && mv -f $i.tmp $i
  17. done
  18. # special case
  19. ${SED-sed} -e "/$LINE/s/-[0-9]\{4\} the/-$YEAR the/" src/editor/editwidget.c > src/editor/editwidget.c.tmp && \
  20. mv -f src/editor/editwidget.c.tmp src/editor/editwidget.c