--- netkit-rwho-0.15/ruptime/ruptime.c.alpha Sun Aug 1 16:44:17 1999
+++ netkit-rwho-0.15/ruptime/ruptime.c Thu Aug 26 16:06:43 1999
@@ -91,7 +91,7 @@
struct dirent *dp;
int aflg, cc, ch, f, maxloadav;
unsigned i;
- char buf[sizeof(struct whod)];
+ struct whod buf;
int (*cmp)(const void *, const void *) = hscmp;
time_t correction;
@@ -134,7 +134,7 @@
dp->d_name, strerror(errno));
continue;
}
- cc = read(f, buf, sizeof(struct whod));
+ cc = read(f, &buf, sizeof(buf));
(void)close(f);
if (cc < WHDRSIZE)
continue;
@@ -142,7 +142,7 @@
morehosts();
hsp = hs + nhosts;
}
- wd = (struct whod *)buf;
+ wd = &buf;
snprintf(hsp->hs_hostname, sizeof(hsp->hs_hostname),
"%s", wd->wd_hostname);
/*
@@ -168,7 +168,8 @@
for (i = 0; i < 2; i++)
if (wd->wd_loadav[i] > maxloadav)
maxloadav = wd->wd_loadav[i];
- we = (struct whoent *)(buf+cc);
+ cc -= WHDRSIZE;
+ we = &buf.wd_we[cc/sizeof(buf.wd_we[0])];
while (--we >= wd->wd_we)
if (aflg || we->we_idle < 3600)
hsp->hs_nusers++;
--- netkit-rwho-0.15/rwho/Makefile.alpha Sun Aug 1 02:00:13 1999
+++ netkit-rwho-0.15/rwho/Makefile Thu Aug 26 15:59:23 1999
@@ -3,8 +3,6 @@
include ../MCONFIG
include ../MRULES
-CFLAGS += -I../include
-
rwho: rwho.o
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
--- netkit-rwho-0.15/rwhod/rwhod.c.alpha Sun Aug 1 17:03:21 1999
+++ netkit-rwho-0.15/rwhod/rwhod.c Thu Aug 26 15:59:23 1999
@@ -106,7 +106,7 @@
struct neighbor {
struct neighbor *n_next;
char *n_name; /* interface name */
- char *n_addr; /* who to send to */
+ struct in_addr *n_addr; /* who to send to */
int n_addrlen; /* size of address */
int n_flags; /* should forward?, interface flags */
};
@@ -219,7 +219,7 @@
for (;;) {
struct whod wd;
int cc, whod;
- size_t len = sizeof(from);
+ int len = sizeof(from);
memset(&wd, 0, sizeof(wd));
cc = recvfrom(sk, (char *)&wd, sizeof(struct whod), 0,
@@ -495,15 +495,15 @@
static int
configure(int s)
{
- char buf[BUFSIZ], *cp, *cplim;
+ struct ifreq buf[BUFSIZ/sizeof(struct ifreq)];
+ struct ifreq ifreq, *cp, *cplim, *ifr;
struct ifconf ifc;
- struct ifreq ifreq, *ifr;
struct sockaddr_in *sn;
register struct neighbor *np;
ifc.ifc_len = sizeof (buf);
- ifc.ifc_buf = buf;
- if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) {
+ ifc.ifc_buf = (char *)buf;
+ if (ioctl(s, SIOCGIFCONF, &ifc) < 0) {
syslog(LOG_ERR, "ioctl (get interface configuration)");
return (0);
}
@@ -514,10 +514,9 @@
#else
#define size(p) (sizeof (p))
#endif
- cplim = buf + ifc.ifc_len; /*skip over if's with big ifr_addr's */
- for (cp = buf; cp < cplim;
- cp += sizeof (ifr->ifr_name) + size(ifr->ifr_addr)) {
- ifr = (struct ifreq *)cp;
+ cplim = buf + ifc.ifc_len/sizeof( *cplim); /*skip over if's with big ifr_addr's */
+ for (cp = buf; cp < cplim; ++cp) {
+ ifr = cp;
for (np = neighbors; np != NULL; np = np->n_next)
if (np->n_name &&
strcmp(ifr->ifr_name, np->n_name) == 0)
@@ -541,8 +540,8 @@
free((char *)np);
continue;
}
- bcopy((char *)&ifr->ifr_addr, np->n_addr, np->n_addrlen);
- if (ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0) {
+ bcopy(&ifr->ifr_addr, np->n_addr, np->n_addrlen);
+ if (ioctl(s, SIOCGIFFLAGS, &ifreq) < 0) {
syslog(LOG_ERR, "ioctl (get interface flags)");
free((char *)np);
continue;
@@ -554,7 +553,7 @@
}
np->n_flags = ifreq.ifr_flags;
if (np->n_flags & IFF_POINTOPOINT) {
- if (ioctl(s, SIOCGIFDSTADDR, (char *)&ifreq) < 0) {
+ if (ioctl(s, SIOCGIFDSTADDR, &ifreq) < 0) {
syslog(LOG_ERR, "ioctl (get dstaddr)");
free(np);
continue;
@@ -568,7 +567,7 @@
np->n_addr, np->n_addrlen);
}
if (np->n_flags & IFF_BROADCAST) {
- if (ioctl(s, SIOCGIFBRDADDR, (char *)&ifreq) < 0) {
+ if (ioctl(s, SIOCGIFBRDADDR, &ifreq) < 0) {
syslog(LOG_ERR, "ioctl (get broadaddr)");
free(np);
continue;