1: #include <X/mit-copyright.h> 2: 3: /* $Header: XGetNodes.c,v 10.2 86/02/01 15:35:11 tony Rel $ */ 4: /* Copyright Massachusetts Institute of Technology 1985 */ 5: 6: #include "XlibInternal.h" 7: #ifdef DNETCONN 8: #include <netdnet/dn.h> 9: #endif 10: 11: struct dn_naddr *XGetNodes (nnodes) 12: int *nnodes; 13: { 14: #ifdef DNETCONN 15: register Display *dpy; 16: register XReq *req; 17: XRep rep; 18: char *buf; 19: int nbytes; 20: 21: GetReq(X_GetHosts, 0); 22: req->func = XAF_DECnet; 23: if (!(_XReply (dpy, &rep)) || !(nbytes = rep.param.l[0])) { 24: /* error or empty list */ 25: *nnodes = 0; 26: return (NULL); 27: } 28: *nnodes = nbytes / sizeof (struct dn_naddr); 29: if (!(buf = (char *) malloc (nbytes))) { 30: errno = ENOMEM; 31: _XIOError (dpy); 32: } 33: _XReadPad (dpy, buf, nbytes); 34: return ((struct dn_naddr *) buf); 35: #endif 36: }