Commit ffbd5122 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Handle yearspans.

parent f011c7e3
#!/bin/bash #!/bin/bash
# $Id: update-copyright,v 1.5 1996/08/03 01:38:10 ceder Exp $ # $Id: update-copyright,v 1.6 1999/05/24 09:00:28 ceder Exp $
# Copyright (C) 1994, 1995, 1996 Lysator Academic Computer Association. # Copyright (C) 1994-1996, 1999 Lysator Academic Computer Association.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -28,17 +28,31 @@ do ...@@ -28,17 +28,31 @@ do
else echo "$file:1: no Copy"right" line found" >&2 ; continue; else echo "$file:1: no Copy"right" line found" >&2 ; continue;
fi fi
tr , '\012' < /tmp/$$.yc \ tr , '\012' < /tmp/$$.yc \
| sed -n 's/.*\([0-9][0-9][0-9][0-9]\).*/\1/p' > /tmp/$$.year | sed -n 's/.*\([0-9][0-9][0-9][0-9]\)\(-\([0-9][0-9][0-9][0-9]\)\)?.*/\1 \2/p' \
| awk 'NF == 2 { for(i=$1; i<=$2; ++i) print $i } NF == 1' \
> /tmp/$$.year
if cvs log $file > /tmp/$$.yc ; then : ; if cvs log $file > /tmp/$$.yc ; then : ;
else echo "$file:1: cvs log failed" >&2 ; continue; else echo "$file:1: cvs log failed" >&2 ; continue;
fi fi
cat /tmp/$$.yc \ cat /tmp/$$.yc \
| sed -n 's/^date: \([0-9][0-9][0-9][0-9]\).*author.*state.*$/\1/p' \ | sed -n 's/^date: \([0-9][0-9][0-9][0-9]\).*author.*state.*$/\1/p' \
| sort | uniq >> /tmp/$$.year | sort | uniq >> /tmp/$$.year
y=`sort /tmp/$$.year | uniq \ y=`sort /tmp/$$.year \
| (read first ; echo -n $first; \ | uniq \
while read second; do echo -n ", $second"; done)` | (read first ; echo -n $first; next=\`expr $first + 1\`; rest=; \
sed 's/\([C]opyright[^0-9]*\)[0-9 ,]*[0-9]\([^0-9]*\)/\1'"$y"'\2/' \ while read second; \
do \
if [ $second = $next ]; \
then \
rest="-$next"; \
else \
echo -n $rest, $second; \
rest=; \
fi; \
next=\`expr $second + 1\`; \
done; \
echo -n $rest)`
sed 's/\([C]opyright[^0-9]*\)[---0-9 ,]*[0-9]\([^0-9]*\)/\1'"$y"'\2/' \
< $file > /tmp/$$.file < $file > /tmp/$$.file
cmp /tmp/$$.file $file >/dev/null cmp /tmp/$$.file $file >/dev/null
if [ $? = 1 ]; then if [ $? = 1 ]; then
...@@ -50,4 +64,5 @@ do ...@@ -50,4 +64,5 @@ do
fi fi
echo $file updated echo $file updated
fi fi
rm /tmp/$$.file /tmp/$$.yc /tmp/$$.year
done done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment