diff --git a/usr.bin/ldd/ldd.1 b/usr.bin/ldd/ldd.1 index e49101ef2c31..b4ba7a1b9bb1 100644 --- a/usr.bin/ldd/ldd.1 +++ b/usr.bin/ldd/ldd.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: ldd.1,v 1.16 2009/08/23 15:37:39 wiz Exp $ +.\" $NetBSD: ldd.1,v 1.17 2009/09/07 17:56:52 dholland Exp $ .\" .\" Copyright (c) 1998 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd August 23, 2009 +.Dd September 7, 2009 .Dt LDD 1 .Os .Sh NAME @@ -35,6 +35,7 @@ .Nd list dynamic object dependencies .Sh SYNOPSIS .Nm +.Op Fl o .Op Fl f Ar format .Ar program ... .Sh DESCRIPTION @@ -93,6 +94,16 @@ Additionally, and .Sy \et are recognized and have their usual meaning. +.Pp +The +.Fl o +option is an alias for +.Fl f +.Ar \&%a:-l\&%o.\&%m =\*[Gt] \&%p\en , +which makes +.Nm +behave analogously to +.Ic nm Fl o . .Sh SEE ALSO .Xr ld 1 , .Xr ld.elf_so 1 , diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 18802d5a6110..44fd408fe2f7 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -1,4 +1,4 @@ -/* $NetBSD: ldd.c,v 1.9 2009/08/22 06:52:16 mrg Exp $ */ +/* $NetBSD: ldd.c,v 1.10 2009/09/07 17:56:52 dholland Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ldd.c,v 1.9 2009/08/22 06:52:16 mrg Exp $"); +__RCSID("$NetBSD: ldd.c,v 1.10 2009/09/07 17:56:52 dholland Exp $"); #endif /* not lint */ #include @@ -114,13 +114,13 @@ usage(void) int main(int argc, char **argv) { - char *fmt1 = NULL, *fmt2 = NULL; + const char *fmt1 = NULL, *fmt2 = NULL; int c; #ifdef DEBUG debug = 1; #endif - while ((c = getopt(argc, argv, "f:")) != -1) { + while ((c = getopt(argc, argv, "f:o")) != -1) { switch (c) { case 'f': if (fmt1) { @@ -130,6 +130,11 @@ main(int argc, char **argv) } else fmt1 = optarg; break; + case 'o': + if (fmt1 || fmt2) + errx(1, "Cannot use -o and -f together"); + fmt1 = "%a:-l%o.%m => %p\n"; + break; default: usage(); /*NOTREACHED*/