Skip to content

Instantly share code, notes, and snippets.

@PuercoPop
Created July 29, 2015 22:42
Show Gist options
  • Select an option

  • Save PuercoPop/be774f6e3d7f33c0ac64 to your computer and use it in GitHub Desktop.

Select an option

Save PuercoPop/be774f6e3d7f33c0ac64 to your computer and use it in GitHub Desktop.
xcb tripping on unix sockets filename as hostname
/*
Testing if "private/tmp/com.apple.launchd.EauNyeZmg1/org.macosforge.xquartz" is a valid display name
For more information see:
- http://www.x.org/releases/current/doc/libX11/libX11/libX11.html#XOpenDisplay
- http://cgit.freedesktop.org/~chr/libxcb/tree/src/xcb_util.c
*/
#include <stdio.h>
#include <xcb/xcbext.h>
int
main(argv, argc) {
char *display_name = "private/tmp/com.apple.launchd.EauNyeZmg1/org.macosforge.xquartz";
char *host;
int n = 0;
int *screenp = NULL;
// screenp
xcb_parse_display(display_name, &host, &n, screenp);
printf("display_name: %s\n", display_name);
printf("host: %s\n", host);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment