} else if (!strcmp(p, "rfbport")) { snprintf(buf, bufn, "aro=%s:%d", p, screen->port); } else if (!strcmp(p, "rfbwait")) { NOTAPPRO
char *process_remote_cmd(char *cmd, int stringonly) {	char *p = cmd;	char *co = "";	char buf[VNC_CONNECT_MAX]; 	int bufn = VNC_CONNECT_MAX;	int query = 0;	static char *prev_cursors_mode = NULL;	if (! accept_remote_cmds) {		rfbLog("remote commands disabled: %s\n", cmd);		return NULL;	}	strcpy(buf, "");	if (strstr(cmd, "cmd=") == cmd) {		p += strlen("cmd=");	} else if (strstr(cmd, "qry=") == cmd) {		query = 1;		if (strchr(cmd, ',')) {			/* comma separated batch mode */			char *s, *q, *res;			char tmp[512];			strcpy(buf, "");			s = strdup(cmd + strlen("qry="));			q = strtok(s, ","); 			while (q) {				strcpy(tmp, "qry=");				strncat(tmp, q, 500);				res = process_remote_cmd(tmp, 1);				if (res && strlen(buf)+strlen(res)				    >= VNC_CONNECT_MAX - 1) {					rfbLog("overflow in process_remote_cmd:"					    " %s -- %s\n", buf, res);					free(res);					break;				}				if (res) {					strcat(buf, res);					free(res);				}				q = strtok(NULL, ",");				if (q) {					strcat(buf, ",");				}			}			free(s);			goto qry;		}		p += strlen("qry=");	} else {		rfbLog("ignoring malformed command: %s\n", cmd);		goto done;	}	/* always call like: COLON_CHECK("foobar:") */#define COLON_CHECK(str) \	if (strstr(p, str) != p) { \		co = ":"; \		if (! query) { \			goto done; \		} \	} else { \		char *q = strchr(p, ':'); \		if (query && q != NULL) { \			*(q+1) = '\0'; \		} \	}#define NOTAPP \	if (query) { \		if (strchr(p, ':')) { \			snprintf(buf, bufn, "ans=%sN/A", p); \		} else { \			snprintf(buf, bufn, "ans=%s:N/A", p); \		} \		goto qry; \	}#define NOTAPPRO \	if (query) { \		if (strchr(p, ':')) { \			snprintf(buf, bufn, "aro=%sN/A", p); \		} else { \			snprintf(buf, bufn, "aro=%s:N/A", p); \		} \		goto qry; \	}/* * Add: passwdfile logfile bg nofb rfbauth passwd noshm... */	if (!strcmp(p, "stop") || !strcmp(p, "quit") ||	    !strcmp(p, "exit") || !strcmp(p, "shutdown")) {		NOTAPP		close_all_clients();		rfbLog("process_remote_cmd: setting shut_down flag\n");		shut_down = 1;	} else if (!strcmp(p, "ping")) {		query = 1;		if (rfb_desktop_name) {			snprintf(buf, bufn, "ans=%s:%s", p, rfb_desktop_name);		} else {			snprintf(buf, bufn, "ans=%s:%s", p, "unknown");		}		goto qry;	} else if (!strcmp(p, "blacken") || !strcmp(p, "zero")) {		NOTAPP		push_black_screen(4);	} else if (!strcmp(p, "refresh")) {		NOTAPP		refresh_screen();	} else if (!strcmp(p, "reset")) {		NOTAPP		do_new_fb(1);	} else if (strstr(p, "zero:") == p) { /* skip-cmd-list */		int x1, y1, x2, y2;		NOTAPP		p += strlen("zero:");		if (sscanf(p, "%d,%d,%d,%d", &x1, &y1, &x2, &y2) == 4)  {			int mark = 1;			rfbLog("zeroing rect: %s\n", p);			if (x1 < 0 || x2 < 0) {				x1 = nabs(x1);				x2 = nabs(x2);				mark = 0;	/* hack for testing */			}			zero_fb(x1, y1, x2, y2);			if (mark) {				mark_rect_as_modified(x1, y1, x2, y2, 1);			}			push_sleep(4);		}	} else if (strstr(p, "damagefb:") == p) { /* skip-cmd-list */		int delay;		NOTAPP		p += strlen("damagefb:");		if (sscanf(p, "%d", &delay) == 1)  {			rfbLog("damaging client fb's for %d secs "			    "(by not marking rects.)\n", delay);			damage_time = time(0);			damage_delay = delay;		}	} else if (strstr(p, "close") == p) {		NOTAPP		COLON_CHECK("close:")		p += strlen("close:");		close_clients(p);	} else if (strstr(p, "disconnect") == p) {		NOTAPP		COLON_CHECK("disconnect:")		p += strlen("disconnect:");		close_clients(p);	} else if (strstr(p, "id") == p) {		int ok = 0;		Window twin;		COLON_CHECK("id:")		if (query) {			snprintf(buf, bufn, "ans=%s%s0x%lx", p, co, subwin);			goto qry;		}		p += strlen("id:");		if (*p == '\0' || !strcmp("root", p)) {			/* back to root win */			twin = 0x0;			ok = 1;		} else if (!strcmp("pick", p)) {			twin = 0x0;			if (safe_remote_only) {				rfbLog("unsafe: '-id pick'\n");			} else if (pick_windowid(&twin)) {				ok = 1;			}		} else if (! scan_hexdec(p, &twin)) {			rfbLog("-id: skipping incorrect hex/dec number: %s\n", p);		} else {			ok = 1;		}		if (ok) {			if (twin && ! valid_window(twin)) {				rfbLog("skipping invalid sub-window: 0x%lx\n",				    twin);			} else {				subwin = twin;				rootshift = 0;				check_black_fb();				do_new_fb(1);			}		}	} else if (strstr(p, "sid") == p) {		int ok = 0;		Window twin;		COLON_CHECK("sid:")		if (query) {			snprintf(buf, bufn, "ans=%s%s0x%lx", p, co, subwin);			goto qry;		}		p += strlen("sid:");		if (*p == '\0' || !strcmp("root", p)) {			/* back to root win */			twin = 0x0;			ok = 1;		} else if (!strcmp("pick", p)) {			twin = 0x0;			if (safe_remote_only) {				rfbLog("unsafe: '-sid pick'\n");			} else if (pick_windowid(&twin)) {				ok = 1;			}		} else if (! scan_hexdec(p, &twin)) {			rfbLog("-sid: skipping incorrect hex/dec number: %s\n", p);		} else {			ok = 1;		}		if (ok) {			if (twin && ! valid_window(twin)) {				rfbLog("skipping invalid sub-window: 0x%lx\n",				    twin);			} else {				subwin = twin;				rootshift = 1;				check_black_fb();				do_new_fb(1);			}		}	} else if (!strcmp(p, "flashcmap")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, flash_cmap);			goto qry;		}		rfbLog("process_remote_cmd: turning on flashcmap mode.\n");		flash_cmap = 1;	} else if (!strcmp(p, "noflashcmap")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !flash_cmap);			goto qry;		}		rfbLog("process_remote_cmd: turning off flashcmap mode.\n");		flash_cmap = 0;			} else if (!strcmp(p, "truecolor")) {		int orig = force_indexed_color;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !force_indexed_color);			goto qry;		}		rfbLog("process_remote_cmd: turning off notruecolor mode.\n");		force_indexed_color = 0;		if (orig != force_indexed_color) {			if_8bpp_do_new_fb();		}	} else if (!strcmp(p, "notruecolor")) {		int orig = force_indexed_color;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, force_indexed_color);			goto qry;		}		rfbLog("process_remote_cmd: turning on notruecolor mode.\n");		force_indexed_color = 1;		if (orig != force_indexed_color) {			if_8bpp_do_new_fb();		}			} else if (!strcmp(p, "overlay")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, overlay);			goto qry;		}		rfbLog("process_remote_cmd: turning on -overlay mode.\n");		if (!overlay_present) {			rfbLog("skipping: overlay extension not present.\n");		} else if (overlay) {			rfbLog("skipping: already in -overlay mode.\n");		} else {			int reset_mem = 0;			/* here we go... */			if (using_shm) {				rfbLog("setting -noshm mode.\n");				using_shm = 0;				reset_mem = 1;			}			overlay = 1;			do_new_fb(reset_mem);		}	} else if (!strcmp(p, "nooverlay")) {		int orig = overlay;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !overlay);			goto qry;		}		rfbLog("process_remote_cmd: turning off overlay mode\n");		overlay = 0;		if (!overlay_present) {			rfbLog("warning: overlay extension not present.\n");		} else if (!orig) {			rfbLog("skipping: already not in -overlay mode.\n");		} else {			/* here we go... */			do_new_fb(0);		}			} else if (!strcmp(p, "overlay_cursor") ||	    !strcmp(p, "overlay_yescursor") || !strcmp(p, "nooverlay_nocursor")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, overlay_cursor);			goto qry;		}		rfbLog("process_remote_cmd: turning on overlay_cursor mode.\n");		overlay_cursor = 1;		if (!overlay_present) {			rfbLog("warning: overlay extension not present.\n");		} else if (!overlay) {			rfbLog("warning: not in -overlay mode.\n");		} else {			rfbLog("You may want to run -R noshow_cursor or\n");			rfbLog(" -R cursor:none to disable any extra "			    "cursors.\n");		}	} else if (!strcmp(p, "nooverlay_cursor") ||	    !strcmp(p, "nooverlay_yescursor") || !strcmp(p, "overlay_nocursor")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !overlay_cursor);			goto qry;		}		rfbLog("process_remote_cmd: turning off overlay_cursor mode\n");		overlay_cursor = 0;		if (!overlay_present) {			rfbLog("warning: overlay extension not present.\n");		} else if (!overlay) {			rfbLog("warning: not in -overlay mode.\n");		} else {			rfbLog("You may want to run -R show_cursor or\n");			rfbLog(" -R cursor:... to re-enable any cursors.\n");		}			} else if (strstr(p, "visual") == p) {		COLON_CHECK("visual:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(visual_str));			goto qry;		}		p += strlen("visual:");		if (visual_str) free(visual_str);		visual_str = strdup(p);		/* OK, this requires a new fb... */		do_new_fb(0);	} else if (!strcmp(p, "scale") ||		    strstr(p, "scale:") == p) {	/* skip-cmd-list */		COLON_CHECK("scale:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co, NONUL(scale_str));			goto qry;		}		p += strlen("scale:");		if (scale_str) free(scale_str);		scale_str = strdup(p);		/* OK, this requires a new fb... */		check_black_fb();		do_new_fb(0);	} else if (!strcmp(p, "viewonly")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, view_only); goto qry;		}		rfbLog("process_remote_cmd: enable viewonly mode.\n");		view_only = 1;	} else if (!strcmp(p, "noviewonly")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !view_only); goto qry;		}		rfbLog("process_remote_cmd: disable viewonly mode.\n");		view_only = 0;	} else if (!strcmp(p, "shared")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, shared); goto qry;		}		rfbLog("process_remote_cmd: enable sharing.\n");		shared = 1;		screen->alwaysShared = TRUE;		screen->neverShared = FALSE;	} else if (!strcmp(p, "noshared")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !shared); goto qry;		}		rfbLog("process_remote_cmd: disable sharing.\n");		shared = 0;		screen->alwaysShared = FALSE;		screen->neverShared = TRUE;	} else if (!strcmp(p, "forever")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, 1-connect_once);			goto qry;		}		rfbLog("process_remote_cmd: enable -forever mode.\n");		connect_once = 0;	} else if (!strcmp(p, "noforever") || !strcmp(p, "once")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, connect_once);			goto qry;		}		rfbLog("process_remote_cmd: disable -forever mode.\n");		connect_once = 1;	} else if (!strcmp(p, "deny") || !strcmp(p, "lock")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, deny_all); goto qry;		}		rfbLog("process_remote_cmd: denying new connections.\n");		deny_all = 1;	} else if (!strcmp(p, "nodeny") || !strcmp(p, "unlock")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !deny_all); goto qry;		}		rfbLog("process_remote_cmd: allowing new connections.\n");		deny_all = 0;	} else if (strstr(p, "connect") == p) {		NOTAPP		COLON_CHECK("connect:")		p += strlen("connect:");		/* this is a reverse connection */		strncpy(vnc_connect_str, p, VNC_CONNECT_MAX);		vnc_connect_str[VNC_CONNECT_MAX] = '\0';	} else if (strstr(p, "allowonce") == p) {		NOTAPP		COLON_CHECK("allowonce:")		p += strlen("allowonce:");		allow_once = strdup(p);		rfbLog("process_remote_cmd: set allow_once %s\n", allow_once);	} else if (strstr(p, "allow") == p) {		char *before, *old;		COLON_CHECK("allow:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(allow_list));			goto qry;		}		p += strlen("allow:");		if (allow_list && strchr(allow_list, '/')) {			rfbLog("process_remote_cmd: cannot use allow:host\n");			rfbLog("in '-allow %s' mode.\n", allow_list);			goto done;		}		if (allow_list) {			before = strdup(allow_list);		} else {			before = strdup("");		}		old = allow_list;		if (*p == '+') {			p++;			allow_list = add_item(allow_list, p);		} else if (*p == '-') {			p++;			allow_list = delete_item(allow_list, p);		} else {			allow_list = strdup(p);		}		if (strcmp(before, allow_list)) {			rfbLog("process_remote_cmd: modified allow_list:\n");			rfbLog(" from: \"%s\"\n", before);			rfbLog(" to:   \"%s\"\n", allow_list);		}		if (old) free(old);		free(before);	} else if (!strcmp(p, "localhost")) {		char *before, *old;		if (query) {			int state = 0;			if (allow_list && !strcmp(allow_list, "127.0.0.1")) {				state = 1;			}			snprintf(buf, bufn, "ans=%s:%d", p, state);			goto qry;		}		if (allow_list) {			before = strdup(allow_list);		} else {			before = strdup("");		}		old = allow_list;		allow_list = strdup("127.0.0.1");		if (strcmp(before, allow_list)) {			rfbLog("process_remote_cmd: modified allow_list:\n");			rfbLog(" from: \"%s\"\n", before);			rfbLog(" to:   \"%s\"\n", allow_list);		}		if (old) free(old);		free(before);	} else if (!strcmp(p, "nolocalhost")) {		char *before, *old;		if (query) {			int state = 0;			if (allow_list && !strcmp(allow_list, "127.0.0.1")) {				state = 1;			}			snprintf(buf, bufn, "ans=%s:%d", p, !state);			goto qry;		}		if (allow_list) {			before = strdup(allow_list);		} else {			before = strdup("");		}		old = allow_list;		allow_list = strdup("");		if (strcmp(before, allow_list)) {			rfbLog("process_remote_cmd: modified allow_list:\n");			rfbLog(" from: \"%s\"\n", before);			rfbLog(" to:   \"%s\"\n", allow_list);		}		if (old) free(old);		free(before);	} else if (strstr(p, "accept") == p) {		COLON_CHECK("accept:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(accept_cmd));			goto qry;		}		if (safe_remote_only) {			rfbLog("unsafe: %s\n", p);		} else {			p += strlen("accept:");			if (accept_cmd) free(accept_cmd);			accept_cmd = strdup(p);		}	} else if (strstr(p, "gone") == p) {		COLON_CHECK("gone:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co, NONUL(gone_cmd));			goto qry;		}		if (safe_remote_only) {			rfbLog("unsafe: %s\n", p);		} else {			p += strlen("gone:");			if (gone_cmd) free(gone_cmd);			gone_cmd = strdup(p);		}	} else if (!strcmp(p, "shm")) {		int orig = using_shm;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, using_shm);			goto qry;		}		rfbLog("process_remote_cmd: turning off noshm mode.\n");		using_shm = 1;		if (orig != using_shm) {			do_new_fb(1);		} else {			rfbLog(" already in shm mode.\n");		}	} else if (!strcmp(p, "noshm")) {		int orig = using_shm;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !using_shm);			goto qry;		}		rfbLog("process_remote_cmd: turning on noshm mode.\n");		using_shm = 0;		if (orig != using_shm) {			do_new_fb(1);		} else {			rfbLog(" already in noshm mode.\n");		}			} else if (!strcmp(p, "flipbyteorder")) {		int orig = flip_byte_order;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, flip_byte_order);			goto qry;		}		rfbLog("process_remote_cmd: turning on flipbyteorder mode.\n");		flip_byte_order = 1;		if (orig != flip_byte_order) {			if (! using_shm) {				do_new_fb(1);			} else {				rfbLog("  using shm, not resetting fb\n");			}		}	} else if (!strcmp(p, "noflipbyteorder")) {		int orig = flip_byte_order;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !flip_byte_order);			goto qry;		}		rfbLog("process_remote_cmd: turning off flipbyteorder mode.\n");		flip_byte_order = 0;		if (orig != flip_byte_order) {			if (! using_shm) {				do_new_fb(1);			} else {				rfbLog("  using shm, not resetting fb\n");			}		}			} else if (!strcmp(p, "onetile")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, single_copytile);			goto qry;		}		rfbLog("process_remote_cmd: enable -onetile mode.\n");		single_copytile = 1;	} else if (!strcmp(p, "noonetile")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !single_copytile);			goto qry;		}		rfbLog("process_remote_cmd: disable -onetile mode.\n");		if (tile_shm_count < ntiles_x) {			rfbLog(" this has no effect: tile_shm_count=%d"			    " ntiles_x=%d\n", tile_shm_count, ntiles_x);					}		single_copytile = 0;	} else if (strstr(p, "blackout") == p) {		char *before, *old;		COLON_CHECK("blackout:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(blackout_string));			goto qry;		}		p += strlen("blackout:");		if (blackout_string) {			before = strdup(blackout_string);		} else {			before = strdup("");		}		old = blackout_string;		if (*p == '+') {			p++;			blackout_string = add_item(blackout_string, p);		} else if (*p == '-') {			p++;			blackout_string = delete_item(blackout_string, p);		} else {			blackout_string = strdup(p);		}		if (strcmp(before, blackout_string)) {			rfbLog("process_remote_cmd: changing -blackout\n");			rfbLog(" from: %s\n", before);			rfbLog(" to:   %s\n", blackout_string);			if (0 && !strcmp(blackout_string, "") &&			    single_copytile_orig != single_copytile) {				rfbLog("resetting single_copytile to: %d\n",				    single_copytile_orig);				single_copytile = single_copytile_orig;			}			initialize_blackouts_and_xinerama();		}		if (old) free(old);		free(before);	} else if (!strcmp(p, "xinerama")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, xinerama); goto qry;		}		rfbLog("process_remote_cmd: enable xinerama mode."		    "(if applicable).\n");		xinerama = 1;		initialize_blackouts_and_xinerama();	} else if (!strcmp(p, "noxinerama")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !xinerama); goto qry;		}		rfbLog("process_remote_cmd: disable xinerama mode."		    "(if applicable).\n");		xinerama = 0;		initialize_blackouts_and_xinerama();	} else if (!strcmp(p, "xrandr")) {		int orig = xrandr;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, xrandr); goto qry;		}		if (xrandr_present) {			rfbLog("process_remote_cmd: enable xrandr mode.\n");			xrandr = 1;			if (! xrandr_mode) {				xrandr_mode = strdup("default");			}			if (orig != xrandr) {				initialize_xrandr();			}		} else {			rfbLog("process_remote_cmd: XRANDR ext. not "			    "present.\n");		}	} else if (!strcmp(p, "noxrandr")) {		int orig = xrandr;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !xrandr); goto qry;		}		xrandr = 0;		if (xrandr_present) {			rfbLog("process_remote_cmd: disable xrandr mode.\n");			if (orig != xrandr) {				initialize_xrandr();			}		} else {			rfbLog("process_remote_cmd: XRANDR ext. not "			    "present.\n");		}	} else if (strstr(p, "xrandr_mode") == p) {		int orig = xrandr;		COLON_CHECK("xrandr_mode:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(xrandr_mode));			goto qry;		}		p += strlen("xrandr_mode:");		if (!strcmp("none", p)) {			xrandr = 0;		} else {			if (known_xrandr_mode(p)) {				if (xrandr_mode) free(xrandr_mode);				xrandr_mode = strdup(p);			} else {				rfbLog("skipping unknown xrandr mode: %s\n", p);				goto done;			}			xrandr = 1;		}		if (xrandr_present) {			if (xrandr) {				rfbLog("process_remote_cmd: enable xrandr"				    " mode.\n");			} else {				rfbLog("process_remote_cmd: disable xrandr"				    " mode.\n");			}			if (! xrandr_mode) {				xrandr_mode = strdup("default");			}			if (orig != xrandr) {				initialize_xrandr();			}		} else {			rfbLog("process_remote_cmd: XRANDR ext. not "			    "present.\n");		}	} else if (strstr(p, "padgeom") == p) {		COLON_CHECK("padgeom:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(pad_geometry));			goto qry;		}		p += strlen("padgeom:");		if (!strcmp("force", p) || !strcmp("do",p) || !strcmp("go",p)) {			rfbLog("process_remote_cmd: invoking "			    "install_padded_fb()\n");			install_padded_fb(pad_geometry);		} else {			if (pad_geometry) free(pad_geometry);			pad_geometry = strdup(p);			rfbLog("process_remote_cmd: set padgeom to: %s\n",			    pad_geometry);		}	} else if (!strcmp(p, "quiet") || !strcmp(p, "q")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, quiet); goto qry;		}		rfbLog("process_remote_cmd: turning on quiet mode.\n");		quiet = 1;	} else if (!strcmp(p, "noquiet")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !quiet); goto qry;		}		rfbLog("process_remote_cmd: turning off quiet mode.\n");		quiet = 0;			} else if (!strcmp(p, "modtweak")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, use_modifier_tweak);			goto qry;		}		rfbLog("process_remote_cmd: enabling -modtweak mode.\n");		if (! use_modifier_tweak) {			use_modifier_tweak = 1;			initialize_modtweak();		}		use_modifier_tweak = 1;	} else if (!strcmp(p, "nomodtweak")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !use_modifier_tweak);			goto qry;		}		rfbLog("process_remote_cmd: enabling -nomodtweak mode.\n");		use_modifier_tweak = 0;	} else if (!strcmp(p, "xkb")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, use_xkb_modtweak);			goto qry;		}		if (! xkb_present) {			rfbLog("process_remote_cmd: cannot enable -xkb "			    "modtweak mode (not supported on X display)\n");			goto done;		}		rfbLog("process_remote_cmd: enabling -xkb modtweak mode"		    " (if supported).\n");		if (! use_modifier_tweak || ! use_xkb_modtweak) {			use_modifier_tweak = 1;			use_xkb_modtweak = 1;			initialize_modtweak();		}		use_modifier_tweak = 1;		use_xkb_modtweak = 1;	} else if (!strcmp(p, "noxkb")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !use_xkb_modtweak);			goto qry;		}		if (! xkb_present) {			rfbLog("process_remote_cmd: cannot disable -xkb "			    "modtweak mode (not supported on X display)\n");			goto done;		}		rfbLog("process_remote_cmd: disabling -xkb modtweak mode.\n");		use_xkb_modtweak = 0;	} else if (strstr(p, "skip_keycodes") == p) {		COLON_CHECK("skip_keycodes:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(skip_keycodes));			goto qry;		}		p += strlen("skip_keycodes:");		rfbLog("process_remote_cmd: setting xkb -skip_keycodes"		    " to:\n\t'%s'\n", p);		if (! xkb_present) {			rfbLog("process_remote_cmd: warning xkb not present\n");		} else if (! use_xkb_modtweak) {			rfbLog("process_remote_cmd: turning on xkb.\n");			use_xkb_modtweak = 1;			if (! use_modifier_tweak) {				rfbLog("process_remote_cmd: turning on "				    "modtweak.\n");				use_modifier_tweak = 1;			}		}		if (skip_keycodes) free(skip_keycodes);		skip_keycodes = strdup(p);		initialize_modtweak();	} else if (!strcmp(p, "add_keysyms")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, add_keysyms);			goto qry;		}		rfbLog("process_remote_cmd: enabling -add_keysyms mode.\n");		add_keysyms = 1;	} else if (!strcmp(p, "noadd_keysyms")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !add_keysyms);			goto qry;		}		rfbLog("process_remote_cmd: disabling -add_keysyms mode.\n");		add_keysyms = 0;	} else if (!strcmp(p, "clear_mods")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, clear_mods == 1);			goto qry;		}		rfbLog("process_remote_cmd: enabling -clear_mods mode.\n");		clear_mods = 1;		clear_modifiers(0);	} else if (!strcmp(p, "noclear_mods")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !(clear_mods == 1));			goto qry;		}		rfbLog("process_remote_cmd: disabling -clear_mods mode.\n");		clear_mods = 0;	} else if (!strcmp(p, "clear_keys")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, clear_mods == 2);			goto qry;		}		rfbLog("process_remote_cmd: enabling -clear_keys mode.\n");		clear_mods = 2;		clear_keys();	} else if (!strcmp(p, "noclear_keys")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !(clear_mods == 2));			goto qry;		}		rfbLog("process_remote_cmd: disabling -clear_keys mode.\n");		clear_mods = 0;	} else if (strstr(p, "remap") == p) {		char *before, *old;		COLON_CHECK("remap:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(remap_file));			goto qry;		}		p += strlen("remap:");		if ((*p == '+' || *p == '-') && remap_file &&		    strchr(remap_file, '/')) {			rfbLog("process_remote_cmd: cannot use remap:+/-\n");			rfbLog("in '-remap %s' mode.\n", remap_file);			goto done;		}		if (remap_file) {			before = strdup(remap_file);		} else {			before = strdup("");		}		old = remap_file;		if (*p == '+') {			p++;			remap_file = add_item(remap_file, p);		} else if (*p == '-') {			p++;			remap_file = delete_item(remap_file, p);			if (! strchr(remap_file, '-')) {				*remap_file = '\0';			}		} else {			remap_file = strdup(p);		}		if (strcmp(before, remap_file)) {			rfbLog("process_remote_cmd: changed -remap\n");			rfbLog(" from: %s\n", before);			rfbLog(" to:   %s\n", remap_file);			initialize_remap(remap_file);		}		if (old) free(old);		free(before);	} else if (!strcmp(p, "repeat")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !no_autorepeat);			goto qry;		}		rfbLog("process_remote_cmd: enabling -repeat mode.\n");		if (no_autorepeat) {			autorepeat(1);		}		no_autorepeat = 0;	} else if (!strcmp(p, "norepeat")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, no_autorepeat);			goto qry;		}		rfbLog("process_remote_cmd: enabling -norepeat mode.\n");		if (! no_autorepeat && client_count) {			no_autorepeat = 1;			autorepeat(0);		}		no_autorepeat = 1;	} else if (!strcmp(p, "bell")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, sound_bell);			goto qry;		}		rfbLog("process_remote_cmd: enabling bell (if supported).\n");		sound_bell = 1;	} else if (!strcmp(p, "nobell")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !sound_bell);			goto qry;		}		rfbLog("process_remote_cmd: disabling bell.\n");		sound_bell = 0;	} else if (!strcmp(p, "sel")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, watch_selection);			goto qry;		}		rfbLog("process_remote_cmd: enabling watch_selection.\n");		watch_selection = 1;	} else if (!strcmp(p, "nosel")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !watch_selection);			goto qry;		}		rfbLog("process_remote_cmd: disabling watch_selection.\n");		watch_selection = 0;	} else if (!strcmp(p, "primary")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, watch_primary);			goto qry;		}		rfbLog("process_remote_cmd: enabling watch_primary.\n");		watch_primary = 1;	} else if (!strcmp(p, "noprimary")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !watch_primary);			goto qry;		}		rfbLog("process_remote_cmd: disabling watch_primary.\n");		watch_primary = 0;	} else if (!strcmp(p, "set_no_cursor")) { /* skip-cmd-list */		rfbLog("process_remote_cmd: calling set_no_cursor()\n");		set_no_cursor();	} else if (!strcmp(p, "cursorshape")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, cursor_shape_updates);			goto qry;		}		rfbLog("process_remote_cmd: turning on cursorshape mode.\n");		rfbUndrawCursor(screen);		set_no_cursor();		cursor_shape_updates = 1;		restore_cursor_shape_updates(screen);	} else if (!strcmp(p, "nocursorshape")) {		int i, max = 5;		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !cursor_shape_updates);			goto qry;		}		rfbLog("process_remote_cmd: turning off cursorshape mode.\n");				rfbUndrawCursor(screen);		set_no_cursor();		for (i=0; i<max; i++) {			/* XXX: try to force empty cursor back to client */			rfbPE(screen, -1);		}		cursor_shape_updates = 0;		disable_cursor_shape_updates(screen);	} else if (!strcmp(p, "cursorpos")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, cursor_pos_updates);			goto qry;		}		rfbLog("process_remote_cmd: turning on cursorpos mode.\n");		cursor_pos_updates = 1;	} else if (!strcmp(p, "nocursorpos")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !cursor_pos_updates);			goto qry;		}		rfbLog("process_remote_cmd: turning off cursorpos mode.\n");		cursor_pos_updates = 0;	} else if (strstr(p, "cursor") == p) {		COLON_CHECK("cursor:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(multiple_cursors_mode));			goto qry;		}		p += strlen("cursor:");		if (multiple_cursors_mode) {			if (prev_cursors_mode) free(prev_cursors_mode);			prev_cursors_mode = strdup(multiple_cursors_mode);			free(multiple_cursors_mode);		}		multiple_cursors_mode = strdup(p);		rfbLog("process_remote_cmd: changed -cursor mode "		    "to: %s\n", multiple_cursors_mode);		if (strcmp(multiple_cursors_mode, "none") && !show_cursor) {			show_cursor = 1;			rfbLog("process_remote_cmd: changed show_cursor "			    "to: %d\n", show_cursor);		}		initialize_cursors_mode();	} else if (!strcmp(p, "show_cursor")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, show_cursor);			goto qry;		}		rfbLog("process_remote_cmd: enabling show_cursor.\n");		show_cursor = 1;		if (multiple_cursors_mode && !strcmp(multiple_cursors_mode,		    "none")) {			free(multiple_cursors_mode);			if (prev_cursors_mode) {				multiple_cursors_mode =				    strdup(prev_cursors_mode);			} else {				multiple_cursors_mode = strdup("default");			}			rfbLog("process_remote_cmd: changed -cursor mode "			    "to: %s\n", multiple_cursors_mode);		}		initialize_cursors_mode();	} else if (!strcmp(p, "noshow_cursor") || !strcmp(p, "nocursor")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !show_cursor);			goto qry;		}		if (prev_cursors_mode) free(prev_cursors_mode);		prev_cursors_mode = strdup(multiple_cursors_mode);		rfbLog("process_remote_cmd: disabling show_cursor.\n");		show_cursor = 0;		initialize_cursors_mode();	} else if (!strcmp(p, "xfixes")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, use_xfixes);			goto qry;		}		if (! xfixes_present) {			rfbLog("process_remote_cmd: cannot enable xfixes "			    "(not supported on X display)\n");			goto done;		}		rfbLog("process_remote_cmd: enabling -xfixes"		    " (if supported).\n");		use_xfixes = 1;		initialize_xfixes();	} else if (!strcmp(p, "noxfixes")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !use_xfixes);			goto qry;		}		if (! xfixes_present) {			rfbLog("process_remote_cmd: disabling xfixes  "			    "(but not supported on X display)\n");			goto done;		}		rfbLog("process_remote_cmd: disabling -xfixes.\n");		use_xfixes = 0;		initialize_xfixes();	} else if (strstr(p, "xwarp") == p || strstr(p, "xwarppointer") == p) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, use_xwarppointer);			goto qry;		}		rfbLog("process_remote_cmd: turning on xwarppointer mode.\n");		use_xwarppointer = 1;	} else if (strstr(p, "noxwarp") == p || strstr(p, "noxwarppointer") == p) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !use_xwarppointer);			goto qry;		}		rfbLog("process_remote_cmd: turning off xwarppointer mode.\n");		use_xwarppointer = 0;	} else if (strstr(p, "buttonmap") == p) {		COLON_CHECK("buttonmap:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%s", p, co,			    NONUL(pointer_remap));			goto qry;		}		p += strlen("buttonmap:");		if (pointer_remap) free(pointer_remap);		pointer_remap = strdup(p);		rfbLog("process_remote_cmd: setting -buttonmap to:\n"		    "\t'%s'\n", p);		initialize_pointer_map(p);	} else if (!strcmp(p, "dragging")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, show_dragging);			goto qry;		}		rfbLog("process_remote_cmd: enabling mouse dragging mode.\n");		show_dragging = 1;	} else if (!strcmp(p, "nodragging")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !show_dragging);			goto qry;		}		rfbLog("process_remote_cmd: enabling mouse nodragging mode.\n");		show_dragging = 0;	} else if (strstr(p, "pointer_mode") == p) {		int pm;		COLON_CHECK("pointer_mode:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co, pointer_mode);			goto qry;		}		p += strlen("pointer_mode:");		pm = atoi(p);		if (pm < 1 || pm > pointer_mode_max) {			rfbLog("process_remote_cmd: pointer_mode out of range:"			   " 1-%d: %d\n", pointer_mode_max, pm);		} else {			rfbLog("process_remote_cmd: setting pointer_mode %d\n",			    pm);			pointer_mode = pm;		}	} else if (strstr(p, "input_skip") == p) {		int is;		COLON_CHECK("input_skip:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co, ui_skip);			goto qry;		}		p += strlen("input_skip:");		is = atoi(p);		rfbLog("process_remote_cmd: setting input_skip %d\n", is);		ui_skip = is;	} else if (!strcmp(p, "debug_pointer") || !strcmp(p, "dp")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, debug_pointer);			goto qry;		}		rfbLog("process_remote_cmd: turning on debug_pointer.\n");		debug_pointer = 1;	} else if (!strcmp(p, "nodebug_pointer") || !strcmp(p, "nodp")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !debug_pointer);			goto qry;		}		rfbLog("process_remote_cmd: turning off debug_pointer.\n");		debug_pointer = 0;	} else if (!strcmp(p, "debug_keyboard") || !strcmp(p, "dk")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, debug_keyboard);			goto qry;		}		rfbLog("process_remote_cmd: turning on debug_keyboard.\n");		debug_keyboard = 1;	} else if (!strcmp(p, "nodebug_keyboard") || !strcmp(p, "nodk")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !debug_keyboard);			goto qry;		}		rfbLog("process_remote_cmd: turning off debug_keyboard.\n");		debug_keyboard = 0;	} else if (strstr(p, "deferupdate") == p) {		int d;		COLON_CHECK("deferupdate:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co,			    screen->deferUpdateTime);			goto qry;		}		p += strlen("deferupdate:");		d = atoi(p);		if (d < 0) d = 0;		rfbLog("process_remote_cmd: setting defer to %d ms.\n", d);		screen->deferUpdateTime = d;			} else if (strstr(p, "defer") == p) {		int d;		COLON_CHECK("defer:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co,			    screen->deferUpdateTime);			goto qry;		}		p += strlen("defer:");		d = atoi(p);		if (d < 0) d = 0;		rfbLog("process_remote_cmd: setting defer to %d ms.\n", d);		/* XXX not part of API? */		screen->deferUpdateTime = d;			} else if (strstr(p, "wait") == p) {		int w;		COLON_CHECK("wait:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co, waitms);			goto qry;		}		p += strlen("wait:");		w = atoi(p);		if (w < 0) w = 0;		rfbLog("process_remote_cmd: setting wait %d -> %d ms.\n",		    waitms, w);		waitms = w;	} else if (!strcmp(p, "nap")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, take_naps); goto qry;		}		rfbLog("process_remote_cmd: turning on nap mode.\n");		take_naps = 1;	} else if (!strcmp(p, "nonap")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !take_naps); goto qry;		}		rfbLog("process_remote_cmd: turning off nap mode.\n");		take_naps = 0;	} else if (strstr(p, "sb") == p) {		int w;		COLON_CHECK("sb:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co, screen_blank);			goto qry;		}		p += strlen("sb:");		w = atoi(p);		if (w < 0) w = 0;		rfbLog("process_remote_cmd: setting screen_blank %d -> %d"		    " sec.\n", screen_blank, w);		screen_blank = w;	} else if (strstr(p, "screen_blank") == p) {		int w;		COLON_CHECK("screen_blank:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co, screen_blank);			goto qry;		}		p += strlen("screen_blank:");		w = atoi(p);		if (w < 0) w = 0;		rfbLog("process_remote_cmd: setting screen_blank %d -> %d"		    " sec.\n", screen_blank, w);		screen_blank = w;	} else if (strstr(p, "fs") == p) {		COLON_CHECK("fs:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%f", p, co, fs_frac);			goto qry;		}		p += strlen("fs:");		fs_frac = atof(p);		rfbLog("process_remote_cmd: setting -fs frac to %f\n", fs_frac);	} else if (strstr(p, "gaps") == p) {		int g;		COLON_CHECK("gaps:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co, gaps_fill);			goto qry;		}		p += strlen("gaps:");		g = atoi(p);		if (g < 0) g = 0;		rfbLog("process_remote_cmd: setting gaps_fill %d -> %d.\n",		    gaps_fill, g);		gaps_fill = g;	} else if (strstr(p, "grow") == p) {		int g;		COLON_CHECK("grow:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co, grow_fill);			goto qry;		}		p += strlen("grow:");		g = atoi(p);		if (g < 0) g = 0;		rfbLog("process_remote_cmd: setting grow_fill %d -> %d.\n",		    grow_fill, g);		grow_fill = g;	} else if (strstr(p, "fuzz") == p) {		int f;		COLON_CHECK("fuzz:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co, tile_fuzz);			goto qry;		}		p += strlen("fuzz:");		f = atoi(p);		if (f < 0) f = 0;		rfbLog("process_remote_cmd: setting tile_fuzz %d -> %d.\n",		    tile_fuzz, f);		grow_fill = f;	} else if (strstr(p, "progressive") == p) {		int f;		COLON_CHECK("progressive:")		if (query) {			snprintf(buf, bufn, "ans=%s%s%d", p, co,			    screen->progressiveSliceHeight);			goto qry;		}		p += strlen("progressive:");		f = atoi(p);		if (f < 0) f = 0;		rfbLog("process_remote_cmd: setting progressive %d -> %d.\n",		    screen->progressiveSliceHeight, f);		screen->progressiveSliceHeight = f;	} else if (!strcmp(p, "noremote")) {		if (query) {			snprintf(buf, bufn, "ans=%s:%d", p, !accept_remote_cmds);			goto qry;		}		rfbLog("process_remote_cmd: disabling remote commands.\n");		accept_remote_cmds = 0; /* cannot be turned back on. */	} else if (query) {		/* read-only variables that can only be queried: */		if (!strcmp(p, "display")) {			char *d = DisplayString(dpy);			if (! d) d = "unknown";			if (*d == ':') {				snprintf(buf, bufn, "aro=%s:%s%s", p,				    this_host(), d);			} else {				snprintf(buf, bufn, "aro=%s:%s", p, d);			}		} else if (!strcmp(p, "vncdisplay")) {			snprintf(buf, bufn, "aro=%s:%s", p,			    NONUL(vnc_desktop_name));		} else if (!strcmp(p, "desktopname")) {			snprintf(buf, bufn, "aro=%s:%s", p,			    NONUL(rfb_desktop_name));		} else if (!strcmp(p, "desktop")) {			snprintf(buf, bufn, "aro=%s:%s", p,			    NONUL(rfb_desktop_name));		} else if (!strcmp(p, "auth")) {			snprintf(buf, bufn, "aro=%s:%s", p, NONUL(auth_file));		} else if (!strcmp(p, "rootshift")) {			snprintf(buf, bufn, "aro=%s:%d", p, rootshift);		} else if (!strcmp(p, "scale_str")) {			snprintf(buf, bufn, "aro=%s:%s", p, NONUL(scale_str));		} else if (!strcmp(p, "scaled_x")) {			snprintf(buf, bufn, "aro=%s:%d", p, scaled_x);		} else if (!strcmp(p, "scaled_y")) {			snprintf(buf, bufn, "aro=%s:%d", p, scaled_y);		} else if (!strcmp(p, "scale_numer")) {			snprintf(buf, bufn, "aro=%s:%d", p, scale_numer);		} else if (!strcmp(p, "scale_denom")) {			snprintf(buf, bufn, "aro=%s:%d", p, scale_denom);		} else if (!strcmp(p, "scale_fac")) {			snprintf(buf, bufn, "aro=%s:%f", p, scale_fac);		} else if (!strcmp(p, "scaling_noblend")) {			snprintf(buf, bufn, "aro=%s:%d", p, scaling_noblend);		} else if (!strcmp(p, "scaling_nomult4")) {			snprintf(buf, bufn, "aro=%s:%d", p, scaling_nomult4);		} else if (!strcmp(p, "scaling_pad")) {			snprintf(buf, bufn, "aro=%s:%d", p, scaling_pad);		} else if (!strcmp(p, "scaling_interpolate")) {			snprintf(buf, bufn, "aro=%s:%d", p, scaling_interpolate);		} else if (!strcmp(p, "inetd")) {			snprintf(buf, bufn, "aro=%s:%d", p, inetd);		} else if (!strcmp(p, "safer")) {			snprintf(buf, bufn, "aro=%s:%d", p, safe_remote_only);		} else if (!strcmp(p, "unsafe")) {			snprintf(buf, bufn, "aro=%s:%d", p, !safe_remote_only);		} else if (!strcmp(p, "passwdfile")) {			snprintf(buf, bufn, "aro=%s:%s", p, NONUL(passwdfile));		} else if (!strcmp(p, "using_shm")) {			snprintf(buf, bufn, "aro=%s:%d", p, !using_shm);		} else if (!strcmp(p, "logfile") || !strcmp(p, "o")) {			snprintf(buf, bufn, "aro=%s:%s", p, NONUL(logfile));		} else if (!strcmp(p, "rc")) {			snprintf(buf, bufn, "aro=%s:%s", p, NONUL(rc_rcfile));		} else if (!strcmp(p, "norc")) {			snprintf(buf, bufn, "aro=%s:%d", p, rc_norc);		} else if (!strcmp(p, "h") || !strcmp(p, "help") ||		    !strcmp(p, "V") || !strcmp(p, "version") ||		    !strcmp(p, "lastmod")) {			snprintf(buf, bufn, "aro=%s:%s", p, NONUL(lastmod));		} else if (!strcmp(p, "bg")) {			snprintf(buf, bufn, "aro=%s:%d", p, opts_bg);		} else if (!strcmp(p, "nofb")) {			snprintf(buf, bufn, "aro=%s:%d", p, nofb);		} else if (!strcmp(p, "sigpipe")) {			snprintf(buf, bufn, "aro=%s:%s", p, NONUL(sigpipe));		} else if (!strcmp(p, "threads")) {			snprintf(buf, bufn, "aro=%s:%d", p, use_threads);		} else if (!strcmp(p, "clients")) {			char *str = list_clients();			snprintf(buf, bufn, "aro=%s:%s", p, str);			free(str);		} else if (!strcmp(p, "client_count")) {			snprintf(buf, bufn, "aro=%s:%d", p, client_count);		} else if (!strcmp(p, "pid")) {			snprintf(buf, bufn, "aro=%s:%d", p, (int) getpid());		} else if (!strcmp(p, "ext_xtest")) {			snprintf(buf, bufn, "aro=%s:%d", p, xtest_present);		} else if (!strcmp(p, "ext_xkb")) {			snprintf(buf, bufn, "aro=%s:%d", p, xkb_present);		} else if (!strcmp(p, "ext_xshm")) {			snprintf(buf, bufn, "aro=%s:%d", p, xshm_present);		} else if (!strcmp(p, "ext_xinerama")) {			snprintf(buf, bufn, "aro=%s:%d", p, xinerama_present);		} else if (!strcmp(p, "ext_overlay")) {			snprintf(buf, bufn, "aro=%s:%d", p, overlay_present);		} else if (!strcmp(p, "ext_xfixes")) {			snprintf(buf, bufn, "aro=%s:%d", p, xfixes_present);		} else if (!strcmp(p, "ext_xdamage")) {			snprintf(buf, bufn, "aro=%s:%d", p, xdamage_present);		} else if (!strcmp(p, "ext_xrandr")) {			snprintf(buf, bufn, "aro=%s:%d", p, xrandr_present);		} else if (!strcmp(p, "rootwin")) {			snprintf(buf, bufn, "aro=%s:0x%x", p,			    (unsigned int) rootwin);		} else if (!strcmp(p, "num_buttons")) {			snprintf(buf, bufn, "aro=%s:%d", p, num_buttons);		} else if (!strcmp(p, "button_mask")) {			snprintf(buf, bufn, "aro=%s:%d", p, button_mask);		} else if (!strcmp(p, "mouse_x")) {			snprintf(buf, bufn, "aro=%s:%d", p, cursor_x);		} else if (!strcmp(p, "mouse_y")) {			snprintf(buf, bufn, "aro=%s:%d", p, cursor_y);		} else if (!strcmp(p, "bpp")) {			snprintf(buf, bufn, "aro=%s:%d", p, bpp);		} else if (!strcmp(p, "depth")) {			snprintf(buf, bufn, "aro=%s:%d", p, depth);		} else if (!strcmp(p, "indexed_color")) {			snprintf(buf, bufn, "aro=%s:%d", p, indexed_color);		} else if (!strcmp(p, "dpy_x")) {			snprintf(buf, bufn, "aro=%s:%d", p, dpy_x);		} else if (!strcmp(p, "dpy_y")) {			snprintf(buf, bufn, "aro=%s:%d", p, dpy_y);		} else if (!strcmp(p, "rfbport")) {			snprintf(buf, bufn, "aro=%s:%d", p, screen->port);		} else if (!strcmp(p, "rfbwait")) {			NOTAPPRO		} else if (!strcmp(p, "rfbauth")) {			NOTAPPRO		} else if (!strcmp(p, "passwd")) {			NOTAPPRO		} else if (!strcmp(p, "alwaysshared")) {			snprintf(buf, bufn, "aro=%s:%d", p, screen->alwaysShared);		} else if (!strcmp(p, "dontdisconnect")) {			snprintf(buf, bufn, "aro=%s:%d", p,			    screen->dontDisconnect);		} else if (!strcmp(p, "httpdir")) {			snprintf(buf, bufn, "aro=%s:%s", p,			    NONUL(screen->httpDir));		} else if (!strcmp(p, "enablehttpproxy")) {			snprintf(buf, bufn, "aro=%s:%d", p,			    screen->httpEnableProxyConnect);		} else {			NOTAPP		}		goto qry;	} else {		char tmp[100];		NOTAPP		rfbLog("process_remote_cmd: warning unknown\n");		strncpy(tmp, p, 90);		rfbLog("command \"%s\"\n", tmp);		goto done;	}	done:	if (*buf == '\0') {		sprintf(buf, "ack=1");	}	qry:	if (stringonly) {		return strdup(buf);	} else if (client_connect_file) {		FILE *out = fopen(client_connect_file, "w");		if (out != NULL) {			fprintf(out, "%s\n", buf);			fclose(out);			usleep(20*1000);		}	} else {		set_vnc_connect_prop(buf);		XFlush(dpy);	}	return NULL;}