reparse: Tighten reparse point length check
[Samba.git] / source4 / script / find_unused_options.sh
blobad56fabed26c85ec8dd0cd2d205e030cb8ac9d64
1 #!/bin/sh
3 # this script finds unused lp_*() functions
5 # use it like this:
7 # user@host:~/samba/source>./script/find_unused_options.sh
10 LIST_GLOBAL=$(grep '^FN_GLOBAL' param/loadparm.c | sed -e's/^FN_GLOBAL.*(\(.*\).*,.*\(&Globals\..*\)).*/\1:\2/')
12 LIST_LOCAL=$(grep '^FN_LOCAL' param/loadparm.c | sed -e's/^FN_LOCAL.*(\(.*\).*,[ ]*\(.*\)).*/\1:\2/')
14 CFILES=$(find . -name "*.c")
16 for i in $LIST_GLOBAL; do
17 key=$(echo $i | cut -d ':' -f1)
18 val=$(echo $i | cut -d ':' -f2)
20 found=$(grep "${key}[ ]*()" $CFILES)
21 if test -z "$found"; then
22 echo "Not Used Global: $key() -> $val"
24 done
26 for i in $LIST_LOCAL; do
27 key=$(echo $i | cut -d ':' -f1)
28 val=$(echo $i | cut -d ':' -f2)
30 found=$(grep "${key}[ ]*(" $CFILES)
32 if test -z "$found"; then
33 echo "Not Used LOCAL: $key() -> $val"
35 done
37 echo "# do a 'make clean;make everything' before removing anything!"