diff options
author | obrien <obrien@FreeBSD.org> | 2002-02-17 07:04:32 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-02-17 07:04:32 +0000 |
commit | 77f77a885c6ecd4289ef689cfd206aabb1fbf5a7 (patch) | |
tree | 1a80ae19e44db239fd35cf2efcadb5a2847964a9 /usr.bin/ldd/ldd.c | |
parent | 8c6ee7cab4c4f47c5652ca5fd0f54eadef837ecf (diff) | |
download | FreeBSD-src-77f77a885c6ecd4289ef689cfd206aabb1fbf5a7.zip FreeBSD-src-77f77a885c6ecd4289ef689cfd206aabb1fbf5a7.tar.gz |
Add support such that if LD_TRACE_LOADED_OBJECTS_ALL is defined to a
non-empty string in the environment; we indicate which objects caused
each object to be loaded.
PR: 30908
Submitted-by: Mike Meyer <mwm@mired.org>
Diffstat (limited to 'usr.bin/ldd/ldd.c')
-rw-r--r-- | usr.bin/ldd/ldd.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index fc20467..19db2f1 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -49,7 +49,7 @@ extern int error_count; void usage() { - fprintf(stderr, "usage: ldd [-v] [-f format] program ...\n"); + fprintf(stderr, "usage: ldd [-a] [-v] [-f format] program ...\n"); exit(1); } @@ -61,10 +61,15 @@ char *argv[]; char *fmt1 = NULL, *fmt2 = NULL; int rval; int c; - int vflag = 0; + int aflag, vflag; - while ((c = getopt(argc, argv, "vf:")) != -1) { + aflag = vflag = 0; + + while ((c = getopt(argc, argv, "avf:")) != -1) { switch (c) { + case 'a': + aflag++; + break; case 'v': vflag++; break; @@ -101,7 +106,7 @@ char *argv[]; #endif /* ld.so magic */ - setenv("LD_TRACE_LOADED_OBJECTS", "1", 1); + setenv("LD_TRACE_LOADED_OBJECTS", "yes", 1); if (fmt1) setenv("LD_TRACE_LOADED_OBJECTS_FMT1", fmt1, 1); if (fmt2) @@ -190,7 +195,8 @@ char *argv[]; } setenv("LD_TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1); - if (fmt1 == NULL && fmt2 == NULL) + if (aflag) setenv("LD_TRACE_LOADED_OBJECTS_ALL", "1", 1); + else if (fmt1 == NULL && fmt2 == NULL) /* Default formats */ printf("%s:\n", *argv); |