1#!/bin/sh 2# 3# this script finds unused lp_*() functions 4# 5# use it like this: 6# 7# user@host:~/samba/source>./script/find_unused_options.sh 8# 9 10LIST_GLOBAL=`grep '^FN_GLOBAL' param/loadparm.c |sed -e's/^FN_GLOBAL.*(\(.*\).*,.*\(&Globals\..*\)).*/\1:\2/'` 11 12LIST_LOCAL=`grep '^FN_LOCAL' param/loadparm.c |sed -e's/^FN_LOCAL.*(\(.*\).*,[ ]*\(.*\)).*/\1:\2/'` 13 14CFILES=`find . -name "*.c"` 15 16for i in $LIST_GLOBAL;do 17 key=`echo $i|cut -d ':' -f1` 18 val=`echo $i|cut -d ':' -f2` 19 20 found=`grep "$key[ ]*()" $CFILES` 21 if test -z "$found"; then 22 echo "Not Used Global: $key() -> $val" 23 fi 24done 25 26for i in $LIST_LOCAL;do 27 key=`echo $i|cut -d ':' -f1` 28 val=`echo $i|cut -d ':' -f2` 29 30 found=`grep "$key[ ]*(" $CFILES` 31 32 if test -z "$found"; then 33 echo "Not Used LOCAL: $key() -> $val" 34 fi 35done 36 37echo "# do a 'make clean;make everything' before removing anything!" 38