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 # Empty (or only whitespace) input lines are ignored.
6 # Lines beginning with # are ignored.
7 # Lines with just one word are ignored.
8 # Otherwise, the line has two or more whitespace-separated words:
9 # the first word is the source, the second word is the destination,
10 # other optional words are options.
11 # The possible options are "gpl" (to replace the license with the GPL)
12 # and "doclicense" (to replace @include doclicense.texi with fdl.texi).
13 # Unrecognized options are ignored.
14 # $VARIABLE expansions are done (with sh eval).
16 # This script is used in gnulib and texinfo; the input files are named
19 # Copyright (C) 2002-2003, 2005, 2007-2013 Free Software Foundation, Inc.
21 # This program is free software: you can redistribute it and/or modify
22 # it under the terms of the GNU General Public License as published by
23 # the Free Software Foundation; either version 3 of the License, or
24 # (at your option) any later version.
26 # This program is distributed in the hope that it will be useful,
27 # but WITHOUT ANY WARRANTY; without even the implied warranty of
28 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 # GNU General Public License for more details.
31 # You should have received a copy of the GNU General Public License
32 # along with this program. If not, see <http://www.gnu.org/licenses/>.
34 # Originally written by Karl Berry.
42 #chicken="echo (would)"
45 dsttmp=$TMPDIR/srclist.dst
47 # Source `dirname $0`/srclistvars.sh first, if it exists.
49 test -r $mydir/srclistvars.sh && . $mydir/srclistvars.sh
53 # sed command to fix the license to be GPL.
55 /^[[:space:]]*#[[:space:]]*Th[ei][ s].* is free software/,/^[[:space:]]*#.*USA\./c\
56 # This program is free software: you can redistribute it and/or modify\
57 # it under the terms of the GNU General Public License as published by\
58 # the Free Software Foundation; either version 3 of the License, or\
59 # (at your option) any later version.\
61 # This program is distributed in the hope that it will be useful,\
62 # but WITHOUT ANY WARRANTY; without even the implied warranty of\
63 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
64 # GNU General Public License for more details.\
66 # You should have received a copy of the GNU General Public License\
67 # along with this program. If not, see <http://www.gnu.org/licenses/>.
69 /Th[ei][ s].* is free software/,/\*\//c\
70 This program is free software: you can redistribute it and/or modify\
71 it under the terms of the GNU General Public License as published by\
72 the Free Software Foundation; either version 3 of the License, or\
73 (at your option) any later version.\
75 This program is distributed in the hope that it will be useful,\
76 but WITHOUT ANY WARRANTY; without even the implied warranty of\
77 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
78 GNU General Public License for more details.\
80 You should have received a copy of the GNU General Public License\
81 along with this program. If not, see <http://www.gnu.org/licenses/>. */
84 # sed command to remove lines containing $Id lines.
85 # Quote the $ so that CVS does not expand it in this script.
86 remove_id_lines='/[$]Id:.*[$]/d'
88 # $1 is input file, $2 is output.
89 # Remove $Id lines, since they'll differ between source locations.
90 # If $options contains "gpl", change the license to be the standard
91 # GPL. We use this for libc files, et al.
95 sed_command="$remove_id_lines"
99 sed_command="$sed_command; $fixlicense";;
102 sed_command="$sed_command; s/@include doclicense.texi/@include fdl.texi/";;
105 sed "$sed_command" $1 >$2
110 cat | while read src dst options; do
111 #echo "src=$src, dst=$dst, options=$options" >&2
113 *: ) continue;; # skip lines without second element
114 '#'* ) continue;; # skip comment-only lines
117 # Expand variables and make sure we have an input file.
119 if test ! -r $src; then
120 echo "$0: cannot read $src" >&2
124 # Ignore subdirs in src dir. E.g., if input spec is
125 # src/subdir/foo.c dst
126 # then write destination file dst/foo.c.
128 test -d $dst && dst=$dst/`basename $src`
130 # Fix files in both src and dst, for the sake
131 # of a clean comparison.
132 srctmp=$TMPDIR/`basename $src`
134 test -r $dst && fixfile $dst $dsttmp
136 # if src was executable, make dst executable, to placate git.
137 test -x $src && chmod a+x $dst
139 if test ! -e $dst; then
140 echo "## $srctmp $dst # new"
141 $chicken cp -p $srctmp $dst
142 elif cmp -s $srctmp $dsttmp; then
143 $verbose && echo "## $srctmp $dst # unchanged"
145 echo "## $srctmp $dst # changes"
146 diff -C 2 $dst $srctmp