mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
d85a2dbfd7
source4/script/find_unused_options.sh:20:16: error: Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet). [SC1087] source4/script/find_unused_options.sh:30:16: error: Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet). [SC1087] Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
38 lines
876 B
Bash
Executable File
38 lines
876 B
Bash
Executable File
#!/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!"
|