#!/usr/bin/perl -w use strict; use Inline(C => Config => INC => '-I/usr/local/include', AUTO_INCLUDE => '#include <X11/Xlib.h>', LIBS => '-L/usr/X11R6/lib -lX11', CCFLAGS => '-O2' ); use Inline C => <<'END_OF_C_CODE'; int isXRunning() { Display* display; char* displayName; int retval = 0; displayName = getenv("DISPLAY"); if (!displayName) { displayName = "localhost:0"; } display = XOpenDisplay(displayName); if (display) { XCloseDisplay(display); retval = 1; } return retval; } END_OF_C_CODE print isXRunning() ? "X is running\n" : "What X?\n";
In reply to Re: Checking X server status
by bikeNomad
in thread Checking X server status
by mr_dont
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |