1: #include <X/mit-copyright.h> 2: 3: /* $Header: XGetColor.c,v 10.4 86/02/01 15:34:38 tony Rel $ */ 4: /* Copyright Massachusetts Institute of Technology 1985 */ 5: 6: #include "XlibInternal.h" 7: 8: Status XGetColor (name, hard_def, exact_def) 9: char *name; 10: register Color *exact_def, *hard_def; 11: { 12: register Display *dpy; 13: register XReq *req; 14: XRep rep; 15: int namelen = strlen (name); 16: 17: GetReq (X_LookupColor, 0); 18: req->param.s[0] = namelen; 19: Data (dpy, name, namelen); 20: if (!_XReply (dpy, &rep)) 21: return (0); 22: 23: exact_def->red = rep.param.u[0]; 24: exact_def->green = rep.param.u[1]; 25: exact_def->blue = rep.param.u[2]; 26: 27: GetReq (X_GetColor, 0); 28: hard_def->red = req->param.s[0] = rep.param.u[3]; 29: hard_def->green = req->param.s[1] = rep.param.u[4]; 30: hard_def->blue = req->param.s[2] = rep.param.u[5]; 31: if (!_XReply (dpy, &rep)) 32: return (0); 33: 34: hard_def->pixel = exact_def->pixel = rep.param.u[0]; 35: return (1); 36: }