]>
Commit | Line | Data |
---|---|---|
b122c703 RM |
1 | #! /bin/sh |
2 | ||
3 | # This is the `ldd' command, which lists what shared libraries are | |
4 | # used by given dynamically-linked executables. It works by invoking the | |
5 | # run-time dynamic linker as a command and giving it the special `--list' | |
6 | # switch. | |
7 | ||
8 | RTLD=@RTLD@ | |
9 | ||
10 | case $# in | |
11 | 0) | |
12 | echo >&2 "Usage: $0 FILE..." | |
13 | exit 1 ;; | |
14 | 1) | |
15 | # We don't list the file name when there is only one. | |
d17e960c RM |
16 | case "$1" in |
17 | /*) file="$1" ;; | |
18 | *) file="./$1" ;; | |
19 | esac | |
20 | exec ${RTLD} --list "$file" && exit 1 | |
b122c703 RM |
21 | exit ;; |
22 | *) | |
23 | set -e # Bail out immediately if ${RTLD} loses on any argument. | |
24 | for file; do | |
25 | echo "${file}:" | |
d17e960c RM |
26 | case "$file" in |
27 | /*) file="$file" ;; | |
28 | *) file="./$file" ;; | |
29 | esac | |
b122c703 RM |
30 | ${RTLD} --list "$file" |
31 | done | |
32 | esac | |
33 | ||
34 | exit 0 |