change devname(3) to return NULL on error
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sun, 30 Apr 1995 02:50:50 +0000 (18:50 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sun, 30 Apr 1995 02:50:50 +0000 (18:50 -0800)
SCCS-vsn: usr.bin/systat/swap.c 8.3

usr/src/usr.bin/systat/swap.c

index 3ca06b2..21b36c8 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)swap.c     8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)swap.c     8.3 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -29,7 +29,6 @@ static char sccsid[] = "@(#)swap.c    8.2 (Berkeley) %G%";
 #include "systat.h"
 #include "extern.h"
 
 #include "systat.h"
 #include "extern.h"
 
-extern char *devname __P((int, int));
 extern char *getbsize __P((int *headerlenp, long *blocksizep));
 void showspace __P((char *header, int hlen, long blocksize));
 
 extern char *getbsize __P((int *headerlenp, long *blocksizep));
 void showspace __P((char *header, int hlen, long blocksize));
 
@@ -173,7 +172,7 @@ fetchswap()
 void
 labelswap()
 {
 void
 labelswap()
 {
-       char *header;
+       char *header, *p;
        int row, i;
 
        row = 0;
        int row, i;
 
        row = 0;
@@ -183,8 +182,8 @@ labelswap()
            "Disk", hlen, header, "Used",
            "/0%  /10% /20% /30% /40% /50% /60% /70% /80% /90% /100%");
        for (i = 0; i < nswdev; i++) {
            "Disk", hlen, header, "Used",
            "/0%  /10% /20% /30% /40% /50% /60% /70% /80% /90% /100%");
        for (i = 0; i < nswdev; i++) {
-               mvwprintw(wnd, i + 1, 0, "%-5s",
-                   devname(sw[i].sw_dev, S_IFBLK));
+               p = devname(sw[i].sw_dev, S_IFBLK);
+               mvwprintw(wnd, i + 1, 0, "%-5s", p == NULL ? "??" : p);
        }
 }
 
        }
 }