diff options
-rw-r--r-- | gnu/usr.bin/ld/ldd/ldd.1 | 13 | ||||
-rw-r--r-- | gnu/usr.bin/ld/ldd/ldd.c | 23 | ||||
-rw-r--r-- | usr.bin/ldd/ldd.1 | 13 | ||||
-rw-r--r-- | usr.bin/ldd/ldd.c | 23 |
4 files changed, 64 insertions, 8 deletions
diff --git a/gnu/usr.bin/ld/ldd/ldd.1 b/gnu/usr.bin/ld/ldd/ldd.1 index 0c3b5e4..8253470 100644 --- a/gnu/usr.bin/ld/ldd/ldd.1 +++ b/gnu/usr.bin/ld/ldd/ldd.1 @@ -6,7 +6,8 @@ .Nd list dynamic object dependencies .Sh SYNOPSIS .Nm ldd -.Op Ar filename Ar ... +.Op Fl f Ar format +.Ar program ... .Sh DESCRIPTION .Nm ldd displays all shared objects that are needed to run the given program. @@ -14,6 +15,16 @@ Contrary to nm(1), the list includes .Dq indirect depedencies that are the result of needed shared objects which themselves depend on yet other shared objects. +.Pp +Zero, one or two +.Fl f +options may be given. The argument is a format string passed to +.Xr rtld 1 +and allows customization of +.Nm ldd Ns 's +output. See +.Xr rtld 1 +for a list of recognised conversion characters. .Sh SEE ALSO .Xr ld 1 , .Xr ld.so 1 , diff --git a/gnu/usr.bin/ld/ldd/ldd.c b/gnu/usr.bin/ld/ldd/ldd.c index 2f54806..79a229b 100644 --- a/gnu/usr.bin/ld/ldd/ldd.c +++ b/gnu/usr.bin/ld/ldd/ldd.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: ldd.c,v 1.4 1994/06/15 22:41:03 rich Exp $ + * $Id: ldd.c,v 1.5 1994/12/23 22:31:31 nate Exp $ */ #include <sys/types.h> @@ -58,11 +58,20 @@ main(argc, argv) int argc; char *argv[]; { + char *fmt1 = NULL, *fmt2 = NULL; int rval; int c; - while ((c = getopt(argc, argv, "")) != EOF) { + while ((c = getopt(argc, argv, "f:")) != EOF) { switch (c) { + case 'f': + if (fmt1) { + if (fmt2) + errx(1, "Too many formats"); + fmt2 = optarg; + } else + fmt1 = optarg; + break; default: usage(); /*NOTREACHED*/ @@ -78,6 +87,10 @@ char *argv[]; /* ld.so magic */ setenv("LD_TRACE_LOADED_OBJECTS", "", 1); + if (fmt1) + setenv("LD_TRACE_LOADED_OBJECTS_FMT1", fmt1, 1); + if (fmt2) + setenv("LD_TRACE_LOADED_OBJECTS_FMT2", fmt2, 1); rval = 0; while (argc--) { @@ -106,7 +119,11 @@ char *argv[]; } (void)close(fd); - printf("%s:\n", *argv); + setenv("LD_TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1); + if (fmt1 == NULL && fmt2 == NULL) + /* Default formats */ + printf("%s:\n", *argv); + fflush(stdout); switch (fork()) { diff --git a/usr.bin/ldd/ldd.1 b/usr.bin/ldd/ldd.1 index 0c3b5e4..8253470 100644 --- a/usr.bin/ldd/ldd.1 +++ b/usr.bin/ldd/ldd.1 @@ -6,7 +6,8 @@ .Nd list dynamic object dependencies .Sh SYNOPSIS .Nm ldd -.Op Ar filename Ar ... +.Op Fl f Ar format +.Ar program ... .Sh DESCRIPTION .Nm ldd displays all shared objects that are needed to run the given program. @@ -14,6 +15,16 @@ Contrary to nm(1), the list includes .Dq indirect depedencies that are the result of needed shared objects which themselves depend on yet other shared objects. +.Pp +Zero, one or two +.Fl f +options may be given. The argument is a format string passed to +.Xr rtld 1 +and allows customization of +.Nm ldd Ns 's +output. See +.Xr rtld 1 +for a list of recognised conversion characters. .Sh SEE ALSO .Xr ld 1 , .Xr ld.so 1 , diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 2f54806..79a229b 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: ldd.c,v 1.4 1994/06/15 22:41:03 rich Exp $ + * $Id: ldd.c,v 1.5 1994/12/23 22:31:31 nate Exp $ */ #include <sys/types.h> @@ -58,11 +58,20 @@ main(argc, argv) int argc; char *argv[]; { + char *fmt1 = NULL, *fmt2 = NULL; int rval; int c; - while ((c = getopt(argc, argv, "")) != EOF) { + while ((c = getopt(argc, argv, "f:")) != EOF) { switch (c) { + case 'f': + if (fmt1) { + if (fmt2) + errx(1, "Too many formats"); + fmt2 = optarg; + } else + fmt1 = optarg; + break; default: usage(); /*NOTREACHED*/ @@ -78,6 +87,10 @@ char *argv[]; /* ld.so magic */ setenv("LD_TRACE_LOADED_OBJECTS", "", 1); + if (fmt1) + setenv("LD_TRACE_LOADED_OBJECTS_FMT1", fmt1, 1); + if (fmt2) + setenv("LD_TRACE_LOADED_OBJECTS_FMT2", fmt2, 1); rval = 0; while (argc--) { @@ -106,7 +119,11 @@ char *argv[]; } (void)close(fd); - printf("%s:\n", *argv); + setenv("LD_TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1); + if (fmt1 == NULL && fmt2 == NULL) + /* Default formats */ + printf("%s:\n", *argv); + fflush(stdout); switch (fork()) { |