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