2 # $Id: srclist-update,v 1.3 2002-11-25 00:20:03 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)"
16 srctmp=${TMPDIR-/tmp}/srclist.src
17 dsttmp=${TMPDIR-/tmp}/srclist.dst
20 test -r $mydir/srclistvars.sh && . $mydir/srclistvars.sh
24 # $1 is input, output to stdout with gpl.
28 sed '/The .* is free software/,/USA\. *\*\//c\
29 This program is free software; you can redistribute it and/or modify\
30 it under the terms of the GNU General Public License as published by\
31 the Free Software Foundation; either version 2, or (at your option)\
34 This program is distributed in the hope that it will be useful,\
35 but WITHOUT ANY WARRANTY; without even the implied warranty of\
36 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
37 GNU General Public License for more details.\
39 You should have received a copy of the GNU General Public License along\
40 with this program; if not, write to the Free Software Foundation,\
41 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
46 # $1 is input file, $2 is output.
47 # Remove $Id lines, since they'll differ between source locations.
48 # If $options contains "gpl", change the license to be the standard
49 # GPL. We use this for libc files.
53 if echo "$options" | grep -w gpl >/dev/null; then
58 | fgrep -v '$'"Id:" >$2
63 cat | while read src dst options; do
64 test -z "$dst" && continue # skip lines without second element
65 echo "$src $dst" | sed 's/#.*$//' | egrep '^\s*$' >/dev/null \
66 && continue # skip whitespace and comment-only lines
69 if test ! -r $src; then
70 echo "$0: cannot read $src" >&2
74 # Ignore subdirs in src dir. E.g., if input spec is
75 # src/subdir/foo.c dst
76 # write destination file dst/foo.c.
78 test -d $dst && dst=$dst/`basename $src`
80 # Make changes for sake of comparison.
82 test -r $dst && fixfile $dst $dsttmp
84 # don't show license differences.
85 gplsrc=$TMPDIR/`basename $src`
86 fixlicense $src >$gplsrc
87 cmp -s $src $gplsrc && gplsrc=$src
89 if test ! -e $dst; then
90 echo "## $gplsrc $dst # new"
91 $chicken cp -p $gplsrc $dst
92 elif cmp -s $srctmp $dsttmp; then
93 $verbose && echo "## $gplsrc $dst # unchanged"
95 echo "## $gplsrc $dst # changes"
100 rm -f $srctmp $dsttmp