From 4f5791ebd03eaec1c7da0865a383175b05102712 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 19:47:29 +0200 Subject: Adding upstream version 2:4.17.12+dfsg. Signed-off-by: Daniel Baumann --- source4/script/find_unused_options.sh | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 source4/script/find_unused_options.sh (limited to 'source4/script/find_unused_options.sh') diff --git a/source4/script/find_unused_options.sh b/source4/script/find_unused_options.sh new file mode 100755 index 0000000..36e9771 --- /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!" -- cgit v1.2.3