This simple shell-script tries to find *.c files under /sys
which are not in some way used or referenced somewhere.
This commit is contained in:
parent
9653928c02
commit
c64a712a37
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86111
43
tools/tools/kernelcruft/kernelcruft.sh
Normal file
43
tools/tools/kernelcruft/kernelcruft.sh
Normal file
@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# kernelcruft.sh
|
||||
#
|
||||
# Try to find *.c files in /sys which are orphaned
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
cd /sys/conf
|
||||
cat files* | sed '
|
||||
/^[ ]*#/d
|
||||
s/[ ].*//
|
||||
/^$/d
|
||||
' | sort -u > /tmp/_0
|
||||
|
||||
cd /sys
|
||||
find * -name '*.c' -print | sed '
|
||||
/\/compile\//d
|
||||
/^boot/d
|
||||
' | sort -u > /tmp/_1
|
||||
|
||||
find * -name '*.[ch]' -print | xargs grep 'include.*c[>"]' > /tmp/_2
|
||||
|
||||
find * -name 'Makefile*' -print | xargs cat | sed '
|
||||
/^ /d
|
||||
s/:.*//
|
||||
/^[ ]*$/d
|
||||
' > /tmp/_3
|
||||
|
||||
comm -13 /tmp/_0 /tmp/_1 | while read f
|
||||
do
|
||||
b=`basename $f`
|
||||
if grep $b /tmp/_2 > /dev/null ; then
|
||||
# echo "2 $f"
|
||||
continue
|
||||
fi
|
||||
if grep $b /tmp/_3 > /dev/null ; then
|
||||
# echo "3 $f"
|
||||
continue
|
||||
fi
|
||||
echo $f
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user