summaryrefslogtreecommitdiff
path: root/source4/script
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-01-29 09:54:42 +0000
committerStefan Metzmacher <metze@samba.org>2004-01-29 09:54:42 +0000
commit04376e44b652711bf63ab404806af6531efc5694 (patch)
treeba5d69a91eefce26a67f898856892dedf485a37e /source4/script
parent1aceddaec4abd9d52c28e77957a7212706ad66ff (diff)
downloadsamba-04376e44b652711bf63ab404806af6531efc5694.tar.gz
samba-04376e44b652711bf63ab404806af6531efc5694.tar.bz2
samba-04376e44b652711bf63ab404806af6531efc5694.zip
add find_unused_options.sh
this script finds unused lp_*() functions use it like this: user@host:~/samba/source>./script/find_unused_options.sh metze (This used to be commit 350fbe3440e28bcb26f9a9e8b999b0c4a70de64d)
Diffstat (limited to 'source4/script')
-rwxr-xr-xsource4/script/find_unused_options.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/source4/script/find_unused_options.sh b/source4/script/find_unused_options.sh
new file mode 100755
index 0000000000..d5c9f7ed99
--- /dev/null
+++ b/source4/script/find_unused_options.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# this script finds unused lp_*() functions
+#
+# use it like this:
+#
+# user@host:~/samba/source>./script/find_unused_options.sh
+#
+
+LIST_GLOBAL=`grep '^FN_GLOBAL' param/loadparm.c |sed -e's/^FN_GLOBAL.*(\(.*\).*,.*\(&Globals\..*\)).*/\1:\2/'`
+
+LIST_LOCAL=`grep '^FN_LOCAL' param/loadparm.c |sed -e's/^FN_LOCAL.*(\(.*\).*,[ ]*\(.*\)).*/\1:\2/'`
+
+for i in $LIST_GLOBAL;do
+ key=`echo $i|cut -d ':' -f1`
+ val=`echo $i|cut -d ':' -f2`
+
+ found=`grep "$key[ ]*()" */*.c`
+
+ if test -z "$found"; then
+ found=`grep "$key[ ]*()" */*/*.c`
+ if test -z "$found"; then
+ echo "Not Used Global: $key() -> $val"
+ fi
+ fi
+done
+
+for i in $LIST_LOCAL;do
+ key=`echo $i|cut -d ':' -f1`
+ val=`echo $i|cut -d ':' -f2`
+
+ found=`grep "$key[ ]*(" */*.c`
+
+ if test -z "$found"; then
+ found=`grep "$key[ ]*(" */*/*.c`
+ if test -z "$found"; then
+ echo "Not Used LOCAL: $key() -> $val"
+ fi
+ fi
+done
+
+echo "# do a 'make clean;make everything' before removing anything!"