#!/bin/sh
root="."
uniq_options=""
show_file=no
while :
do
case $ 0)
break
;;
esac
option=$1
shift
case $option in
-c)
uniq_options="-c"
;;
-f)
show_file=yes
;;
*)
root=$option
;;
esac
done
if [ $show_file == no ]; then
grep 'APPLE[^_]LOCAL' -r $root | sed -e 's/.*APPLE/APPLE/' >/tmp/rawlocals
else
grep -n 'APPLE[^_]LOCAL' -r $root | sed -e 's/\(.*:[0-9]*:\).*APPLE/\1 APPLE/' >/tmp/rawlocals
fi
sed < /tmp/rawlocals \
-e 's/LOCAL[: ] /LOCAL /' \
-e 's/LOCAL *begin/LOCAL/' \
-e '/LOCAL *end/d' \
-e '/APPLE LOCAL"/d' \
-e 's/LOCAL *file/LOCAL/' \
-e 's/APPLE[ ]LOCAL[ ]*//' \
-e 's,\*/.*$,,g' \
-e 's/ dpatel//' \
-e 's/ ff//' \
-e 's/ ilr//' \
-e 's/ matt//' \
-e 's/ --matt//' \
-e 's/ sts//' \
-e 's/ turly//' \
-e 's/ tur//' \
-e 's/ zll//' \
-e 's/ 200[12]-..-..//' \
-e 's/ 200[12]-.-..//' \
-e 's/ 200[12][0-9][0-9][0-9][0-9]//' \
-e 's,[ */"\\]*$,,g' | \
sort | uniq $uniq_options