diff options
author | phk <phk@FreeBSD.org> | 2001-11-05 22:06:09 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-11-05 22:06:09 +0000 |
commit | 22696e16e8df164a1af75c51cdffbd3cf7e6f4c0 (patch) | |
tree | e3eec1759e2834aadab66172f45d4f3a52b9615a /tools | |
parent | 87f18c0e4ef0b98c26d0d010e38a7ec8aa175ffb (diff) | |
download | FreeBSD-src-22696e16e8df164a1af75c51cdffbd3cf7e6f4c0.zip FreeBSD-src-22696e16e8df164a1af75c51cdffbd3cf7e6f4c0.tar.gz |
This simple shell-script tries to find *.c files under /sys
which are not in some way used or referenced somewhere.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/kernelcruft/kernelcruft.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/tools/kernelcruft/kernelcruft.sh b/tools/tools/kernelcruft/kernelcruft.sh new file mode 100644 index 0000000..87288c5 --- /dev/null +++ b/tools/tools/kernelcruft/kernelcruft.sh @@ -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 + |