Sun Dec 17 15:56:35 1995 Miles Bader <miles@gnu.ai.mit.edu>
[glibc.git] / elf / ldd.sh.in
blobed43789cfa52e1ef55f3f80ab808ef1275df5cb6
1 #! /bin/sh
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.
8 RTLD=@RTLD@
10 case $# in
12 echo >&2 "Usage: $0 FILE..."
13 exit 1 ;;
15 # We don't list the file name when there is only one.
16 case "$1" in
17 /*) file="$1" ;;
18 *) file="./$1" ;;
19 esac
20 exec ${RTLD} --list "$file" && exit 1
21 exit ;;
23 set -e # Bail out immediately if ${RTLD} loses on any argument.
24 for file; do
25 echo "${file}:"
26 case "$file" in
27 /*) file="$file" ;;
28 *) file="./$file" ;;
29 esac
30 ${RTLD} --list "$file"
31 done
32 esac
34 exit 0