Permalink
Browse files

functions: do a lookup for libraries

  • Loading branch information...
1 parent 30eb2c9 commit 7f266637a4080aadba53411db9bfaf5c1a7e6166 @falconindy committed Apr 22, 2012
Showing with 17 additions and 5 deletions.
  1. +17 −5 .functions
View
22 .functions
@@ -69,15 +69,27 @@ debugflags() {
}
deps() {
- local prog
+ local bin dir
if [[ -f "$1" ]]; then
- prog=$1
+ bin=$1
+ elif bin=$(type -P $1); then
+ :
else
- prog=$(type -P $1) && echo -e "$1 => $prog\n"
+ # maybe its a lib?
+ for dir in /lib /usr/lib; do
+ if [[ -f $dir/$1 ]]; then
+ bin=$dir/$1
+ break
+ fi
+ done
+ fi
+
+ if [[ $bin && $1 != $bin ]]; then
+ printf '%s => %s\n\n' "$1" "$bin"
fi
- [[ -z $prog ]] && { echo "error: binary not found: $1"; return 1; }
- objdump -p "$prog" | awk '/NEEDED/ { print $2 }'
+ [[ -z $bin ]] && { echo "error: binary not found: $1"; return 1; }
+ objdump -p "$bin" | awk '/NEEDED/ { print $2 }'
}
depscan() {

0 comments on commit 7f26663

Please sign in to comment.