3 IFS=: ldpath=($LD_LIBRARY_PATH)
5 if [ "${dir:0:1}" == "#" ]; then
7 elif [ -d "$dir" ]; then
8 ldpath=("${ldpath[@]}" "$dir")
11 ldpath=("${ldpath[@]}" /usr/lib /lib)
15 for d in "${ldpath[@]}"; do
16 if [ -r "$d/$1" ]; then
25 for d in "${apath[@]}"; do
26 if [ -r "$d/$1" ]; then
35 for obj in "${found[@]}"; do
36 if [ "$obj" = "$1" ]; then return 0; fi
42 for obj in "${exclude[@]}"; do
43 if [ -d "$obj" ] && [[ "$1" == "$obj"* ]]; then return 0; fi
44 if [ "$1" -ef "$obj" ]; then return 0; fi
51 tfile="$(mktemp /tmp/lddotXXXXXX)"
52 objdump -p "$1" | sed -n 's/^.*NEEDED \+\(lib.*\)/\1/p' >"$tfile"
54 if ! lib2="$(findlib "$lib")"; then
55 echo "\"$lib\" [ color=red ];"
56 echo "lddot: $lib: not found" >&2
57 echo "\"$1\" -> \"$lib\";"
62 if excluded "$lib"; then continue; fi
63 echo "\"$1\" -> \"$lib\";"
64 if has "$lib"; then continue; fi
65 found=("${found[@]}" "$lib")
76 while [ $# -gt 0 ]; do
81 exclude=("${exclude[@]}" "$1")
85 programs=("${programs[@]}" "$arg")
89 if [ ${#programs[@]} -lt 1 ]; then
90 echo "usage: lddot [-x EXCLUDED] PROGRAM..." >&2
96 for bin in "${programs[@]}"; do
97 if [[ "$bin" != */* ]]; then
98 if ! bin2="$(findbin "$bin")"; then
99 echo "lddot: $bin: not found" >&2
106 if [ ! -r "$bin" ]; then
107 echo "lddot: $bin: not readable" >&2
111 echo "\"$bin\" [ shape=box ];"
112 if ! examine "$bin"; then rv=1; fi