#!/bin/bash
CWD=`pwd`
program=`basename $0`
usage() {
cat << EOF
Usage: $program [options]
Options:
-h,--help Display this message.
EOF
}
if [ -f "${CWD}/Makefile" ] ; then
make distclean
fi
svnignore='.svnignore'
while read ln; do
line=`echo "${ln}" | sed 's,^[ \t],,' | sed 's,[ \t]$,,'`
if [ "x$line" != "x" -a "${line:0:1}" != "#" ] ; then
if `echo "${line}" | grep -q '\*~$'` ; then
find "`dirname "${line}"`" -type f -iname '*~' -print0 | while IFS= read -r -d '' file ; do
rm -f "$file"
done
elif `echo "${line}" | grep -q '\*'` ; then
find "`dirname "${line}"`" -type f -iname "`basename "${line}"`" -print0 | while IFS= read -r -d '' file ; do
rm -f "$file"
done
else
if [ -d "${line}" ] ; then rm -rf "${line}" ; fi
if [ -f "${line}" ] ; then rm -f "${line}" ; fi
fi
fi
done < ${CWD}/${svnignore}