[BACK]Return to rwho.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rwho

Diff for /src/usr.bin/rwho/Attic/rwho.c between version 1.2 and 1.3

version 1.2, 1996/06/26 05:39:00 version 1.3, 1996/08/30 11:10:32
Line 50 
Line 50 
 #include <protocols/rwhod.h>  #include <protocols/rwhod.h>
 #include <stdio.h>  #include <stdio.h>
 #include <string.h>  #include <string.h>
   #include <unistd.h>
   #include <stdlib.h>
   
 DIR     *dirp;  DIR     *dirp;
   
 struct  whod wd;  struct  whod wd;
 int     utmpcmp();  
 #define NUSERS  1000  #define NUSERS  1000
 struct  myutmp {  struct  myutmp {
         char    myhost[MAXHOSTNAMELEN];          char    myhost[MAXHOSTNAMELEN];
Line 63 
Line 64 
 } myutmp[NUSERS];  } myutmp[NUSERS];
 int     nusers;  int     nusers;
   
   int     utmpcmp __P((struct myutmp *, struct myutmp *));
   
 #define WHDRSIZE        (sizeof (wd) - sizeof (wd.wd_we))  #define WHDRSIZE        (sizeof (wd) - sizeof (wd.wd_we))
 /*  /*
  * this macro should be shared with ruptime.   * this macro should be shared with ruptime.
  */   */
 #define down(w,now)     ((now) - (w)->wd_recvtime > 11 * 60)  #define down(w,now)     ((now) - (w)->wd_recvtime > 11 * 60)
   
 char    *ctime(), *strcpy();  char    *ctime();
 time_t  now;  time_t  now;
 int     aflg;  int     aflg;
   
   int
 main(argc, argv)  main(argc, argv)
         int argc;          int argc;
         char **argv;          char **argv;
Line 104 
Line 108 
         }          }
         mp = myutmp;          mp = myutmp;
         (void)time(&now);          (void)time(&now);
         while (dp = readdir(dirp)) {          while ((dp = readdir(dirp))) {
                 if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5))                  if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5))
                         continue;                          continue;
                 f = open(dp->d_name, O_RDONLY);                  f = open(dp->d_name, O_RDONLY);
Line 131 
Line 135 
                                 exit(1);                                  exit(1);
                         }                          }
                         mp->myutmp = we->we_utmp; mp->myidle = we->we_idle;                          mp->myutmp = we->we_utmp; mp->myidle = we->we_idle;
                         (void) strcpy(mp->myhost, w->wd_hostname);                          (void) strncpy(mp->myhost, w->wd_hostname,
                               sizeof(mp->myhost)-1);
                           mp->myhost[sizeof(mp->myhost)-1] = '\0';
                         nusers++; we++; mp++;                          nusers++; we++; mp++;
                 }                  }
                 (void) close(f);                  (void) close(f);
Line 173 
Line 179 
         exit(0);          exit(0);
 }  }
   
   int
 utmpcmp(u1, u2)  utmpcmp(u1, u2)
         struct myutmp *u1, *u2;          struct myutmp *u1, *u2;
 {  {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3