version 1.2, 1996/06/26 05:39:00 |
version 1.3, 1996/08/30 11:10:32 |
|
|
#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]; |
|
|
} 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; |
|
|
} |
} |
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); |
|
|
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); |
|
|
exit(0); |
exit(0); |
} |
} |
|
|
|
int |
utmpcmp(u1, u2) |
utmpcmp(u1, u2) |
struct myutmp *u1, *u2; |
struct myutmp *u1, *u2; |
{ |
{ |