3 # This script scans the navit sources for attributes that
4 # remained in attr_def.h but are no longer used.
9 if [ ! -f ./navit.c ] ; then
10 echo "Please execute this script from navit's source folder."
14 TMPFILE=$TMPDIR/navit-cleanattr.tmp
15 TMPFILE2=$TMPDIR/navit-cleanattr.tmp2
17 if [ -f $TMPFILE ] ; then
18 echo "Temporary file $TMPFILE already exists."
19 echo "Please don't run this tool twice at the same time. If you are sure that no other instance of this tool is running, remove the file."
24 if [ $? -ne 0 ] ; then
25 echo "Could not write to temporary file $TEMPFILE."
26 echo "Please make sure you have write access to the temporary directory."
31 ATTRLIST=`grep 'ATTR(.*)' $ATTRFILE | sed 's#^ATTR(##' | sed 's#).*##'`
35 for ATTRNAME in $ATTRLIST ; do
38 grep -rI $ATTR ./* > /dev/null
40 if [ $? -ne 0 ] ; then
41 echo "Unused attribute: $ATTR"
42 grep -v "ATTR($ATTRNAME)" $TMPFILE > $TMPFILE2
47 echo "==== Creating patch ===="
48 diff -U 3 $ATTRFILE $TMPFILE