rfbLog("gui not available in this program.\n");
rfbLog("gui not compiled into this program.\n");
void run_gui(char *gui_xdisplay, int connect_to_x11vnc, int simple_gui,    pid_t parent) {	char *x11vnc_xdisplay = NULL;	char extra_path[] = ":/usr/local/bin:/usr/bin/X11:/usr/sfw/bin"	    ":/usr/X11R6/bin:/usr/openwin/bin:/usr/dt/bin";	char cmd[100];	char *wish = NULL, *orig_path, *full_path, *tpath, *p;	char *old_xauth = NULL;	int try_max = 4, sleep = 300;	pid_t mypid = getpid();	FILE *pipe, *tmpf;	if (*gui_code == '\0') {		rfbLog("gui not available in this program.\n");		exit(0);	}	if (getenv("DISPLAY") != NULL) {		/* worst case */		x11vnc_xdisplay = strdup(getenv("DISPLAY"));	}	if (use_dpy) {		/* better */		x11vnc_xdisplay = strdup(use_dpy);	}	if (connect_to_x11vnc) {		int rc, i;		rfbLogEnable(0);		if (! client_connect_file) {			if (getenv("XAUTHORITY") != NULL) {				old_xauth = strdup(getenv("XAUTHORITY"));			} else {				old_xauth = strdup("");			}			dpy = XOpenDisplay(x11vnc_xdisplay); 			if (! dpy && auth_file) {				set_env("XAUTHORITY", auth_file);				dpy = XOpenDisplay(x11vnc_xdisplay);			}			if (! dpy && ! x11vnc_xdisplay) {				/* worstest case */				x11vnc_xdisplay = strdup(":0");				dpy = XOpenDisplay(x11vnc_xdisplay); 			}			if (! dpy) {				fprintf(stderr, "gui: could not open x11vnc "				    "display: %s\n", NONUL(x11vnc_xdisplay));				exit(1);			}			scr = DefaultScreen(dpy);			rootwin = RootWindow(dpy, scr);			initialize_vnc_connect_prop();		}		usleep(1000*1000);		fprintf(stderr, "\n");		for (i=0; i<try_max; i++) {			usleep(sleep*1000);			fprintf(stderr, "gui: pinging %s try=%d ...\n",			    NONUL(x11vnc_xdisplay), i+1);			rc = send_remote_cmd("qry=ping", 1, 1);			if (rc == 0) {				break;			}			if (parent && mypid != parent && kill(parent, 0) != 0) {				fprintf(stderr, "gui: parent process %d has gone"				    " away: bailing out.\n", parent);				rc = 1;				break;			}		}		set_env("X11VNC_XDISPLAY", x11vnc_xdisplay);		if (getenv("XAUTHORITY") != NULL) {			set_env("X11VNC_AUTH_FILE", getenv("XAUTHORITY"));		}		if (rc == 0) {			fprintf(stderr, "gui: ping succeeded.\n");			set_env("X11VNC_CONNECT", "1");		} else {			fprintf(stderr, "gui: could not connect to: '%s', try"			    " again manually.\n", x11vnc_xdisplay);		}		if (client_connect_file) {			set_env("X11VNC_CONNECT_FILE", client_connect_file);		}		if (dpy)  {			XCloseDisplay(dpy);			dpy = NULL;		}		if (old_xauth) {			if (*old_xauth == '\0') {				/* wasn't set, hack it out if it is now */				char *xauth = getenv("XAUTHORITY");				if (xauth) {					*(xauth-2) = '_';	/* yow */				}			} else {				set_env("XAUTHORITY", old_xauth);			}			free(old_xauth);		}	}	orig_path = getenv("PATH");	if (! orig_path) {		orig_path = strdup("/bin:/usr/bin:/usr/bin/X11");	}	full_path = (char *) malloc(strlen(orig_path)+strlen(extra_path)+1);	strcpy(full_path, orig_path);	strcat(full_path, extra_path);	tpath = strdup(full_path);	p = strtok(tpath, ":");	while (p) {		char *try;		struct stat sbuf;		char *wishes[] = {"wish", "wish8.3", "wish8.4", "wish8.5",		    "wish8.0"};		int nwishes = 3, i;		try = (char *)malloc(strlen(p) + 1 + strlen("wish8.4") + 1);		for (i=0; i<nwishes; i++) {			sprintf(try, "%s/%s", p, wishes[i]);			if (stat(try, &sbuf) == 0) {				/* assume executable, should check mode */				wish = wishes[i];			}		}		free(try);		if (wish) {			break;		}		p = strtok(NULL, ":");	}	free(tpath);	if (!wish) {		wish = strdup("wish");	}	set_env("PATH", full_path);	set_env("DISPLAY", gui_xdisplay);	set_env("X11VNC_PROG", program_name);	set_env("X11VNC_CMDLINE", program_cmdline);	if (simple_gui) {		set_env("X11VNC_SIMPLE_GUI", "1");	}	if (no_external_cmds) {		fprintf(stderr, "cannot run external commands in -nocmds "		    "mode:\n");		fprintf(stderr, "   \"%s\"\n", "gui + wish");		fprintf(stderr, "   exiting.\n");		fflush(stderr);		exit(1);	}	sprintf(cmd, "%s -", wish);	tmpf = tmpfile();	if (tmpf == NULL) {		/* if no tmpfile, use a pipe */		pipe = popen(cmd, "w");		if (! pipe) {			fprintf(stderr, "could not run: %s\n", cmd);			perror("popen");		}		fprintf(pipe, "%s", gui_code);		pclose(pipe);	} else {		/*		 * we prefer a tmpfile since then this x11vnc process		 * will then be gone, otherwise the x11vnc program text		 * will still be in use.		 */		int n = fileno(tmpf);		fprintf(tmpf, "%s", gui_code);		fflush(tmpf);		rewind(tmpf);		dup2(n, 0);		close(n);		execlp(wish, wish, "-", (char *) NULL); 		fprintf(stderr, "could not exec wish: %s -\n", wish);		perror("execlp");	}	exit(0);}