#!/bin/sh

# Generate diff of two source trees
#
# Copyright (C) 1997-2006 Free Software Foundation, Inc.
#
# Authors: Jan-Jaap van der Heijden <J.J.vanderHeijden@student.utwente.nl>
#          Peter Gerwinski <peter@gerwinski.de>
#          Frank Heckenbach <frank@pascal.gnu.de>
#
# This file is part of GNU Pascal.
#
# GNU Pascal is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# GNU Pascal is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Pascal; see the file COPYING. If not, write to the
# Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

if [ $# -lt 3 -o $# -gt 4 ]; then
  echo "Usage: `basename "$0"` old-dir new-dir exclude-file [intro-file]" >&2
  exit 1
fi

if [ $# -ge 4 ]; then
  sed -e "s@\$1@$1@;s@\$2@$2@" < "$4"
fi

diff -p -r -U3 -N -X "$3" "$1" "$2"; if [ $? -gt 1 ]; then exit 1; fi
exit 0
