|
|
1.1 root 1: #include <X/mit-copyright.h>
2:
3: /* $Header: XGetHosts.c,v 10.4 86/02/01 15:35:02 tony Rel $ */
4: /* Copyright Massachusetts Institute of Technology 1985 */
5:
6: #include "XlibInternal.h"
7: struct in_addr *XGetHosts (nhosts)
8: int *nhosts;
9: {
10: register Display *dpy;
11: register XReq *req;
12: XRep rep;
13: char *buf;
14: int nbytes;
15:
16: GetReq(X_GetHosts, 0);
17: req->func = XAF_INET;
18: if (!(_XReply (dpy, &rep)) || !(nbytes = rep.param.l[0])) {
19: /* error or empty list */
20: *nhosts = 0;
21: return (NULL);
22: }
23: *nhosts = nbytes / sizeof (struct in_addr);
24: if (!(buf = (char *) malloc (nbytes))) {
25: errno = ENOMEM;
26: _XIOError (dpy);
27: }
28: _XReadPad (dpy, buf, nbytes);
29: return ((struct in_addr *) buf);
30: }
31:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.