From ab22601b8673aa0f4e0ec02e540ea9af456601a3 Mon Sep 17 00:00:00 2001 From: fredrik Date: Sun, 2 Sep 2007 22:25:54 +0000 Subject: [PATCH] Added lddot. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@1101 959494ce-11ee-0310-bf91-de5d638817bd --- lddot | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100755 lddot diff --git a/lddot b/lddot new file mode 100755 index 0000000..5c3568c --- /dev/null +++ b/lddot @@ -0,0 +1,114 @@ +#!/bin/bash + +IFS=: ldpath=($LD_LIBRARY_PATH) +while read dir; do + if [ "${dir:0:1}" == "#" ]; then + continue + elif [ -d "$dir" ]; then + ldpath=$("${LDPATH[@]}" "$dir") + fi +done "$tfile" + while read lib; do + if ! lib2="$(findlib "$lib")"; then + echo "lddot: $lib: not found" >&2 + rm -f "$tfile" + return 1 + fi + lib="$lib2" + unset lib2 + if excluded "$lib"; then continue; fi + echo "\"$1\" -> \"$lib\";" + if has "$lib"; then continue; fi + found=("${found[@]}" "$lib") + examine "$lib" + done <"$tfile" + rm -f "$tfile" + return 0 +} + +found=() +exclude=() +programs=() + +while [ $# -gt 0 ]; do + arg="$1" + shift + case "$arg" in + -x) + exclude=("${exclude[@]}" "$1") + shift + ;; + *) + programs=("${programs[@]}" "$arg") + esac +done + +if [ ${#programs[@]} -lt 1 ]; then + echo "usage: lddot [-x EXCLUDED] PROGRAM..." >&2 + exit 1 +fi + +echo "digraph {" +rv=0 +for bin in "${programs[@]}"; do + if [[ "$bin" != */* ]]; then + if ! bin2="$(findbin "$bin")"; then + echo "lddot: $bin: not found" >&2 + rv=1 + continue + fi + bin="$bin2" + unset bin2 + fi + if [ ! -r "$bin" ]; then + echo "lddot: $bin: not readable" >&2 + rv=1 + continue + fi + if ! examine "$bin"; then rv=1; fi +done +echo "}" + +exit $rv -- 2.11.0