]> sourceware.org Git - glibc.git/blame - elf/ldd.sh.in
Regenerated: autoconf configure.in
[glibc.git] / elf / ldd.sh.in
CommitLineData
b122c703
RM
1#! /bin/sh
2
df4ef2ab 3# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
84384f5b
UD
4# This file is part of the GNU C Library.
5
6# The GNU C Library is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Library General Public License as
8# published by the Free Software Foundation; either version 2 of the
9# License, or (at your option) any later version.
10
11# The GNU C Library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# Library General Public License for more details.
15
16# You should have received a copy of the GNU Library General Public
17# License along with the GNU C Library; see the file COPYING.LIB. If not,
18# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19# Boston, MA 02111-1307, USA.
20
21
b122c703
RM
22# This is the `ldd' command, which lists what shared libraries are
23# used by given dynamically-linked executables. It works by invoking the
f0e44959
UD
24# run-time dynamic linker as a command and setting the environment
25# variable LD_TRACE_LOADED_OBJECTS to a non-empty value.
b122c703
RM
26
27RTLD=@RTLD@
f0e44959
UD
28
29while test $# -gt 0; do
30 case "$1" in
31 --v*)
84384f5b 32 echo 'ldd (GNU libc) @VERSION@
df4ef2ab 33Copyright (C) 1996, 1997 Free Software Foundation, Inc.
84384f5b
UD
34This is free software; see the source for copying conditions. There is NO
35warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'
36 exit 0 ;;
f0e44959 37 --h*)
df4ef2ab 38 echo "ldd [OPTION]... FILE...
84384f5b
UD
39 --help print this help and exit
40 --version print version information and exit
df4ef2ab 41Report bugs using the \`glibcbug' script to <bugs@gnu.ai.mit.edu>."
84384f5b 42 exit 0 ;;
6d52618b 43 --) # Stop option processing.
f0e44959
UD
44 shift; break ;;
45 *)
46 break ;;
47 esac
48done
b122c703
RM
49
50case $# in
510)
f0e44959
UD
52 echo >&2 "\
53ldd: missing file arguments
54Try \`ldd --help' for more information."
b122c703
RM
55 exit 1 ;;
561)
57 # We don't list the file name when there is only one.
d17e960c
RM
58 case "$1" in
59 /*) file="$1" ;;
60 *) file="./$1" ;;
61 esac
8145a974 62 if test ! -f "$file"; then
f0e44959 63 echo "${file}: no such file"
8145a974 64 elif ${RTLD} --verify "$file"; then
2de99474 65 LD_TRACE_LOADED_OBJECTS=1 exec ${RTLD} "$file" && exit 1
61965e9b
RM
66 else
67 echo ' not a dynamic executable'
68 fi
b122c703
RM
69 exit ;;
70*)
71 set -e # Bail out immediately if ${RTLD} loses on any argument.
72 for file; do
73 echo "${file}:"
d17e960c 74 case "$file" in
f0e44959 75 /*) : ;;
d17e960c
RM
76 *) file="./$file" ;;
77 esac
8145a974
UD
78 if test ! -f "$file"; then
79 echo "$file: no such file"
80 elif ${RTLD} --verify "$file"; then
2de99474 81 LD_TRACE_LOADED_OBJECTS=1 ${RTLD} "$file"
61965e9b
RM
82 else
83 echo ' not a dynamic executable'
84 fi
b122c703
RM
85 done
86esac
87
88exit 0
This page took 0.055127 seconds and 5 git commands to generate.