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