NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/41994: ldd should have an -o option like nm



The following reply was made to PR bin/41994; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: matthew green <mrg%netbsd.org@localhost>
Subject: Re: bin/41994: ldd should have an -o option like nm
Date: Mon, 7 Sep 2009 04:52:11 +0000

 On Sat, Sep 05, 2009 at 02:40:00AM +0000, dholland%eecs.harvard.edu@localhost 
wrote:
  > ldd should have an -o option like nm's -o option. That way one could
  > do e.g. ldd -o /usr/pkg/lib/lib*.so | grep "not found" to easily
  > identify busted libs, instead of various laborious alternatives.
 
 Candidate patch based on a suggestion by jmcneill:
 
 Index: ldd.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/ldd/ldd.c,v
 retrieving revision 1.9
 diff -u -p -r1.9 ldd.c
 --- ldd.c      22 Aug 2009 06:52:16 -0000      1.9
 +++ ldd.c      7 Sep 2009 04:50:20 -0000
 @@ -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*/
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index