#include #include #include "lx.h" #include "proto.h" #include "internal.h" typedef struct priv_QueryKeymap PRIV_QueryKeymap; struct priv_QueryKeymap { unsigned char *statep; } ; static void done_QueryKeymap(LX_OP *op, const unsigned char *rep, void *pv) { PRIV_QueryKeymap *p; p = pv; do <"ret"> { if (r_card32(rep+4) != 2) { lx__protoerr(op->conn,"QueryKeymap response length wrong (%u, expecting 2)",r_card32(rep+4)); break <"ret">; } if (p->statep) bcopy(rep+8,p->statep,32); } while (0); free(p); } LX_OP *lx_QueryKeymap(LX_CONN *xc, unsigned char *statep) { unsigned char req[8]; PRIV_QueryKeymap *p; if (xc->flags & XCF_FAIL) { lx__bad_call(xc,"lx_QueryKeymap"); return(0); } lx__nochain(xc); p = malloc(sizeof(PRIV_QueryKeymap)); if (! p) { lx__nomem_fail(xc); return(0); } p->statep = statep; req[0] = XP_REQ_QueryKeymap; req[1] = 0; w_card16(&req[2],1); return(lx__expect_reply(xc,&req[0],-1,&done_QueryKeymap,p)); }