summaryrefslogtreecommitdiffstats
path: root/source4/script/find_unused_options.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:20:00 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:20:00 +0000
commit8daa83a594a2e98f39d764422bfbdbc62c9efd44 (patch)
tree4099e8021376c7d8c05bdf8503093d80e9c7bad0 /source4/script/find_unused_options.sh
parentInitial commit. (diff)
downloadsamba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.tar.xz
samba-8daa83a594a2e98f39d764422bfbdbc62c9efd44.zip
Adding upstream version 2:4.20.0+dfsg.upstream/2%4.20.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'source4/script/find_unused_options.sh')
-rwxr-xr-xsource4/script/find_unused_options.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/source4/script/find_unused_options.sh b/source4/script/find_unused_options.sh
new file mode 100755
index 0000000..ad56fab
--- /dev/null
+++ b/source4/script/find_unused_options.sh
@@ -0,0 +1,37 @@
+#!/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/')
+
+CFILES=$(find . -name "*.c")
+
+for i in $LIST_GLOBAL; do
+ key=$(echo $i | cut -d ':' -f1)
+ val=$(echo $i | cut -d ':' -f2)
+
+ found=$(grep "${key}[ ]*()" $CFILES)
+ if test -z "$found"; then
+ echo "Not Used Global: $key() -> $val"
+ fi
+done
+
+for i in $LIST_LOCAL; do
+ key=$(echo $i | cut -d ':' -f1)
+ val=$(echo $i | cut -d ':' -f2)
+
+ found=$(grep "${key}[ ]*(" $CFILES)
+
+ if test -z "$found"; then
+ echo "Not Used LOCAL: $key() -> $val"
+ fi
+done
+
+echo "# do a 'make clean;make everything' before removing anything!"