Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/ldd/ldd_elf Fix default format so that not to print ...



details:   https://anonhg.NetBSD.org/src/rev/d4c884b95630
branches:  trunk
changeset: 569813:d4c884b95630
user:      enami <enami%NetBSD.org@localhost>
date:      Tue Sep 07 02:54:40 2004 +0000

description:
Fix default format so that not to print NULL (e.g., ldd mozilla-bin).

diffstat:

 usr.bin/ldd/ldd_elf/ldd.c |  30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diffs (48 lines):

diff -r f91fc9e776a1 -r d4c884b95630 usr.bin/ldd/ldd_elf/ldd.c
--- a/usr.bin/ldd/ldd_elf/ldd.c Tue Sep 07 02:18:06 2004 +0000
+++ b/usr.bin/ldd/ldd_elf/ldd.c Tue Sep 07 02:54:40 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldd.c,v 1.24 2004/05/23 06:51:05 skrll Exp $   */
+/*     $NetBSD: ldd.c,v 1.25 2004/09/07 02:54:40 enami Exp $   */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -255,22 +255,26 @@
        char *cp;
        int c;
 
+       if (strncmp(libname, "lib", 3) == 0 &&
+           (cp = strstr(libname, ".so")) != NULL) {
+               int i = cp - (libname + 3);
+
+               if (i >= sizeof(libnamebuf))
+                       i = sizeof(libnamebuf) - 1;
+               (void)memcpy(libnamebuf, libname + 3, i);
+               libnamebuf[i] = '\0';
+               if (cp[3] && isdigit((unsigned char)cp[4]))
+                       libmajor = &cp[4];
+               libname = libnamebuf;
+       }
+
        if (fmt1 == NULL)
-               fmt1 = "\t-l%o.%m => %p\n";
+               fmt1 = libmajor != NULL ?
+                   "\t-l%o.%m => %p\n" :
+                   "\t-l%o => %p\n";
        if (fmt2 == NULL)
                fmt2 = "\t%o => %p\n";
 
-       if (strncmp(libname, "lib", 3) == 0
-           && (cp = strstr(libname, ".so")) != NULL) {
-               int i = cp - (libname + 3);
-               if (i >= sizeof(libnamebuf))
-                       i = sizeof(libnamebuf) - 1;
-               (void)memcpy(libnamebuf, libname + 3, i);
-           libnamebuf[i] = '\0';
-           if (cp[3] && isdigit((unsigned char)cp[4]))
-                   libmajor = &cp[4];
-           libname = libnamebuf;
-       }
        fmt = libname == libnamebuf ? fmt1 : fmt2;
        while ((c = *fmt++) != '\0') {
                switch (c) {



Home | Main Index | Thread Index | Old Index