1 | #!/bin/sh
|
---|
2 |
|
---|
3 | usage() {
|
---|
4 | echo `basename $0` \[-V\] \<symbol\>
|
---|
5 | echo \- list files containing \<symbol\>
|
---|
6 | echo " -V lists also directories searched"
|
---|
7 | echo ""
|
---|
8 | echo `basename $0` -h
|
---|
9 | echo \- Show this help
|
---|
10 | exit 0
|
---|
11 | }
|
---|
12 |
|
---|
13 | if [ "$1" == "-V" ]; then
|
---|
14 | VERBOSE=1
|
---|
15 | shift
|
---|
16 | else
|
---|
17 | VERBOSE=0
|
---|
18 | fi
|
---|
19 |
|
---|
20 | if [ "$1" == "-h" ]; then
|
---|
21 | usage
|
---|
22 | fi
|
---|
23 |
|
---|
24 | if [ "x$1" == "x" ]; then
|
---|
25 | usage
|
---|
26 | fi
|
---|
27 |
|
---|
28 | LPATH=`echo $LIBRARY_PATH|sed "s|%A/lib:||"`
|
---|
29 | [ -d ./lib ] && LPATH="./lib:$LPATH" || true
|
---|
30 | LPATH=`echo $LPATH|sed "s/:/ /g"`
|
---|
31 | TEMPFILE=/boot/var/tmp/`basename $0`.$PPID
|
---|
32 | for libdir in `echo $LPATH`; do
|
---|
33 | if [ "$VERBOSE" == "1" ]; then
|
---|
34 | echo Searching in \"$libdir\"...
|
---|
35 | fi
|
---|
36 | for lib in $libdir/*.so ; do
|
---|
37 | echo "[ $lib ]" > $TEMPFILE
|
---|
38 | (nm -D $lib 2>/dev/null)|grep $1 >> $TEMPFILE
|
---|
39 | LINES=`wc -l $TEMPFILE | awk '{ print $1; }'`
|
---|
40 | if [ "$LINES" != "1" ]; then
|
---|
41 | cat $TEMPFILE
|
---|
42 | fi
|
---|
43 | done
|
---|
44 | done
|
---|
45 | rm -f $TEMPFILE
|
---|