print better error message if nlist fails
authorMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Tue, 2 Jul 1991 09:00:08 +0000 (01:00 -0800)
committerMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Tue, 2 Jul 1991 09:00:08 +0000 (01:00 -0800)
SCCS-vsn: bin/ps/nlist.c 5.5

usr/src/bin/ps/nlist.c

index 4ba1717..a749b00 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)nlist.c    5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)nlist.c    5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -57,7 +57,7 @@ donlist()
        rval = 0;
        nlistread = 1;
        if (kvm_nlist(psnl)) {
        rval = 0;
        nlistread = 1;
        if (kvm_nlist(psnl)) {
-               (void)fprintf(stderr, "ps: kvm_nlist: %s\n", kvm_geterr());
+               nlisterr(psnl);
                eval = 1;
                return(1);
        }
                eval = 1;
                return(1);
        }
@@ -87,3 +87,15 @@ donlist()
        }
        return(rval);
 }
        }
        return(rval);
 }
+
+nlisterr(nl)
+       struct nlist nl[];
+{
+       int i;
+
+       fprintf(stderr, "ps: nlist: can't find following symbols:");
+       for (i = 0; nl[i].n_name != NULL; i++)
+               if (nl[i].n_value == 0)
+                       fprintf(stderr, " %s", nl[i].n_name);
+       fprintf(stderr, "\n");
+}