diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-16 09:53:35 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-16 09:53:35 (GMT) |
commit | 61765e0aaae479b94a3fddd01e4e12eae76bb8da (patch) | |
tree | 4c00c5555c77d70db6bd8cae2768d365d12c6702 /commands/helpers/find-free-display.c | |
parent | 76d6fad87094008bc25e3b4e090fb79631414fec (diff) |
Move the remaining scripts to commands
Diffstat (limited to 'commands/helpers/find-free-display.c')
-rw-r--r-- | commands/helpers/find-free-display.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/commands/helpers/find-free-display.c b/commands/helpers/find-free-display.c new file mode 100644 index 0000000..4a07131 --- /dev/null +++ b/commands/helpers/find-free-display.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <X11/extensions/Xrandr.h> + +int main(int argc, char **argv) +{ + int port; + + for (port = 99; port < 1000; port++) { + char display_name[255]; + + sprintf(display_name, ":%d", port); + Display *dpy = XOpenDisplay(display_name); + + if (!dpy) { + printf(display_name); + return 0; + } else { + XCloseDisplay(dpy); + } + } + + printf("No free display found"); + + return 0; +} |