=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rwho/Attic/rwho.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** src/usr.bin/rwho/Attic/rwho.c 1996/06/26 05:39:00 1.2 --- src/usr.bin/rwho/Attic/rwho.c 1996/08/30 11:10:32 1.3 *************** *** 1,4 **** ! /* $OpenBSD: rwho.c,v 1.2 1996/06/26 05:39:00 deraadt Exp $ */ /* * Copyright (c) 1983 The Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: rwho.c,v 1.3 1996/08/30 11:10:32 deraadt Exp $ */ /* * Copyright (c) 1983 The Regents of the University of California. *************** *** 41,47 **** #ifndef lint /*static char sccsid[] = "from: @(#)rwho.c 5.5 (Berkeley) 6/1/90";*/ ! static char rcsid[] = "$OpenBSD: rwho.c,v 1.2 1996/06/26 05:39:00 deraadt Exp $"; #endif /* not lint */ #include --- 41,47 ---- #ifndef lint /*static char sccsid[] = "from: @(#)rwho.c 5.5 (Berkeley) 6/1/90";*/ ! static char rcsid[] = "$OpenBSD: rwho.c,v 1.3 1996/08/30 11:10:32 deraadt Exp $"; #endif /* not lint */ #include *************** *** 50,60 **** #include #include #include DIR *dirp; struct whod wd; - int utmpcmp(); #define NUSERS 1000 struct myutmp { char myhost[MAXHOSTNAMELEN]; --- 50,61 ---- #include #include #include + #include + #include DIR *dirp; struct whod wd; #define NUSERS 1000 struct myutmp { char myhost[MAXHOSTNAMELEN]; *************** *** 63,78 **** } myutmp[NUSERS]; int nusers; #define WHDRSIZE (sizeof (wd) - sizeof (wd.wd_we)) /* * this macro should be shared with ruptime. */ #define down(w,now) ((now) - (w)->wd_recvtime > 11 * 60) ! char *ctime(), *strcpy(); time_t now; int aflg; main(argc, argv) int argc; char **argv; --- 64,82 ---- } myutmp[NUSERS]; int nusers; + int utmpcmp __P((struct myutmp *, struct myutmp *)); + #define WHDRSIZE (sizeof (wd) - sizeof (wd.wd_we)) /* * this macro should be shared with ruptime. */ #define down(w,now) ((now) - (w)->wd_recvtime > 11 * 60) ! char *ctime(); time_t now; int aflg; + int main(argc, argv) int argc; char **argv; *************** *** 104,110 **** } mp = myutmp; (void)time(&now); ! while (dp = readdir(dirp)) { if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5)) continue; f = open(dp->d_name, O_RDONLY); --- 108,114 ---- } mp = myutmp; (void)time(&now); ! while ((dp = readdir(dirp))) { if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5)) continue; f = open(dp->d_name, O_RDONLY); *************** *** 131,137 **** exit(1); } mp->myutmp = we->we_utmp; mp->myidle = we->we_idle; ! (void) strcpy(mp->myhost, w->wd_hostname); nusers++; we++; mp++; } (void) close(f); --- 135,143 ---- exit(1); } mp->myutmp = we->we_utmp; mp->myidle = we->we_idle; ! (void) strncpy(mp->myhost, w->wd_hostname, ! sizeof(mp->myhost)-1); ! mp->myhost[sizeof(mp->myhost)-1] = '\0'; nusers++; we++; mp++; } (void) close(f); *************** *** 173,178 **** --- 179,185 ---- exit(0); } + int utmpcmp(u1, u2) struct myutmp *u1, *u2; {