#!/bin/sh

THISDIR=`dirname "$0"`

PACKAGE=${1:-"pkg/landfall-examples"}
BASEDIR=`realpath "$THISDIR/.."`

if [ ! -e "$PACKAGE" ] ; then
    echo "Package not found: $PACKAGE" 1>&2
    exit 1
fi

for FILENAME in `find "$PACKAGE" -type f` ; do
    if [ `basename "$FILENAME"` != `basename "$FILENAME" .orig` ] ; then
        continue
    fi

    if [ -e "$BASEDIR/$FILENAME" ] ; then
        diff -u "$BASEDIR/$FILENAME" "$FILENAME"
    else
        diff -u /dev/null "$FILENAME"
    fi
done
