#!/bin/csh -f

set snddir = /home/bil/dist/snd
set sndtools = /home/bil/dist/snd/tools
set movdir = /home/bil/mov
set curdir = /home/bil/cl
set curtools = /home/bil/cl/tools

date > $curdir/hi
echo ' ' >> $curdir/hi

chdir snddir
foreach file (*.h *.c *.cl *.el *.html makefile.* make.* *.gtkrc *.in *.scm *.lisp snd.spec old-snd.spec *.Snd Snd.ad snd.1 configure.ac *.rb *.m4 config.guess config.sub NEWS *.tex COPYING)
  if (-e $curdir/$file) then
    diff -bcw $curdir/$file $snddir/$file >> $curdir/hi
    find $curdir/$file -newer $snddir/$file -exec echo ' updating ' $file \;
    find $curdir/$file -newer $snddir/$file -exec cp $snddir/$file $movdir \;
    find $curdir/$file -newer $snddir/$file -exec cp $curdir/$file $snddir \;
  endif
end

chdir curtools
foreach file (*)
  if (-e $curdir/$file) then
    find $curdir/$file -newer $curtools/$file -exec echo ' updating ' tools/$file \;
    find $curdir/$file -newer $curtools/$file -exec cp $curtools/$file $movdir \;
    find $curdir/$file -newer $curtools/$file -exec cp $curdir/$file $curtools \;
  endif
end

chdir sndtools
foreach file (*)
  if (-e $curtools/$file) then
    diff -bcw $curtools/$file $sndtools/$file >> $curdir/hi
    find $curtools/$file -newer $sndtools/$file -exec echo ' updating ' tools/$file \;
    find $curtools/$file -newer $sndtools/$file -exec cp $sndtools/$file $movdir \;
    find $curtools/$file -newer $sndtools/$file -exec cp $curtools/$file $sndtools \;
  endif
end
  

chdir snddir
cp $curdir/configure $snddir

rm snd.tar
tar -chf snd.tar *

chdir curdir
wc hi
mv po/snd.pot $movdir
xgettext --keyword=_ --keyword=N_ --files-from=po/POTFILES.in -o po/snd.pot
cp po/snd.pot $snddir/po/snd.pot
