Index: /palm/trunk/SCRIPTS/document_changes
===================================================================
--- /palm/trunk/SCRIPTS/document_changes	(revision 1812)
+++ /palm/trunk/SCRIPTS/document_changes	(revision 1813)
@@ -15,15 +15,15 @@
 # PALM. If not, see <http://www.gnu.org/licenses/>.
 #
-# Copyright 1997-2014  Leibniz Universitaet Hannover
+# Copyright 1997-2016 Leibniz Universitaet Hannover
 #------------------------------------------------------------------------------#
 #
 # Current revisions:
 # -----------------
-# 
+# Added update of the copyright statements in the file headers.
 # 
 # Former revisions:
 # -----------------
 # $Id$
-#
+# 
 # 1810 2016-04-05 20:25:29Z maronga
 # document_changes now checks all subdirectories. Modified printing to screen.
@@ -58,4 +58,5 @@
     comment_char=="!"   #: comment character
     count_changes=0     #: count the number of files with CR text
+    count_updates=0     #: count the number of files with copyright update
     count_files=0       #: count the number of files
     fn=""               #: current file name to be scanned
@@ -73,4 +74,5 @@
     list_delete=""      #: contains the line no. that must be deleted from CR
     timestamp=""        #: the svn timestamp of the file
+    current_year=$(date +"%Y")
 
 #
@@ -92,13 +94,19 @@
     printf "\n  *** Checking files in $input_dir and all recursive subdirectories...\n"
 
+    
+#
+#-- scan all (sub-)directories for files.
     IFS=$'\n';
-    for fn in $(find $input_dir -not -name '*.pdf' -and -not -name '*.x' -and -not -name '*.eps' -and -not -name '*.png' -and -not -name '*.svn*'); do
-
-#
-#--    exclude backup and invisible files
+    for fn in $(find $input_dir -not -name '*.pdf'  -and -not -name '*.x'      \
+                           -and -not -name '*.eps'  -and -not -name '*.png'    \
+                           -and -not -name '*.svn*' -and -not -name '*~'       \
+                           -and -not -name '*.tar'); do
+
+#
+#--    exclude invisible files
        file_firstchar=${fn:0:1}
        file_lastchar=`echo -n $fn| tail -c -1`
        file_extension=${fn##*.}
-       if [[ "$file_firstchar" == "." || "$file_extension" == "x" || "$file_lastchar" == "~" || "$file_extension" == "tar" ]]
+       if [[ "$file_firstchar" == "." ]]
        then
           continue
@@ -115,5 +123,5 @@
 
 #
-#--    read one line at a time
+#--    read one line at a time and move revision comments
        while read line
        do
@@ -176,6 +184,41 @@
        done <"$fn"
 
+       
+       
+#
+#--    check for updates of the copyright statement
+       found_update_year=false
+
+       while read line 
+       do 
+
+          line_tmp=""
+          line_tmp2=""     
+          line_tmp=${line:22:29}
+          line_tmp2=${line:2:15}
+          
+#           echo "$line_tmp $line_tmp2"
+          
+          if  [[ "$line_tmp" == "Leibniz Universitaet Hannover" && "$line_tmp2" == "Copyright 1997-" ]]
+          then
+          
+             year_in_file=${line:17:4}
+             if  [[ "$year_in_file" != "$current_year" ]]
+             then
+      
+                printf "\r%$(tput cols)s" " "   
+                printf "\r  \e[1;33m*** Copyright update required in $fn\e[0m\n"
+
+                comment_char=${line:0:1}
+                found_update_year=true             
+                cp $fn $fn~
+                
+             fi
+          fi
+       
+       done <"$fn"
+         
        printf "\r%$(tput cols)s" " "   
-       printf "\r\e[1m  *** Searched files: $count_files. Comments found: $count_changes\e[0m."
+       printf "\r\e[1m  *** Searched files: $count_files. Comments found: $count_changes. Copyright updates found: $count_updates\e[0m"
        
 #
@@ -200,4 +243,15 @@
        fi
 
+#
+#--    move comments from current revisions to former revisions
+       if [[ "$found_update_year" == true ]]
+       then
+
+          (( count_updates = count_updates + 1 ))  
+          
+           sed -i "s/$comment_char Copyright 1997-.*Leibniz Universitaet Hannover/$comment_char Copyright 1997-$current_year Leibniz Universitaet Hannover/" $fn
+     
+       fi
+       
     done
 
@@ -205,5 +259,5 @@
 #-- inform the user about the changes
     printf "\r%$(tput cols)s" " "
-    printf "\r\e[1m  *** Searched files: $count_files. Comments found: $count_changes\e[0m. - \e[1;32mfinished.\e[0m\n\n"
+    printf "\r\e[1m  *** Searched files: $count_files. Comments found: $count_changes. Copyright updates found: $count_updates\e[0m. - \e[1;32mfinished.\e[0m\n\n"
 
     if  [[ $count_changes -gt 0 ]]
