2 # $Id: srclist-update,v 1.10 2003-07-16 12:47:48 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 dsttmp=$TMPDIR/srclist.dst
20 test -r $mydir/srclistvars.sh && . $mydir/srclistvars.sh
24 # $1 is input, output to stdout with gpl.
30 /^\([[:space:]]*#[[:space:]]*\)Th[ei][ s].* is free software/,/^[[:space:]]*#.*USA\./c\
31 # This program is free software; you can redistribute it and/or modify\
32 # it under the terms of the GNU General Public License as published by\
33 # the Free Software Foundation; either version 2, or (at your option)\
36 # This program is distributed in the hope that it will be useful,\
37 # but WITHOUT ANY WARRANTY; without even the implied warranty of\
38 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
39 # GNU General Public License for more details.\
41 # You should have received a copy of the GNU General Public License along\
42 # with this program; if not, write to the Free Software Foundation,\
43 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
45 /Th[ei][ s].* is free software/,/USA\. *\*\//c\
46 This program is free software; you can redistribute it and/or modify\
47 it under the terms of the GNU General Public License as published by\
48 the Free Software Foundation; either version 2, or (at your option)\
51 This program is distributed in the hope that it will be useful,\
52 but WITHOUT ANY WARRANTY; without even the implied warranty of\
53 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
54 GNU General Public License for more details.\
56 You should have received a copy of the GNU General Public License along\
57 with this program; if not, write to the Free Software Foundation,\
58 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
63 # $1 is input file, $2 is output.
64 # Remove $Id lines, since they'll differ between source locations.
65 # If $options contains "gpl", change the license to be the standard
66 # GPL. We use this for libc files, et al.
76 | grep -v '[$]Id:.*[$]' >$2 2>&1
81 cat | while read src dst options; do
82 #echo "src=$src, dst=$dst, options=$options" >&2
84 *: ) continue;; # skip lines without second element
85 '#'* ) continue;; # skip comment-only lines
88 # Expand variables and make sure we have an input file.
90 if test ! -r $src; then
91 echo "$0: cannot read $src" >&2
95 # Ignore subdirs in src dir. E.g., if input spec is
96 # src/subdir/foo.c dst
97 # then write destination file dst/foo.c.
99 test -d $dst && dst=$dst/`basename $src`
101 # Do license changes and $Id removal in both src and dst, for the sake
102 # of a clean comparison.
103 srctmp=$TMPDIR/`basename $src`
105 test -r $dst && fixfile $dst $dsttmp
107 if test ! -e $dst; then
108 echo "## $srctmp $dst # new"
109 $chicken cp -p $srctmp $dst
110 elif cmp -s $srctmp $dsttmp; then
111 $verbose && echo "## $srctmp $dst # unchanged"
113 echo "## $srctmp $dst # changes"
114 diff -C 2 $dst $srctmp