1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/source4/script/find_unused_options.sh
Stefan Metzmacher 04376e44b6 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 350fbe3440)
2004-01-29 09:54:42 +00:00

43 lines
974 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/'`
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!"