2 # Check for files in directory $1 being up to date, according to the
3 # list on stdin. Don't actually make any changes, just show the diffs.
5 # Copyright (C) 2002, 2003, 2005, 2007, 2008, 2009, 2010 Free Software
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # Originally written by Karl Berry.
29 #chicken="echo (would)"
32 dsttmp=$TMPDIR/srclist.dst
34 # Source `dirname $0`/srclistvars.sh first, if it exists.
36 test -r $mydir/srclistvars.sh && . $mydir/srclistvars.sh
40 # sed command to fix the license to be GPL.
42 /^[[:space:]]*#[[:space:]]*Th[ei][ s].* is free software/,/^[[:space:]]*#.*USA\./c\
43 # This program is free software: you can redistribute it and/or modify\
44 # it under the terms of the GNU General Public License as published by\
45 # the Free Software Foundation; either version 3 of the License, or\
46 # (at your option) any later version.\
48 # This program is distributed in the hope that it will be useful,\
49 # but WITHOUT ANY WARRANTY; without even the implied warranty of\
50 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
51 # GNU General Public License for more details.\
53 # You should have received a copy of the GNU General Public License\
54 # along with this program. If not, see <http://www.gnu.org/licenses/>.
56 /Th[ei][ s].* is free software/,/\*\//c\
57 This program is free software: you can redistribute it and/or modify\
58 it under the terms of the GNU General Public License as published by\
59 the Free Software Foundation; either version 3 of the License, or\
60 (at your option) any later version.\
62 This program is distributed in the hope that it will be useful,\
63 but WITHOUT ANY WARRANTY; without even the implied warranty of\
64 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
65 GNU General Public License for more details.\
67 You should have received a copy of the GNU General Public License\
68 along with this program. If not, see <http://www.gnu.org/licenses/>. */
71 # sed command to remove lines containing $Id lines.
72 # Quote the $ so that CVS does not expand it in this script.
73 remove_id_lines='/[$]Id:.*[$]/d'
75 # $1 is input file, $2 is output.
76 # Remove $Id lines, since they'll differ between source locations.
77 # If $options contains "gpl", change the license to be the standard
78 # GPL. We use this for libc files, et al.
82 sed_command="$remove_id_lines"
86 sed_command="$sed_command; $fixlicense";;
89 sed "$sed_command" $1 >$2
94 cat | while read src dst options; do
95 #echo "src=$src, dst=$dst, options=$options" >&2
97 *: ) continue;; # skip lines without second element
98 '#'* ) continue;; # skip comment-only lines
101 # Expand variables and make sure we have an input file.
103 if test ! -r $src; then
104 echo "$0: cannot read $src" >&2
108 # Ignore subdirs in src dir. E.g., if input spec is
109 # src/subdir/foo.c dst
110 # then write destination file dst/foo.c.
112 test -d $dst && dst=$dst/`basename $src`
114 # Fix files in both src and dst, for the sake
115 # of a clean comparison.
116 srctmp=$TMPDIR/`basename $src`
118 test -r $dst && fixfile $dst $dsttmp
120 # if src was executable, make dst executable, to placate git.
121 test -x $src && chmod a+x $dst
123 if test ! -e $dst; then
124 echo "## $srctmp $dst # new"
125 $chicken cp -p $srctmp $dst
126 elif cmp -s $srctmp $dsttmp; then
127 $verbose && echo "## $srctmp $dst # unchanged"
129 echo "## $srctmp $dst # changes"
130 diff -C 2 $dst $srctmp