Skip to content

Instantly share code, notes, and snippets.

@aarzilli
Created September 18, 2014 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarzilli/fcd2a0094f89c29256a9 to your computer and use it in GitHub Desktop.
Save aarzilli/fcd2a0094f89c29256a9 to your computer and use it in GitHub Desktop.
SetupRequest conundrum
#include <stdlib.h>
#include <stdio.h>
#include "libxcb-1.11/src/xcb.h"
/*
gcc testxcb.c libxcb-1.11/src/.libs/libxcb.a -lXau; ./a.out
*/
char bytes[] = { ... capture data here...};
int main(void) {
xcb_setup_request_t *r = (xcb_setup_request_t *)bytes;
printf("name: %s (%d)\n", xcb_setup_request_authorization_protocol_name(r), xcb_setup_request_authorization_protocol_name_length(r));
char *data = xcb_setup_request_authorization_protocol_data(r);
int len = xcb_setup_request_authorization_protocol_data_length(r);
printf("data (%d):", len);
int i;
for (i = 0; i < len; ++i) {
printf(" %02x", (unsigned char)data[i]);
}
printf("\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment