TOP="${0%/*}/.."
LICENSE="$TOP/LICENSE-BSD"
+EXCLUDE=""
show_usage () {
echo "usage: $0 [options]"
echo " --dry-run|-n Just find files lacking license info."
echo " --license|-L <file> Use file to obtain license text."
echo " --git|-g Add license only to files in the repository."
+ echo " --exclude|-e <pat> Exclude files matching egrep pattern <pat>."
echo " --help|-h Show this help and exit."
}
local _lacking _files _f
_lacking=""
- _files="`find . -name '*.[hc]'`"
+ if [ -z "$EXCLUDE" ]; then
+ _files="`find . -name '*.[hc]'`"
+ else
+ _files="`find . -name '*.[hc]' | egrep -v -e $EXCLUDE`"
+ fi
for _f in $_files; do
_f="${_f#./}"
--git|-g)
GIT="y"
;;
+ --exclude|-e)
+ if [ -n "$2" ]; then
+ shift
+ EXCLUDE="$1"
+ else
+ fatal 1 "missing exclusion pattern"
+ fi
+ ;;
--help|-h)
show_usage
exit 0