|
|
BSD 4.3tahoe
#include <X/mit-copyright.h>
/* $Header: /var/lib/cvsd/repos/CSRG/43BSDTahoe/new/X/Xlib/XGetHosts.c,v 1.1.1.1 2018/04/24 16:12:58 root Exp $ */
/* Copyright Massachusetts Institute of Technology 1985 */
#include "XlibInternal.h"
struct in_addr *XGetHosts (nhosts)
int *nhosts;
{
register Display *dpy;
register XReq *req;
XRep rep;
char *buf;
int nbytes;
GetReq(X_GetHosts, 0);
req->func = XAF_INET;
if (!(_XReply (dpy, &rep)) || !(nbytes = rep.param.l[0])) {
/* error or empty list */
*nhosts = 0;
return (NULL);
}
*nhosts = nbytes / sizeof (struct in_addr);
if (!(buf = (char *) malloc (nbytes))) {
errno = ENOMEM;
_XIOError (dpy);
}
_XReadPad (dpy, buf, nbytes);
return ((struct in_addr *) buf);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.