r9684: Remove unused parameters (about 70)
[samba.git] / source4 / script / find_unused_options.sh
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
10 LIST_GLOBAL=`grep '^FN_GLOBAL' param/loadparm.c |sed -e's/^FN_GLOBAL.*(\(.*\).*,.*\(&Globals\..*\)).*/\1:\2/'`
11
12 LIST_LOCAL=`grep '^FN_LOCAL' param/loadparm.c |sed -e's/^FN_LOCAL.*(\(.*\).*,[ ]*\(.*\)).*/\1:\2/'`
13
14 CFILES=`find . -name "*.c"`
15
16 for 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
24 done
25
26 for 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
35 done
36
37 echo "# do a 'make clean;make everything' before removing anything!"