]> mj.ucw.cz Git - nwho.git/blobdiff - nwho.c
Oops, forgot to commit recent changes...
[nwho.git] / nwho.c
diff --git a/nwho.c b/nwho.c
index f9e16393a0b9ec5a5d45acf9c6eb6bc5dcf82fb3..94a07fe9a9054d63ec5fee1c9b2bd9db2c63c1ee 100644 (file)
--- a/nwho.c
+++ b/nwho.c
@@ -58,7 +58,7 @@ show_uptime(char *name, struct rywho_pkt *p)
       int l = ntohl(p->avl[i]);
       printf(" %2d.%02d", l/100, l%100);
     }
-  putchar('\n');
+  printf(" %3d users\n", (int) ntohl(p->num_users));
 }
 
 static void
@@ -71,7 +71,7 @@ show_users(char *name, struct rywho_pkt *p)
   for(u=0; u<m; u++)
     {
       i = &p->users[u];
-      printf("%-8s %-3s %c %-16s ", i->name, i->con, (i->mesg_y ? ' ' : '-'), name);
+      printf("%-8.8s %-3s %c %-16s ", i->name, i->con, (i->mesg_y ? ' ' : '-'), name);
       puttime(ntohl(i->login_time));
       putchar(' ');
       puttime(ntohl(i->idle_time));
@@ -112,7 +112,7 @@ scan(void)
          }
        r = read(fd, &pkt, sizeof(pkt));
        close(fd);
-       if (r <= sizeof(struct rywho_pkt) - MAX_USERS*sizeof(struct userinfo)
+       if (r < sizeof(struct rywho_pkt) - MAX_USERS*sizeof(struct userinfo)
            || r != sizeof(struct rywho_pkt) - (MAX_USERS - ntohl(pkt.num_users))*sizeof(struct userinfo))
          {
            fprintf(stderr, "%s: Malformed record\n", e->d_name);