2 # $Id: srclist-update,v 1.2 2002-09-25 14:18:57 karl Exp $
4 # Check for files being up to date, according to the list on stdin.
6 # Source $mydir/srclistvars.sh first, if it exists, where
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
22 cat | while read src dst; do
23 test -z "$dst" && continue # skip lines without second element
24 echo "$src $dst" | sed 's/#.*$//' | egrep '^\s*$' >/dev/null \
25 && continue # skip whitespace and comment-only lines
28 if test ! -r $src; then
29 echo "$0: cannot read $src" >&2
33 # If given src/foo.c dst, copy to dst/foo.c.
35 test -d $dst && dst=$dst/`basename $src`
37 # $ Id: lines will differ.
38 fgrep -v '$'"Id:" $src >$srctmp
39 test -r $dst && fgrep -v '$'"Id:" $dst >$dsttmp
41 if test ! -e $dst; then
42 echo "## $src $dst # new"
43 $chicken cp -p $src $dst
44 elif cmp -s $srctmp $dsttmp; then
45 $verbose && echo "## $src $dst # unchanged"
47 echo "## $src $dst # changes"