run_gui(gui_xdisplay, connect_to_x11vnc);
run_gui(gui_xdisplay, connect_to_x11vnc, 0);
void do_gui(char *opts) {	char *s, *p;	char *old_xauth = NULL;	char *gui_xdisplay = NULL;	int start_x11vnc = 1;	int connect_to_x11vnc = 0;	Display *test_dpy;	if (*gui_code == '\0') {		rfbLog("gui not available in this program.\n");		clean_up_exit(1);	}	if (opts) {		s = strdup(opts);	} else {		s = strdup("");	}	if (use_dpy) {		/* worst case */		gui_xdisplay = strdup(use_dpy);			}	if (getenv("DISPLAY") != NULL) {		/* better */		gui_xdisplay = strdup(getenv("DISPLAY"));	}	p = strtok(s, ",");	while(p) {		if (*p == '\0') {			;		} else if (strchr(p, ':') != NULL) {			/* best */			gui_xdisplay = strdup(p);		} else if (!strcmp(p, "wait")) {			start_x11vnc = 0;			connect_to_x11vnc = 0;		} else if (!strcmp(p, "conn") || !strcmp(p, "connect")) {			start_x11vnc = 0;			connect_to_x11vnc = 1;		} else {			fprintf(stderr, "unrecognized gui opt: %s\n", p);		}				p = strtok(NULL, ",");	}	free(s);	if (start_x11vnc) {		connect_to_x11vnc = 1;	}	if (! gui_xdisplay) {		fprintf(stderr, "error: cannot determine X DISPLAY for gui"		    " to display on.\n");		exit(1);	}	test_dpy = XOpenDisplay(gui_xdisplay);	if (! test_dpy && auth_file) {		if (getenv("XAUTHORITY") != NULL) {			old_xauth = strdup(getenv("XAUTHORITY"));		}		set_env("XAUTHORITY", auth_file);		test_dpy = XOpenDisplay(gui_xdisplay);	}	if (! test_dpy) {		if (! old_xauth && getenv("XAUTHORITY") != NULL) {			old_xauth = strdup(getenv("XAUTHORITY"));		}		set_env("XAUTHORITY", "");		test_dpy = XOpenDisplay(gui_xdisplay);	}	if (! test_dpy) {		fprintf(stderr, "error: cannot connect to gui X DISPLAY: %s\n",		    gui_xdisplay);	}	XCloseDisplay(test_dpy);	if (start_x11vnc) {#if defined(LIBVNCSERVER_HAVE_FORK)		/* fork into the background now */		int p;		if ((p = fork()) > 0)  {			;	/* parent */		} else if (p == -1) {			fprintf(stderr, "could not fork\n");			perror("fork");			clean_up_exit(1);		} else {			run_gui(gui_xdisplay, connect_to_x11vnc);			exit(1);		}#else		fprintf(stderr, "system does not support fork: start "		    "x11vnc in the gui.\n");		start_x11vnc = 0;#endif	}	if (!start_x11vnc) {		run_gui(gui_xdisplay, connect_to_x11vnc);		exit(1);	}	if (old_xauth) {		set_env("XAUTHORITY", old_xauth);	}}