2 # $Id: srclist-update,v 1.5 2002-11-26 22:58:57 karl Exp $
4 # Check for files in directory $1 being up to date, according to the
5 # list on stdin. Don't actually make any changes, just show the diffs.
7 # Source `dirname $0`/srclistvars.sh first, if it exists.
14 #chicken="echo (would)"
17 srctmp=$TMPDIR/srclist.src
18 dsttmp=$TMPDIR/srclist.dst
21 test -r $mydir/srclistvars.sh && . $mydir/srclistvars.sh
25 # $1 is input, output to stdout with gpl.
29 sed '/The .* is free software/,/USA\. *\*\//c\
30 This program is free software; you can redistribute it and/or modify\
31 it under the terms of the GNU General Public License as published by\
32 the Free Software Foundation; either version 2, or (at your option)\
35 This program is distributed in the hope that it will be useful,\
36 but WITHOUT ANY WARRANTY; without even the implied warranty of\
37 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
38 GNU General Public License for more details.\
40 You should have received a copy of the GNU General Public License along\
41 with this program; if not, write to the Free Software Foundation,\
42 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
47 # $1 is input file, $2 is output.
48 # Remove $Id lines, since they'll differ between source locations.
49 # If $options contains "gpl", change the license to be the standard
50 # GPL. We use this for libc files.
54 if echo "$options" | grep -w gpl >/dev/null; then
59 | fgrep -v '$'"Id:" >$2
64 cat | while read src dst options; do
65 test -z "$dst" && continue # skip lines without second element
66 echo "$src $dst" | sed 's/#.*$//' | egrep '^\s*$' >/dev/null \
67 && continue # skip whitespace and comment-only lines
70 if test ! -r $src; then
71 echo "$0: cannot read $src" >&2
75 # Ignore subdirs in src dir. E.g., if input spec is
76 # src/subdir/foo.c dst
77 # write destination file dst/foo.c.
79 test -d $dst && dst=$dst/`basename $src`
81 # Make changes for sake of comparison.
83 test -r $dst && fixfile $dst $dsttmp
85 # don't show license differences.
86 gplsrc=$TMPDIR/`basename $src`
87 fixlicense $src >$gplsrc
88 cmp -s $src $gplsrc && gplsrc=$src
90 if test ! -e $dst; then
91 echo "## $gplsrc $dst # new"
92 $chicken cp -p $gplsrc $dst
93 elif cmp -s $srctmp $dsttmp; then
94 $verbose && echo "## $gplsrc $dst # unchanged"
96 echo "## $gplsrc $dst # changes"
101 rm -f $srctmp $dsttmp