#! /bin/sh
test ! -t 0 && exit
cd `dirname $0`
RUN_DIR=`pwd`

SRCDIR="flwm-1.14.orig"
DSTDIR="flwm-1.14"

LIST=""
find ${DSTDIR} -type f | while read i; do
	j=${i#${DSTDIR}/}
	if [ -f "${SRCDIR}/${j}" ]; then
		a=`md5sum "${SRCDIR}/${j}" | cut -d ' ' -f 1`
		b=`md5sum "${DSTDIR}/${j}" | cut -d ' ' -f 1`
		if [ "$a" != "$b" ]; then
			n=`basename $j`
			diff -uN "${SRCDIR}/${j}" "${DSTDIR}/${j}" > ${n}.patch
		fi
	else
		echo "[Warning] $j not found."
	
	fi
done
