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" = "$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 "\"$1\" -> \"$lib\";"
61 if excluded "$lib"; then continue; fi
62 echo "\"$1\" -> \"$lib\";"
63 if has "$lib"; then continue; fi
64 found=("${found[@]}" "$lib")
75 while [ $# -gt 0 ]; do
80 exclude=("${exclude[@]}" "$1")
84 programs=("${programs[@]}" "$arg")
88 if [ ${#programs[@]} -lt 1 ]; then
89 echo "usage: lddot [-x EXCLUDED] PROGRAM..." >&2
95 for bin in "${programs[@]}"; do
96 if [[ "$bin" != */* ]]; then
97 if ! bin2="$(findbin "$bin")"; then
98 echo "lddot: $bin: not found" >&2
105 if [ ! -r "$bin" ]; then
106 echo "lddot: $bin: not readable" >&2
110 if ! examine "$bin"; then rv=1; fi