changeset 69550:cd511b21f729

(x_display_ok): New function.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 18 Mar 2006 13:48:57 +0000
parents 8214188f641e
children 78c97c8a8483
files src/xterm.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Sat Mar 18 13:48:33 2006 +0000
+++ b/src/xterm.c	Sat Mar 18 13:48:57 2006 +0000
@@ -10116,6 +10116,24 @@
   *bits = nr;
 }
 
+int
+x_display_ok (display)
+    const char * display;
+{
+    int dpy_ok = 1;
+    Display *dpy;
+    char *display_name = display || getenv("DISPLAY");
+
+    if (!display_name)
+      return 0;
+
+    if ((dpy = XOpenDisplay (display)))
+      XCloseDisplay (dpy);
+    else
+      dpy_ok = 0;
+    return dpy_ok;
+}
+
 struct x_display_info *
 x_term_init (display_name, xrm_option, resource_name)
      Lisp_Object display_name;