diff options
Diffstat (limited to 'x11vnc/remote.c')
-rw-r--r-- | x11vnc/remote.c | 1808 |
1 files changed, 1222 insertions, 586 deletions
diff --git a/x11vnc/remote.c b/x11vnc/remote.c index bdfc64b..2464189 100644 --- a/x11vnc/remote.c +++ b/x11vnc/remote.c @@ -778,7 +778,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { rfbLog("remote_cmd: bad CR string: %s\n", p); } - } else if (!strcmp(p, "stop") || !strcmp(p, "quit") || + goto done; + } + if (!strcmp(p, "stop") || !strcmp(p, "quit") || !strcmp(p, "exit") || !strcmp(p, "shutdown")) { NOTAPP if (client_connect_file) { @@ -791,8 +793,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting shut_down flag\n"); shut_down = 1; close_all_clients(); - - } else if (!strcmp(p, "ping")) { + goto done; + } + if (!strcmp(p, "ping")) { query = 1; if (rfb_desktop_name) { snprintf(buf, bufn, "ans=%s:%s", p, rfb_desktop_name); @@ -800,17 +803,24 @@ char *process_remote_cmd(char *cmd, int stringonly) { snprintf(buf, bufn, "ans=%s:%s", p, "unknown"); } goto qry; - - } else if (!strcmp(p, "blacken") || !strcmp(p, "zero")) { + goto done; + } + if (!strcmp(p, "blacken") || !strcmp(p, "zero")) { NOTAPP push_black_screen(4); - } else if (!strcmp(p, "refresh")) { + goto done; + } + if (!strcmp(p, "refresh")) { NOTAPP refresh_screen(1); - } else if (!strcmp(p, "reset")) { + goto done; + } + if (!strcmp(p, "reset")) { NOTAPP do_new_fb(1); - } else if (strstr(p, "zero:") == p) { /* skip-cmd-list */ + goto done; + } + if (strstr(p, "zero:") == p) { /* skip-cmd-list */ int x1, y1, x2, y2; NOTAPP p += strlen("zero:"); @@ -829,7 +839,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } push_sleep(4); } - } else if (strstr(p, "damagefb:") == p) { /* skip-cmd-list */ + goto done; + } + if (strstr(p, "damagefb:") == p) { /* skip-cmd-list */ int delay; NOTAPP p += strlen("damagefb:"); @@ -839,19 +851,23 @@ char *process_remote_cmd(char *cmd, int stringonly) { damage_time = time(NULL); damage_delay = delay; } - - } else if (strstr(p, "close") == p) { + goto done; + } + if (strstr(p, "close") == p) { NOTAPP COLON_CHECK("close:") p += strlen("close:"); close_clients(p); - } else if (strstr(p, "disconnect") == p) { + goto done; + } + if (strstr(p, "disconnect") == p) { NOTAPP COLON_CHECK("disconnect:") p += strlen("disconnect:"); close_clients(p); - - } else if (strstr(p, "id") == p) { + goto done; + } + if (strstr(p, "id") == p) { int ok = 0; Window twin; COLON_CHECK("id:") @@ -889,7 +905,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { do_new_fb(1); } } - } else if (strstr(p, "sid") == p) { + goto done; + } + if (strstr(p, "sid") == p) { int ok = 0; Window twin; COLON_CHECK("sid:") @@ -926,22 +944,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { do_new_fb(1); } } - } else if (strstr(p, "waitmapped") == p) { + goto done; + } + if (strstr(p, "waitmapped") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, subwin_wait_mapped); goto qry; } subwin_wait_mapped = 1; - } else if (strstr(p, "nowaitmapped") == p) { + goto done; + } + if (strstr(p, "nowaitmapped") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !subwin_wait_mapped); goto qry; } subwin_wait_mapped = 0; - - } else if (!strcmp(p, "clip") || + goto done; + } + if (!strcmp(p, "clip") || strstr(p, "clip:") == p) { /* skip-cmd-list */ COLON_CHECK("clip:") if (query) { @@ -955,23 +978,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { /* OK, this requires a new fb... */ do_new_fb(1); - - } else if (!strcmp(p, "flashcmap")) { + goto done; + } + if (!strcmp(p, "flashcmap")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, flash_cmap); goto qry; } rfbLog("remote_cmd: turning on flashcmap mode.\n"); flash_cmap = 1; - } else if (!strcmp(p, "noflashcmap")) { + goto done; + } + if (!strcmp(p, "noflashcmap")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !flash_cmap); goto qry; } rfbLog("remote_cmd: turning off flashcmap mode.\n"); flash_cmap = 0; - - } else if (strstr(p, "shiftcmap") == p) { + goto done; + } + if (strstr(p, "shiftcmap") == p) { COLON_CHECK("shiftcmap:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, shift_cmap); @@ -981,8 +1008,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { shift_cmap = atoi(p); rfbLog("remote_cmd: set -shiftcmap %d\n", shift_cmap); do_new_fb(1); - - } else if (!strcmp(p, "truecolor")) { + goto done; + } + if (!strcmp(p, "truecolor")) { int orig = force_indexed_color; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, @@ -994,7 +1022,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (orig != force_indexed_color) { if_8bpp_do_new_fb(); } - } else if (!strcmp(p, "notruecolor")) { + goto done; + } + if (!strcmp(p, "notruecolor")) { int orig = force_indexed_color; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, @@ -1006,8 +1036,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (orig != force_indexed_color) { if_8bpp_do_new_fb(); } - - } else if (!strcmp(p, "overlay")) { + goto done; + } + if (!strcmp(p, "overlay")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, overlay); goto qry; @@ -1028,7 +1059,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { overlay = 1; do_new_fb(reset_mem); } - } else if (!strcmp(p, "nooverlay")) { + goto done; + } + if (!strcmp(p, "nooverlay")) { int orig = overlay; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !overlay); @@ -1044,8 +1077,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { /* here we go... */ do_new_fb(0); } - - } else if (!strcmp(p, "overlay_cursor") || + goto done; + } + if (!strcmp(p, "overlay_cursor") || !strcmp(p, "overlay_yescursor") || !strcmp(p, "nooverlay_nocursor")) { if (query) { @@ -1063,7 +1097,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog(" -R cursor:none to disable any extra " "cursors.\n"); } - } else if (!strcmp(p, "nooverlay_cursor") || + goto done; + } + if (!strcmp(p, "nooverlay_cursor") || !strcmp(p, "nooverlay_yescursor") || !strcmp(p, "overlay_nocursor")) { if (query) { @@ -1080,8 +1116,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("You may want to run -R show_cursor or\n"); rfbLog(" -R cursor:... to re-enable any cursors.\n"); } - - } else if (!strcmp(p, "8to24")) { + goto done; + } + if (!strcmp(p, "8to24")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, cmap8to24); goto qry; @@ -1097,8 +1134,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { overlay = 0; } do_new_fb(0); - - } else if (!strcmp(p, "no8to24")) { + goto done; + } + if (!strcmp(p, "no8to24")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !cmap8to24); goto qry; @@ -1106,8 +1144,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: turning off -8to24 mode.\n"); cmap8to24 = 0; do_new_fb(0); - - } else if (strstr(p, "8to24_opts") == p) { + goto done; + } + if (strstr(p, "8to24_opts") == p) { COLON_CHECK("8to24_opts:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -1126,8 +1165,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: set cmap8to24_str to: %s\n", cmap8to24_str); do_new_fb(0); - - } else if (!strcmp(p, "24to32")) { + goto done; + } + if (!strcmp(p, "24to32")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, xform24to32); goto qry; @@ -1135,8 +1175,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: turning on -24to32 mode.\n"); xform24to32 = 1; do_new_fb(1); - - } else if (!strcmp(p, "no24to32")) { + goto done; + } + if (!strcmp(p, "no24to32")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !xform24to32); goto qry; @@ -1154,8 +1195,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } xform24to32 = 0; do_new_fb(1); - - } else if (strstr(p, "visual") == p) { + goto done; + } + if (strstr(p, "visual") == p) { COLON_CHECK("visual:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -1168,8 +1210,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { /* OK, this requires a new fb... */ do_new_fb(0); - - } else if (!strcmp(p, "scale") || + goto done; + } + if (!strcmp(p, "scale") || strstr(p, "scale:") == p) { /* skip-cmd-list */ COLON_CHECK("scale:") if (query) { @@ -1184,8 +1227,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { /* OK, this requires a new fb... */ check_black_fb(); do_new_fb(0); - - } else if (!strcmp(p, "scale_cursor") || + goto done; + } + if (!strcmp(p, "scale_cursor") || strstr(p, "scale_cursor:") == p) { /* skip-cmd-list */ COLON_CHECK("scale_cursor:") if (query) { @@ -1201,15 +1245,18 @@ char *process_remote_cmd(char *cmd, int stringonly) { scale_cursor_str = strdup(p); } setup_cursors_and_push(); - - } else if (!strcmp(p, "viewonly")) { + goto done; + } + if (!strcmp(p, "viewonly")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, view_only); goto qry; } rfbLog("remote_cmd: enable viewonly mode.\n"); view_only = 1; - } else if (!strcmp(p, "noviewonly")) { + goto done; + } + if (!strcmp(p, "noviewonly")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !view_only); goto qry; @@ -1217,8 +1264,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: disable viewonly mode.\n"); view_only = 0; if (raw_fb) set_raw_fb_params(0); - - } else if (!strcmp(p, "shared")) { + goto done; + } + if (!strcmp(p, "shared")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, shared); goto qry; } @@ -1228,7 +1276,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { screen->alwaysShared = TRUE; screen->neverShared = FALSE; } - } else if (!strcmp(p, "noshared")) { + goto done; + } + if (!strcmp(p, "noshared")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !shared); goto qry; } @@ -1238,23 +1288,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { screen->alwaysShared = FALSE; screen->neverShared = TRUE; } - - } else if (!strcmp(p, "forever")) { + goto done; + } + if (!strcmp(p, "forever")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, 1-connect_once); goto qry; } rfbLog("remote_cmd: enable -forever mode.\n"); connect_once = 0; - } else if (!strcmp(p, "noforever") || !strcmp(p, "once")) { + goto done; + } + if (!strcmp(p, "noforever") || !strcmp(p, "once")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, connect_once); goto qry; } rfbLog("remote_cmd: disable -forever mode.\n"); connect_once = 1; - - } else if (strstr(p, "timeout") == p) { + goto done; + } + if (strstr(p, "timeout") == p) { int to; COLON_CHECK("timeout:") if (query) { @@ -1269,8 +1323,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } first_conn_timeout = to; rfbLog("remote_cmd: set -timeout to %d\n", -to); - - } else if (!strcmp(p, "tightfilexfer")) { + goto done; + } + if (!strcmp(p, "tightfilexfer")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, tightfilexfer); goto qry; @@ -1285,8 +1340,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { #else rfbLog("remote_cmd: -tightfilexfer not supported in this binary.\n"); #endif - - } else if (!strcmp(p, "notightfilexfer")) { + goto done; + } + if (!strcmp(p, "notightfilexfer")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !tightfilexfer); goto qry; @@ -1301,8 +1357,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { #else rfbLog("remote_cmd: -tightfilexfer not supported in this binary.\n"); #endif - - } else if (!strcmp(p, "ultrafilexfer")) { + goto done; + } + if (!strcmp(p, "ultrafilexfer")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, screen->permitFileTransfer == TRUE); goto qry; @@ -1311,8 +1368,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enabling -ultrafilexfer for clients.\n"); screen->permitFileTransfer = TRUE; } - - } else if (!strcmp(p, "noultrafilexfer")) { + goto done; + } + if (!strcmp(p, "noultrafilexfer")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, screen->permitFileTransfer == FALSE); goto qry; @@ -1321,8 +1379,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: disabling -ultrafilexfer for clients.\n"); screen->permitFileTransfer = FALSE; } - - } else if (strstr(p, "rfbversion") == p) { + goto done; + } + if (strstr(p, "rfbversion") == p) { int maj, min; COLON_CHECK("rfbversion:") if (query) { @@ -1338,24 +1397,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { rfbLog("remote_cmd: invalid rfbversion: %s\n", p); } - - - } else if (!strcmp(p, "deny") || !strcmp(p, "lock")) { + goto done; + } + if (!strcmp(p, "deny") || !strcmp(p, "lock")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, deny_all); goto qry; } rfbLog("remote_cmd: denying new connections.\n"); deny_all = 1; - } else if (!strcmp(p, "nodeny") || !strcmp(p, "unlock")) { + goto done; + } + if (!strcmp(p, "nodeny") || !strcmp(p, "unlock")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !deny_all); goto qry; } rfbLog("remote_cmd: allowing new connections.\n"); deny_all = 0; - - } else if (!strcmp(p, "avahi") || !strcmp(p, "mdns")) { + goto done; + } + if (!strcmp(p, "avahi") || !strcmp(p, "mdns")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, avahi); goto qry; @@ -1367,7 +1429,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { avahi_advertise(vnc_desktop_name, this_host(), screen->port); } - } else if (!strcmp(p, "noavahi") || !strcmp(p, "nomdns")) { + goto done; + } + if (!strcmp(p, "noavahi") || !strcmp(p, "nomdns")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !avahi); goto qry; @@ -1377,15 +1441,17 @@ char *process_remote_cmd(char *cmd, int stringonly) { avahi = 0; avahi_reset(); } - - } else if (strstr(p, "connect") == p) { + goto done; + } + if (strstr(p, "connect") == p) { NOTAPP COLON_CHECK("connect:") p += strlen("connect:"); /* this is a reverse connection */ reverse_connect(p); - - } else if (strstr(p, "proxy") == p) { + goto done; + } + if (strstr(p, "proxy") == p) { COLON_CHECK("proxy:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -1403,8 +1469,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { connect_proxy = strdup(p); rfbLog("remote_cmd: set -proxy %s\n", connect_proxy); } - - } else if (strstr(p, "allowonce") == p) { + goto done; + } + if (strstr(p, "allowonce") == p) { COLON_CHECK("allowonce:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -1414,8 +1481,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("allowonce:"); allow_once = strdup(p); rfbLog("remote_cmd: set allow_once %s\n", allow_once); - - } else if (strstr(p, "allow") == p) { + goto done; + } + if (strstr(p, "allow") == p) { char *before, *old; COLON_CHECK("allow:") if (query) { @@ -1458,8 +1526,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } if (old) free(old); free(before); - - } else if (!strcmp(p, "localhost")) { + goto done; + } + if (!strcmp(p, "localhost")) { char *before, *old; if (query) { int state = 0; @@ -1500,7 +1569,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (screen->httpListenSock > -1) { reset_httpport(-1, screen->httpPort); } - } else if (!strcmp(p, "nolocalhost")) { + goto done; + } + if (!strcmp(p, "nolocalhost")) { char *before, *old; if (query) { int state = 0; @@ -1545,8 +1616,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (screen->httpListenSock > -1) { reset_httpport(-1, screen->httpPort); } - - } else if (strstr(p, "listen") == p) { + goto done; + } + if (strstr(p, "listen") == p) { char *before; int ok, mod = 0; @@ -1640,22 +1712,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { free(listen_str); listen_str = before; } - } else if (!strcmp(p, "lookup")) { + goto done; + } + if (!strcmp(p, "lookup")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, host_lookup); goto qry; } rfbLog("remote_cmd: enabling hostname lookup.\n"); host_lookup = 1; - } else if (!strcmp(p, "nolookup")) { + goto done; + } + if (!strcmp(p, "nolookup")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !host_lookup); goto qry; } rfbLog("remote_cmd: disabling hostname lookup.\n"); host_lookup = 0; - - } else if (strstr(p, "accept") == p) { + goto done; + } + if (strstr(p, "accept") == p) { int doit = 1, safe = 0; COLON_CHECK("accept:") if (query) { @@ -1676,8 +1753,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (accept_cmd) free(accept_cmd); accept_cmd = strdup(p); } - - } else if (strstr(p, "afteraccept") == p) { + goto done; + } + if (strstr(p, "afteraccept") == p) { int safe = 0; COLON_CHECK("afteraccept:") if (query) { @@ -1695,8 +1773,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (afteraccept_cmd) free(afteraccept_cmd); afteraccept_cmd = strdup(p); } - - } else if (strstr(p, "gone") == p) { + goto done; + } + if (strstr(p, "gone") == p) { int safe = 0; COLON_CHECK("gone:") if (query) { @@ -1714,8 +1793,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (gone_cmd) free(gone_cmd); gone_cmd = strdup(p); } - - } else if (!strcmp(p, "shm")) { + goto done; + } + if (!strcmp(p, "shm")) { int orig = using_shm; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, using_shm); @@ -1730,7 +1810,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { rfbLog(" already in shm mode.\n"); } - } else if (!strcmp(p, "noshm")) { + goto done; + } + if (!strcmp(p, "noshm")) { int orig = using_shm; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !using_shm); @@ -1743,8 +1825,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { rfbLog(" already in noshm mode.\n"); } - - } else if (!strcmp(p, "flipbyteorder")) { + goto done; + } + if (!strcmp(p, "flipbyteorder")) { int orig = flip_byte_order; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, flip_byte_order); @@ -1759,7 +1842,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog(" using shm, not resetting fb\n"); } } - } else if (!strcmp(p, "noflipbyteorder")) { + goto done; + } + if (!strcmp(p, "noflipbyteorder")) { int orig = flip_byte_order; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !flip_byte_order); @@ -1774,15 +1859,18 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog(" using shm, not resetting fb\n"); } } - - } else if (!strcmp(p, "onetile")) { + goto done; + } + if (!strcmp(p, "onetile")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, single_copytile); goto qry; } rfbLog("remote_cmd: enable -onetile mode.\n"); single_copytile = 1; - } else if (!strcmp(p, "noonetile")) { + goto done; + } + if (!strcmp(p, "noonetile")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !single_copytile); goto qry; @@ -1794,8 +1882,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } single_copytile = 0; - - } else if (strstr(p, "solid_color") == p) { + goto done; + } + if (strstr(p, "solid_color") == p) { /* * n.b. this solid stuff perhaps should reflect * safe_remote_only but at least the command names @@ -1830,7 +1919,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (doit && client_count) { solid_bg(0); } - } else if (!strcmp(p, "solid")) { + goto done; + } + if (!strcmp(p, "solid")) { int orig = use_solid_bg; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, use_solid_bg); @@ -1845,7 +1936,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (client_count && !orig) { solid_bg(0); } - } else if (!strcmp(p, "nosolid")) { + goto done; + } + if (!strcmp(p, "nosolid")) { int orig = use_solid_bg; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !use_solid_bg); @@ -1856,8 +1949,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (client_count && orig) { solid_bg(1); } - - } else if (strstr(p, "blackout") == p) { + goto done; + } + if (strstr(p, "blackout") == p) { char *before, *old; COLON_CHECK("blackout:") if (query) { @@ -1895,8 +1989,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } if (old) free(old); free(before); - - } else if (!strcmp(p, "xinerama")) { + goto done; + } + if (!strcmp(p, "xinerama")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, xinerama); goto qry; @@ -1904,7 +1999,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enable xinerama mode. (if applicable).\n"); xinerama = 1; initialize_blackouts_and_xinerama(); - } else if (!strcmp(p, "noxinerama")) { + goto done; + } + if (!strcmp(p, "noxinerama")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !xinerama); goto qry; @@ -1912,8 +2009,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: disable xinerama mode. (if applicable).\n"); xinerama = 0; initialize_blackouts_and_xinerama(); - - } else if (!strcmp(p, "xtrap")) { + goto done; + } + if (!strcmp(p, "xtrap")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, xtrap_input); goto qry; @@ -1924,8 +2022,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { xtrap_input = 1; disable_grabserver(dpy, 1); } - - } else if (!strcmp(p, "noxtrap")) { + goto done; + } + if (!strcmp(p, "noxtrap")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !xtrap_input); goto qry; @@ -1936,8 +2035,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { xtrap_input = 0; disable_grabserver(dpy, 1); } - - } else if (!strcmp(p, "xrandr")) { + goto done; + } + if (!strcmp(p, "xrandr")) { int orig = xrandr; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, xrandr); goto qry; @@ -1955,7 +2055,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { rfbLog("remote_cmd: XRANDR ext. not present.\n"); } - } else if (!strcmp(p, "noxrandr")) { + goto done; + } + if (!strcmp(p, "noxrandr")) { int orig = xrandr; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !xrandr); goto qry; @@ -1970,7 +2072,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { rfbLog("remote_cmd: XRANDR ext. not present.\n"); } - } else if (strstr(p, "xrandr_mode") == p) { + goto done; + } + if (strstr(p, "xrandr_mode") == p) { int orig = xrandr; COLON_CHECK("xrandr_mode:") if (query) { @@ -2007,8 +2111,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { rfbLog("remote_cmd: XRANDR ext. not present.\n"); } - - } else if (strstr(p, "rotate") == p) { + goto done; + } + if (strstr(p, "rotate") == p) { COLON_CHECK("rotate:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -2021,8 +2126,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: set rotate to \"%s\"\n", rotating_str); do_new_fb(0); - - } else if (strstr(p, "padgeom") == p) { + goto done; + } + if (strstr(p, "padgeom") == p) { COLON_CHECK("padgeom:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -2039,21 +2145,25 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: set padgeom to: %s\n", pad_geometry); } - - } else if (!strcmp(p, "quiet") || !strcmp(p, "q")) { + goto done; + } + if (!strcmp(p, "quiet") || !strcmp(p, "q")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, quiet); goto qry; } rfbLog("remote_cmd: turning on quiet mode.\n"); quiet = 1; - } else if (!strcmp(p, "noquiet")) { + goto done; + } + if (!strcmp(p, "noquiet")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !quiet); goto qry; } rfbLog("remote_cmd: turning off quiet mode.\n"); quiet = 0; - - } else if (!strcmp(p, "modtweak")) { + goto done; + } + if (!strcmp(p, "modtweak")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, use_modifier_tweak); goto qry; @@ -2064,8 +2174,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { initialize_modtweak(); } use_modifier_tweak = 1; - - } else if (!strcmp(p, "nomodtweak")) { + goto done; + } + if (!strcmp(p, "nomodtweak")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !use_modifier_tweak); @@ -2074,8 +2185,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enabling -nomodtweak mode.\n"); got_nomodtweak = 1; use_modifier_tweak = 0; - - } else if (!strcmp(p, "xkb")) { + goto done; + } + if (!strcmp(p, "xkb")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, use_xkb_modtweak); goto qry; @@ -2094,8 +2206,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } use_modifier_tweak = 1; use_xkb_modtweak = 1; - - } else if (!strcmp(p, "noxkb")) { + goto done; + } + if (!strcmp(p, "noxkb")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !use_xkb_modtweak); goto qry; @@ -2109,40 +2222,45 @@ char *process_remote_cmd(char *cmd, int stringonly) { use_xkb_modtweak = 0; got_noxkb = 1; initialize_modtweak(); - - } else if (!strcmp(p, "capslock")) { + goto done; + } + if (!strcmp(p, "capslock")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, watch_capslock); goto qry; } rfbLog("remote_cmd: enabling -capslock mode\n"); watch_capslock = 1; - - } else if (!strcmp(p, "nocapslock")) { + goto done; + } + if (!strcmp(p, "nocapslock")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !watch_capslock); goto qry; } rfbLog("remote_cmd: disabling -capslock mode\n"); watch_capslock = 0; - - } else if (!strcmp(p, "skip_lockkeys")) { + goto done; + } + if (!strcmp(p, "skip_lockkeys")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, skip_lockkeys); goto qry; } rfbLog("remote_cmd: enabling -skip_lockkeys mode\n"); skip_lockkeys = 1; - - } else if (!strcmp(p, "noskip_lockkeys")) { + goto done; + } + if (!strcmp(p, "noskip_lockkeys")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !skip_lockkeys); goto qry; } rfbLog("remote_cmd: disabling -skip_lockkeys mode\n"); skip_lockkeys = 0; - - } else if (strstr(p, "skip_keycodes") == p) { + goto done; + } + if (strstr(p, "skip_keycodes") == p) { COLON_CHECK("skip_keycodes:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -2165,23 +2283,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (skip_keycodes) free(skip_keycodes); skip_keycodes = strdup(p); initialize_modtweak(); - - } else if (!strcmp(p, "sloppy_keys")) { + goto done; + } + if (!strcmp(p, "sloppy_keys")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, sloppy_keys); goto qry; } sloppy_keys += 1; rfbLog("remote_cmd: set sloppy_keys to: %d\n", sloppy_keys); - } else if (!strcmp(p, "nosloppy_keys")) { + goto done; + } + if (!strcmp(p, "nosloppy_keys")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !sloppy_keys); goto qry; } sloppy_keys = 0; rfbLog("remote_cmd: set sloppy_keys to: %d\n", sloppy_keys); - - } else if (!strcmp(p, "skip_dups")) { + goto done; + } + if (!strcmp(p, "skip_dups")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, skip_duplicate_key_events); @@ -2189,7 +2311,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: enabling -skip_dups mode\n"); skip_duplicate_key_events = 1; - } else if (!strcmp(p, "noskip_dups")) { + goto done; + } + if (!strcmp(p, "noskip_dups")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !skip_duplicate_key_events); @@ -2197,24 +2321,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: disabling -skip_dups mode\n"); skip_duplicate_key_events = 0; - - } else if (!strcmp(p, "add_keysyms")) { + goto done; + } + if (!strcmp(p, "add_keysyms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, add_keysyms); goto qry; } rfbLog("remote_cmd: enabling -add_keysyms mode.\n"); add_keysyms = 1; - - } else if (!strcmp(p, "noadd_keysyms")) { + goto done; + } + if (!strcmp(p, "noadd_keysyms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !add_keysyms); goto qry; } rfbLog("remote_cmd: disabling -add_keysyms mode.\n"); add_keysyms = 0; - - } else if (!strcmp(p, "clear_mods")) { + goto done; + } + if (!strcmp(p, "clear_mods")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, clear_mods == 1); goto qry; @@ -2222,8 +2349,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enabling -clear_mods mode.\n"); clear_mods = 1; clear_modifiers(0); - - } else if (!strcmp(p, "noclear_mods")) { + goto done; + } + if (!strcmp(p, "noclear_mods")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !(clear_mods == 1)); @@ -2231,8 +2359,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: disabling -clear_mods mode.\n"); clear_mods = 0; - - } else if (!strcmp(p, "clear_keys")) { + goto done; + } + if (!strcmp(p, "clear_keys")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, clear_mods == 2); @@ -2241,8 +2370,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enabling -clear_keys mode.\n"); clear_mods = 2; clear_keys(); - - } else if (!strcmp(p, "noclear_keys")) { + goto done; + } + if (!strcmp(p, "noclear_keys")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !(clear_mods == 2)); @@ -2250,8 +2380,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: disabling -clear_keys mode.\n"); clear_mods = 0; - - } else if (!strcmp(p, "clear_all")) { + goto done; + } + if (!strcmp(p, "clear_all")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, clear_mods == 3); @@ -2261,13 +2392,15 @@ char *process_remote_cmd(char *cmd, int stringonly) { clear_mods = 3; clear_keys(); clear_locks(); - - } else if (!strcmp(p, "clear_locks")) { + goto done; + } + if (!strcmp(p, "clear_locks")) { NOTAPP rfbLog("remote_cmd: doing clear_locks action.\n"); clear_locks(); - - } else if (!strcmp(p, "keystate")) { + goto done; + } + if (!strcmp(p, "keystate")) { int i, state[256]; NOTAPP for (i=0; i<256; i++) { @@ -2277,8 +2410,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { for (i=0; i<256; i++) { fprintf(stderr, "keystate[%03d] %d\n", i, state[i]); } - - } else if (strstr(p, "remap") == p) { + goto done; + } + if (strstr(p, "remap") == p) { char *before, *old; COLON_CHECK("remap:") if (query) { @@ -2319,8 +2453,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } if (old) free(old); free(before); - - } else if (!strcmp(p, "repeat")) { + goto done; + } + if (!strcmp(p, "repeat")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !no_autorepeat); goto qry; @@ -2328,8 +2463,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enabling -repeat mode.\n"); autorepeat(1, 0); /* restore initial setting */ no_autorepeat = 0; - - } else if (!strcmp(p, "norepeat")) { + goto done; + } + if (!strcmp(p, "norepeat")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, no_autorepeat); goto qry; @@ -2342,8 +2478,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (client_count && ! view_only) { autorepeat(0, 0); /* disable if any clients */ } - - } else if (!strcmp(p, "fb")) { + goto done; + } + if (!strcmp(p, "fb")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !nofb); goto qry; @@ -2358,7 +2495,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { set_nofb_params(1); do_new_fb(1); } - } else if (!strcmp(p, "nofb")) { + goto done; + } + if (!strcmp(p, "nofb")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, nofb); goto qry; @@ -2374,8 +2513,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { set_nofb_params(0); do_new_fb(1); } - - } else if (!strcmp(p, "bell")) { + goto done; + } + if (!strcmp(p, "bell")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, sound_bell); goto qry; @@ -2383,8 +2523,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: enabling bell (if supported).\n"); initialize_watch_bell(); sound_bell = 1; - - } else if (!strcmp(p, "nobell")) { + goto done; + } + if (!strcmp(p, "nobell")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !sound_bell); goto qry; @@ -2392,8 +2533,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: disabling bell.\n"); initialize_watch_bell(); sound_bell = 0; - - } else if (!strcmp(p, "sel")) { + goto done; + } + if (!strcmp(p, "sel")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, watch_selection); goto qry; @@ -2402,8 +2544,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { watch_selection = 1; watch_primary = 1; watch_clipboard = 1; - - } else if (!strcmp(p, "nosel")) { + goto done; + } + if (!strcmp(p, "nosel")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !watch_selection); goto qry; @@ -2412,72 +2555,81 @@ char *process_remote_cmd(char *cmd, int stringonly) { watch_selection = 0; watch_primary = 0; watch_clipboard = 0; - - } else if (!strcmp(p, "primary")) { + goto done; + } + if (!strcmp(p, "primary")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, watch_primary); goto qry; } rfbLog("remote_cmd: enabling watch_primary.\n"); watch_primary = 1; - - } else if (!strcmp(p, "noprimary")) { + goto done; + } + if (!strcmp(p, "noprimary")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !watch_primary); goto qry; } rfbLog("remote_cmd: disabling watch_primary.\n"); watch_primary = 0; - - } else if (!strcmp(p, "setprimary")) { + goto done; + } + if (!strcmp(p, "setprimary")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, set_primary); goto qry; } rfbLog("remote_cmd: enabling set_primary.\n"); set_primary = 1; - - } else if (!strcmp(p, "nosetprimary")) { + goto done; + } + if (!strcmp(p, "nosetprimary")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !set_primary); goto qry; } rfbLog("remote_cmd: disabling set_primary.\n"); set_primary = 0; - - } else if (!strcmp(p, "clipboard")) { + goto done; + } + if (!strcmp(p, "clipboard")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, watch_clipboard); goto qry; } rfbLog("remote_cmd: enabling watch_clipboard.\n"); watch_clipboard = 1; - - } else if (!strcmp(p, "noclipboard")) { + goto done; + } + if (!strcmp(p, "noclipboard")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !watch_clipboard); goto qry; } rfbLog("remote_cmd: disabling watch_clipboard.\n"); watch_clipboard = 0; - - } else if (!strcmp(p, "setclipboard")) { + goto done; + } + if (!strcmp(p, "setclipboard")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, set_clipboard); goto qry; } rfbLog("remote_cmd: enabling set_clipboard.\n"); set_clipboard = 1; - - } else if (!strcmp(p, "nosetclipboard")) { + goto done; + } + if (!strcmp(p, "nosetclipboard")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !set_clipboard); goto qry; } rfbLog("remote_cmd: disabling set_clipboard.\n"); set_clipboard = 0; - - } else if (strstr(p, "seldir") == p) { + goto done; + } + if (strstr(p, "seldir") == p) { COLON_CHECK("seldir:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -2488,12 +2640,14 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting -seldir to %s\n", p); if (sel_direction) free(sel_direction); sel_direction = strdup(p); - - } else if (!strcmp(p, "set_no_cursor")) { /* skip-cmd-list */ + goto done; + } + if (!strcmp(p, "set_no_cursor")) { /* skip-cmd-list */ rfbLog("remote_cmd: calling set_no_cursor()\n"); set_no_cursor(); - - } else if (!strcmp(p, "cursorshape")) { + goto done; + } + if (!strcmp(p, "cursorshape")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, cursor_shape_updates); @@ -2505,7 +2659,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { cursor_shape_updates = 1; restore_cursor_shape_updates(screen); first_cursor(); - } else if (!strcmp(p, "nocursorshape")) { + goto done; + } + if (!strcmp(p, "nocursorshape")) { int i, max = 5; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, @@ -2522,8 +2678,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { cursor_shape_updates = 0; disable_cursor_shape_updates(screen); first_cursor(); - - } else if (!strcmp(p, "cursorpos")) { + goto done; + } + if (!strcmp(p, "cursorpos")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, cursor_pos_updates); @@ -2531,7 +2688,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: turning on cursorpos mode.\n"); cursor_pos_updates = 1; - } else if (!strcmp(p, "nocursorpos")) { + goto done; + } + if (!strcmp(p, "nocursorpos")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !cursor_pos_updates); @@ -2539,23 +2698,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: turning off cursorpos mode.\n"); cursor_pos_updates = 0; - - } else if (!strcmp(p, "cursor_drag")) { + goto done; + } + if (!strcmp(p, "cursor_drag")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, cursor_drag_changes); goto qry; } cursor_drag_changes = 1; rfbLog("remote_cmd: setting cursor_drag_changes: %d.\n", cursor_drag_changes); - } else if (!strcmp(p, "nocursor_drag")) { + goto done; + } + if (!strcmp(p, "nocursor_drag")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !cursor_drag_changes); goto qry; } cursor_drag_changes = 0; rfbLog("remote_cmd: setting cursor_drag_changes: %d.\n", cursor_drag_changes); - - } else if (strstr(p, "cursor") == p) { + goto done; + } + if (strstr(p, "cursor") == p) { COLON_CHECK("cursor:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -2580,8 +2743,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } initialize_cursors_mode(); first_cursor(); - - } else if (!strcmp(p, "show_cursor")) { + goto done; + } + if (!strcmp(p, "show_cursor")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, show_cursor); goto qry; @@ -2602,7 +2766,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } initialize_cursors_mode(); first_cursor(); - } else if (!strcmp(p, "noshow_cursor") || !strcmp(p, "nocursor")) { + goto done; + } + if (!strcmp(p, "noshow_cursor") || !strcmp(p, "nocursor")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !show_cursor); goto qry; @@ -2614,8 +2780,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { show_cursor = 0; initialize_cursors_mode(); first_cursor(); - - } else if (strstr(p, "arrow") == p) { + goto done; + } + if (strstr(p, "arrow") == p) { COLON_CHECK("arrow:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, alt_arrow); @@ -2625,8 +2792,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { alt_arrow = atoi(p); rfbLog("remote_cmd: setting alt_arrow: %d.\n", alt_arrow); setup_cursors_and_push(); - - } else if (!strcmp(p, "xfixes")) { + goto done; + } + if (!strcmp(p, "xfixes")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, use_xfixes); goto qry; @@ -2641,7 +2809,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { use_xfixes = 1; initialize_xfixes(); first_cursor(); - } else if (!strcmp(p, "noxfixes")) { + goto done; + } + if (!strcmp(p, "noxfixes")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !use_xfixes); goto qry; @@ -2655,8 +2825,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { use_xfixes = 0; initialize_xfixes(); first_cursor(); - - } else if (!strcmp(p, "xdamage")) { + goto done; + } + if (!strcmp(p, "xdamage")) { int orig = use_xdamage; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, use_xdamage); @@ -2674,7 +2845,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { initialize_xdamage(); create_xdamage_if_needed(); } - } else if (!strcmp(p, "noxdamage")) { + goto done; + } + if (!strcmp(p, "noxdamage")) { int orig = use_xdamage; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !use_xdamage); @@ -2691,8 +2864,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { initialize_xdamage(); destroy_xdamage_if_needed(); } - - } else if (strstr(p, "xd_area") == p) { + goto done; + } + if (strstr(p, "xd_area") == p) { int a; COLON_CHECK("xd_area:") if (query) { @@ -2707,7 +2881,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { "%d -> %d.\n", xdamage_max_area, a); xdamage_max_area = a; } - } else if (strstr(p, "xd_mem") == p) { + goto done; + } + if (strstr(p, "xd_mem") == p) { double a; COLON_CHECK("xd_mem:") if (query) { @@ -2722,8 +2898,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { "%.3f -> %.3f.\n", xdamage_memory, a); xdamage_memory = a; } - - } else if (strstr(p, "alphacut") == p) { + goto done; + } + if (strstr(p, "alphacut") == p) { int a; COLON_CHECK("alphacut:") if (query) { @@ -2745,7 +2922,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { alpha_threshold = a; setup_cursors_and_push(); } - } else if (strstr(p, "alphafrac") == p) { + goto done; + } + if (strstr(p, "alphafrac") == p) { double a; COLON_CHECK("alphafrac:") if (query) { @@ -2763,7 +2942,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { alpha_frac = a; setup_cursors_and_push(); } - } else if (strstr(p, "alpharemove") == p) { + goto done; + } + if (strstr(p, "alpharemove") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, alpha_remove); goto qry; @@ -2773,7 +2954,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { alpha_remove = 1; setup_cursors_and_push(); } - } else if (strstr(p, "noalpharemove") == p) { + goto done; + } + if (strstr(p, "noalpharemove") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !alpha_remove); goto qry; @@ -2783,7 +2966,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { alpha_remove = 0; setup_cursors_and_push(); } - } else if (strstr(p, "alphablend") == p) { + goto done; + } + if (strstr(p, "alphablend") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, alpha_blend); goto qry; @@ -2794,7 +2979,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { alpha_blend = 1; setup_cursors_and_push(); } - } else if (strstr(p, "noalphablend") == p) { + goto done; + } + if (strstr(p, "noalphablend") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !alpha_blend); goto qry; @@ -2804,15 +2991,18 @@ char *process_remote_cmd(char *cmd, int stringonly) { alpha_blend = 0; setup_cursors_and_push(); } - - } else if (strstr(p, "xwarppointer") == p || strstr(p, "xwarp") == p) { + goto done; + } + if (strstr(p, "xwarppointer") == p || strstr(p, "xwarp") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, use_xwarppointer); goto qry; } rfbLog("remote_cmd: turning on xwarppointer mode.\n"); use_xwarppointer = 1; - } else if (strstr(p, "noxwarppointer") == p || + goto done; + } + if (strstr(p, "noxwarppointer") == p || strstr(p, "noxwarp") == p) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !use_xwarppointer); @@ -2820,8 +3010,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: turning off xwarppointer mode.\n"); use_xwarppointer = 0; - - } else if (strstr(p, "buttonmap") == p) { + goto done; + } + if (strstr(p, "buttonmap") == p) { COLON_CHECK("buttonmap:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -2834,31 +3025,37 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting -buttonmap to:\n\t'%s'\n", p); initialize_pointer_map(p); - - } else if (!strcmp(p, "dragging")) { + goto done; + } + if (!strcmp(p, "dragging")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, show_dragging); goto qry; } rfbLog("remote_cmd: enabling mouse dragging mode.\n"); show_dragging = 1; - } else if (!strcmp(p, "nodragging")) { + goto done; + } + if (!strcmp(p, "nodragging")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !show_dragging); goto qry; } rfbLog("remote_cmd: enabling mouse nodragging mode.\n"); show_dragging = 0; - + goto done; + } #ifndef NO_NCACHE - } else if (!strcmp(p, "ncache_cr")) { + if (!strcmp(p, "ncache_cr")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, ncache_copyrect); goto qry; } ncache_copyrect = 1; rfbLog("remote_cmd: set -ncache_cr %d\n", ncache_copyrect); - } else if (!strcmp(p, "noncache_cr")) { + goto done; + } + if (!strcmp(p, "noncache_cr")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncache_copyrect); goto qry; @@ -2866,37 +3063,45 @@ char *process_remote_cmd(char *cmd, int stringonly) { ncache_copyrect = 0; rfbLog("remote_cmd: disabled -ncache_cr %d\n", ncache_copyrect); - } else if (!strcmp(p, "ncache_no_moveraise")) { + goto done; + } + if (!strcmp(p, "ncache_no_moveraise")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncache_wf_raises); goto qry; } ncache_wf_raises = 0; rfbLog("remote_cmd: set -ncache_no_moveraise\n"); - } else if (!strcmp(p, "noncache_no_moveraise")) { + goto done; + } + if (!strcmp(p, "noncache_no_moveraise")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, ncache_wf_raises); goto qry; } ncache_wf_raises = 1; rfbLog("remote_cmd: disabled -ncache_no_moveraise\n"); - - } else if (!strcmp(p, "ncache_no_dtchange")) { + goto done; + } + if (!strcmp(p, "ncache_no_dtchange")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncache_dt_change); goto qry; } ncache_dt_change = 0; rfbLog("remote_cmd: set -ncache_no_dt_change\n"); - } else if (!strcmp(p, "noncache_no_dtchange")) { + goto done; + } + if (!strcmp(p, "noncache_no_dtchange")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, ncache_dt_change); goto qry; } ncache_dt_change = 1; rfbLog("remote_cmd: disabled -ncache_no_dt_change\n"); - - } else if (!strcmp(p, "ncache_no_rootpixmap")) { + goto done; + } + if (!strcmp(p, "ncache_no_rootpixmap")) { int orig = ncache_xrootpmap; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncache_xrootpmap); @@ -2907,7 +3112,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (orig != ncache_xrootpmap) { do_new_fb(1); } - } else if (!strcmp(p, "noncache_no_rootpixmap")) { + goto done; + } + if (!strcmp(p, "noncache_no_rootpixmap")) { int orig = ncache_xrootpmap; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, ncache_xrootpmap); @@ -2918,8 +3125,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (orig != ncache_xrootpmap) { do_new_fb(1); } - - } else if (!strcmp(p, "ncache_reset_rootpixmap") || !strcmp(p, "ncrp")) { + goto done; + } + if (!strcmp(p, "ncache_reset_rootpixmap") || !strcmp(p, "ncrp")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncache_xrootpmap); goto qry; @@ -2928,8 +3136,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: resetting root pixmap.\n"); set_ncache_xrootpmap(); } - - } else if (!strcmp(p, "ncache_keep_anims")) { + goto done; + } + if (!strcmp(p, "ncache_keep_anims")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, ncache_keep_anims); goto qry; @@ -2937,7 +3146,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { kde_no_animate(0); ncache_keep_anims = 1; rfbLog("remote_cmd: set -ncache_keep_anims\n"); - } else if (!strcmp(p, "noncache_keep_anims")) { + goto done; + } + if (!strcmp(p, "noncache_keep_anims")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncache_keep_anims); goto qry; @@ -2945,23 +3156,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { ncache_keep_anims = 0; kde_no_animate(1); rfbLog("remote_cmd: disabled -ncache_keep_anims\n"); - - } else if (!strcmp(p, "ncache_old_wm")) { + goto done; + } + if (!strcmp(p, "ncache_old_wm")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, ncache_old_wm); goto qry; } ncache_old_wm = 1; rfbLog("remote_cmd: set -ncache_old_wm\n"); - } else if (!strcmp(p, "noncache_old_wm")) { + goto done; + } + if (!strcmp(p, "noncache_old_wm")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncache_old_wm); goto qry; } ncache_old_wm = 0; rfbLog("remote_cmd: disabled -ncache_old_wm\n"); - - } else if (strstr(p, "ncache_pad") == p) { + goto done; + } + if (strstr(p, "ncache_pad") == p) { int orig = ncache_pad, n; COLON_CHECK("ncache_pad:") if (query) { @@ -2972,22 +3187,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { n = atoi(p); rfbLog("remote_cmd: setting ncache_pad %d to: %d\n", orig, n); - - } else if (!strcmp(p, "ncache")) { + goto done; + } + if (!strcmp(p, "ncache")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !!ncache); goto qry; } ncache = ncache0; rfbLog("remote_cmd: set ncache %d\n", ncache); - } else if (!strcmp(p, "noncache")) { + goto done; + } + if (!strcmp(p, "noncache")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncache); goto qry; } ncache = 0; rfbLog("remote_cmd: disabled ncache %d\n", ncache); - } else if (strstr(p, "ncache_size") == p) { + goto done; + } + if (strstr(p, "ncache_size") == p) { int orig = ncache, n; COLON_CHECK("ncache_size:") if (query) { @@ -3005,23 +3225,28 @@ char *process_remote_cmd(char *cmd, int stringonly) { check_ncache(1,0); } } - } else if (!strcmp(p, "debug_ncache")) { + goto done; + } + if (!strcmp(p, "debug_ncache")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, ncdb); goto qry; } ncdb = 1; rfbLog("remote_cmd: enabled debug_ncache\n"); - } else if (!strcmp(p, "nodebug_ncache")) { + goto done; + } + if (!strcmp(p, "nodebug_ncache")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !ncdb); goto qry; } ncdb = 0; rfbLog("remote_cmd: disabled debug_ncache\n"); + goto done; + } #endif - - } else if (strstr(p, "wireframe_mode") == p) { + if (strstr(p, "wireframe_mode") == p) { COLON_CHECK("wireframe_mode:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3038,7 +3263,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: enabling -wireframe mode.\n"); wireframe = 1; - } else if (strstr(p, "wireframe:") == p) { /* skip-cmd-list */ + goto done; + } + if (strstr(p, "wireframe:") == p) { /* skip-cmd-list */ COLON_CHECK("wireframe:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, wireframe); @@ -3054,7 +3281,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: enabling -wireframe mode.\n"); wireframe = 1; - } else if (strstr(p, "wf:") == p) { /* skip-cmd-list */ + goto done; + } + if (strstr(p, "wf:") == p) { /* skip-cmd-list */ COLON_CHECK("wf:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, wireframe); @@ -3070,37 +3299,45 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: enabling -wireframe mode.\n"); wireframe = 1; - } else if (!strcmp(p, "wireframe") || !strcmp(p, "wf")) { + goto done; + } + if (!strcmp(p, "wireframe") || !strcmp(p, "wf")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, wireframe); goto qry; } rfbLog("remote_cmd: enabling -wireframe mode.\n"); wireframe = 1; - } else if (!strcmp(p, "nowireframe") || !strcmp(p, "nowf")) { + goto done; + } + if (!strcmp(p, "nowireframe") || !strcmp(p, "nowf")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !wireframe); goto qry; } rfbLog("remote_cmd: enabling -nowireframe mode.\n"); wireframe = 0; - - } else if (!strcmp(p, "wireframelocal") || !strcmp(p, "wfl")) { + goto done; + } + if (!strcmp(p, "wireframelocal") || !strcmp(p, "wfl")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, wireframe_local); goto qry; } rfbLog("remote_cmd: enabling -wireframelocal mode.\n"); wireframe_local = 1; - } else if (!strcmp(p, "nowireframelocal") || !strcmp(p, "nowfl")) { + goto done; + } + if (!strcmp(p, "nowireframelocal") || !strcmp(p, "nowfl")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !wireframe_local); goto qry; } rfbLog("remote_cmd: enabling -nowireframelocal mode.\n"); wireframe_local = 0; - - } else if (strstr(p, "wirecopyrect") == p) { + goto done; + } + if (strstr(p, "wirecopyrect") == p) { COLON_CHECK("wirecopyrect:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3113,7 +3350,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -wirecopyrect mode " "to: %s\n", NONUL(wireframe_copyrect)); got_wirecopyrect = 1; - } else if (strstr(p, "wcr") == p) { + goto done; + } + if (strstr(p, "wcr") == p) { COLON_CHECK("wcr:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3126,7 +3365,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -wirecopyrect mode " "to: %s\n", NONUL(wireframe_copyrect)); got_wirecopyrect = 1; - } else if (!strcmp(p, "nowirecopyrect") || !strcmp(p, "nowcr")) { + goto done; + } + if (!strcmp(p, "nowirecopyrect") || !strcmp(p, "nowcr")) { if (query) { snprintf(buf, bufn, "ans=%s:%s", p, NONUL(wireframe_copyrect)); @@ -3136,8 +3377,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { set_wirecopyrect_mode("never"); rfbLog("remote_cmd: changed -wirecopyrect mode " "to: %s\n", NONUL(wireframe_copyrect)); - - } else if (strstr(p, "scr_area") == p) { + goto done; + } + if (strstr(p, "scr_area") == p) { COLON_CHECK("scr_area:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, @@ -3149,8 +3391,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { scrollcopyrect_min_area = atoi(p); rfbLog("remote_cmd: changed -scr_area to: %d\n", scrollcopyrect_min_area); - - } else if (strstr(p, "scr_skip") == p) { + goto done; + } + if (strstr(p, "scr_skip") == p) { char *s = scroll_skip_str; COLON_CHECK("scr_skip:") if (!s || *s == '\0') s = scroll_skip_str0; @@ -3167,7 +3410,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -scr_skip to: %s\n", scroll_skip_str); initialize_scroll_matches(); - } else if (strstr(p, "scr_inc") == p) { + goto done; + } + if (strstr(p, "scr_inc") == p) { char *s = scroll_good_str; if (!s || *s == '\0') s = scroll_good_str0; COLON_CHECK("scr_inc:") @@ -3184,7 +3429,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -scr_inc to: %s\n", scroll_good_str); initialize_scroll_matches(); - } else if (strstr(p, "scr_keys") == p) { + goto done; + } + if (strstr(p, "scr_keys") == p) { COLON_CHECK("scr_keys:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3200,7 +3447,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -scr_keys to: %s\n", scroll_key_list_str); initialize_scroll_keys(); - } else if (strstr(p, "scr_term") == p) { + goto done; + } + if (strstr(p, "scr_term") == p) { char *s = scroll_term_str; if (!s || *s == '\0') s = scroll_term_str0; COLON_CHECK("scr_term:") @@ -3217,8 +3466,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -scr_term to: %s\n", scroll_term_str); initialize_scroll_term(); - - } else if (strstr(p, "scr_keyrepeat") == p) { + goto done; + } + if (strstr(p, "scr_keyrepeat") == p) { char *s = max_keyrepeat_str; if (!s || *s == '\0') s = max_keyrepeat_str0; COLON_CHECK("scr_keyrepeat:") @@ -3235,8 +3485,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -scr_keyrepeat to: %s\n", max_keyrepeat_str); initialize_max_keyrepeat(); - - } else if (strstr(p, "scr_parms") == p) { + goto done; + } + if (strstr(p, "scr_parms") == p) { COLON_CHECK("scr_parms:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3256,8 +3507,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: set -scr_parms %s.\n", NONUL(scroll_copyrect_str)); got_scrollcopyrect = 1; - - } else if (strstr(p, "scrollcopyrect") == p) { + goto done; + } + if (strstr(p, "scrollcopyrect") == p) { COLON_CHECK("scrollcopyrect:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3270,7 +3522,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -scrollcopyrect mode " "to: %s\n", NONUL(scroll_copyrect)); got_scrollcopyrect = 1; - } else if (!strcmp(p, "scr") || + goto done; + } + if (!strcmp(p, "scr") || strstr(p, "scr:") == p) { /* skip-cmd-list */ COLON_CHECK("scr:") if (query) { @@ -3284,7 +3538,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: changed -scrollcopyrect mode " "to: %s\n", NONUL(scroll_copyrect)); got_scrollcopyrect = 1; - } else if (!strcmp(p, "noscrollcopyrect") || !strcmp(p, "noscr")) { + goto done; + } + if (!strcmp(p, "noscrollcopyrect") || !strcmp(p, "noscr")) { if (query) { snprintf(buf, bufn, "ans=%s:%s", p, NONUL(scroll_copyrect)); @@ -3294,8 +3550,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { set_scrollcopyrect_mode("never"); rfbLog("remote_cmd: changed -scrollcopyrect mode " "to: %s\n", NONUL(scroll_copyrect)); - - } else if (strstr(p, "fixscreen") == p) { + goto done; + } + if (strstr(p, "fixscreen") == p) { COLON_CHECK("fixscreen:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3310,8 +3567,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { parse_fixscreen(); rfbLog("remote_cmd: set -fixscreen %s.\n", NONUL(screen_fixup_str)); - - } else if (!strcmp(p, "noxrecord")) { + goto done; + } + if (!strcmp(p, "noxrecord")) { int orig = noxrecord; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, noxrecord); @@ -3322,7 +3580,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (orig != noxrecord) { shutdown_xrecord(); } - } else if (!strcmp(p, "xrecord")) { + goto done; + } + if (!strcmp(p, "xrecord")) { int orig = noxrecord; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !noxrecord); @@ -3333,7 +3593,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (orig != noxrecord) { initialize_xrecord(); } - } else if (!strcmp(p, "reset_record")) { + goto done; + } + if (!strcmp(p, "reset_record")) { NOTAPP if (use_xrecord) { rfbLog("resetting RECORD\n"); @@ -3341,8 +3603,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } else { rfbLog("RECORD is disabled, not resetting.\n"); } - - } else if (strstr(p, "pointer_mode") == p) { + goto done; + } + if (strstr(p, "pointer_mode") == p) { int pm; COLON_CHECK("pointer_mode:") if (query) { @@ -3358,7 +3621,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting pointer_mode %d\n", pm); pointer_mode = pm; } - } else if (strstr(p, "pm") == p) { + goto done; + } + if (strstr(p, "pm") == p) { int pm; COLON_CHECK("pm:") if (query) { @@ -3374,8 +3639,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting pointer_mode %d\n", pm); pointer_mode = pm; } - - } else if (strstr(p, "input_skip") == p) { + goto done; + } + if (strstr(p, "input_skip") == p) { int is; COLON_CHECK("input_skip:") if (query) { @@ -3386,23 +3652,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { is = atoi(p); rfbLog("remote_cmd: setting input_skip %d\n", is); ui_skip = is; - - } else if (!strcmp(p, "allinput")) { + goto done; + } + if (!strcmp(p, "allinput")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, all_input); goto qry; } all_input = 1; rfbLog("enabled allinput\n"); - } else if (!strcmp(p, "noallinput")) { + goto done; + } + if (!strcmp(p, "noallinput")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !all_input); goto qry; } all_input = 0; rfbLog("disabled allinput\n"); - - } else if (strstr(p, "input") == p) { + goto done; + } + if (strstr(p, "input") == p) { int doit = 1; COLON_CHECK("input:") if (query) { @@ -3424,7 +3694,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (doit) { initialize_allowed_input(); } - } else if (!strcmp(p, "grabkbd")) { + goto done; + } + if (!strcmp(p, "grabkbd")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, grab_kbd); goto qry; @@ -3434,7 +3706,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { adjust_grabs(1, 0); } rfbLog("enabled grab_kbd\n"); - } else if (!strcmp(p, "nograbkbd")) { + goto done; + } + if (!strcmp(p, "nograbkbd")) { int orig = grab_kbd; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !grab_kbd); @@ -3450,7 +3724,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("disabled grab_kbd\n"); - } else if (!strcmp(p, "grabptr")) { + goto done; + } + if (!strcmp(p, "grabptr")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, grab_ptr); goto qry; @@ -3460,7 +3736,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { adjust_grabs(1, 0); } rfbLog("enabled grab_ptr\n"); - } else if (!strcmp(p, "nograbptr")) { + goto done; + } + if (!strcmp(p, "nograbptr")) { int orig = grab_ptr; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !grab_ptr); @@ -3475,8 +3753,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { #endif } rfbLog("disabled grab_ptr\n"); - - } else if (!strcmp(p, "grabalways")) { + goto done; + } + if (!strcmp(p, "grabalways")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, grab_always); goto qry; @@ -3486,7 +3765,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { grab_always = 1; adjust_grabs(1, 0); rfbLog("enabled grab_always\n"); - } else if (!strcmp(p, "nograbalways")) { + goto done; + } + if (!strcmp(p, "nograbalways")) { int orig = grab_always; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !grab_always); @@ -3505,8 +3786,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } adjust_grabs(0, 0); rfbLog("disabled grab_always\n"); - - } else if (strstr(p, "grablocal") == p) { + goto done; + } + if (strstr(p, "grablocal") == p) { COLON_CHECK("grablocal:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, @@ -3518,14 +3800,16 @@ char *process_remote_cmd(char *cmd, int stringonly) { grab_local = atoi(p); rfbLog("remote_cmd: changed -grablocal to: %d\n", grab_local); - - } else if (strstr(p, "client_input") == p) { + goto done; + } + if (strstr(p, "client_input") == p) { NOTAPP COLON_CHECK("client_input:") p += strlen("client_input:"); set_client_input(p); - - } else if (strstr(p, "ssltimeout") == p) { + goto done; + } + if (strstr(p, "ssltimeout") == p) { int is; COLON_CHECK("ssltimeout:") if (query) { @@ -3537,8 +3821,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { is = atoi(p); rfbLog("remote_cmd: setting ssltimeout: %d\n", is); ssl_timeout_secs = is; - - } else if (strstr(p, "speeds") == p) { + goto done; + } + if (strstr(p, "speeds") == p) { COLON_CHECK("speeds:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3551,8 +3836,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting -speeds to:\n\t'%s'\n", p); initialize_speeds(); - - } else if (strstr(p, "wmdt") == p) { + goto done; + } + if (strstr(p, "wmdt") == p) { COLON_CHECK("wmdt:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3564,38 +3850,45 @@ char *process_remote_cmd(char *cmd, int stringonly) { wmdt_str = strdup(p); rfbLog("remote_cmd: setting -wmdt to: %s\n", p); - - } else if (!strcmp(p, "debug_pointer") || !strcmp(p, "dp")) { + goto done; + } + if (!strcmp(p, "debug_pointer") || !strcmp(p, "dp")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_pointer); goto qry; } rfbLog("remote_cmd: turning on debug_pointer.\n"); debug_pointer = 1; - } else if (!strcmp(p, "nodebug_pointer") || !strcmp(p, "nodp")) { + goto done; + } + if (!strcmp(p, "nodebug_pointer") || !strcmp(p, "nodp")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_pointer); goto qry; } rfbLog("remote_cmd: turning off debug_pointer.\n"); debug_pointer = 0; - - } else if (!strcmp(p, "debug_keyboard") || !strcmp(p, "dk")) { + goto done; + } + if (!strcmp(p, "debug_keyboard") || !strcmp(p, "dk")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_keyboard); goto qry; } rfbLog("remote_cmd: turning on debug_keyboard.\n"); debug_keyboard = 1; - } else if (!strcmp(p, "nodebug_keyboard") || !strcmp(p, "nodk")) { + goto done; + } + if (!strcmp(p, "nodebug_keyboard") || !strcmp(p, "nodk")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_keyboard); goto qry; } rfbLog("remote_cmd: turning off debug_keyboard.\n"); debug_keyboard = 0; - - } else if (strstr(p, "keycode") == p) { + goto done; + } + if (strstr(p, "keycode") == p) { int kc; NOTAPP COLON_CHECK("keycode:") @@ -3616,8 +3909,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { usleep(100*1000); XTestFakeKeyEvent_wr(dpy, kc, 0, CurrentTime); } - - } else if (strstr(p, "deferupdate") == p) { + goto done; + } + if (strstr(p, "deferupdate") == p) { int d; COLON_CHECK("deferupdate:") if (query) { @@ -3635,8 +3929,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting defer to %d ms.\n", d); screen->deferUpdateTime = d; got_defer = 1; - - } else if (strstr(p, "defer") == p) { + goto done; + } + if (strstr(p, "defer") == p) { int d; COLON_CHECK("defer:") if (query) { @@ -3654,8 +3949,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting defer to %d ms.\n", d); screen->deferUpdateTime = d; got_defer = 1; - - } else if (strstr(p, "wait_ui") == p) { + goto done; + } + if (strstr(p, "wait_ui") == p) { double w; COLON_CHECK("wait_ui:") if (query) { @@ -3668,23 +3964,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting wait_ui factor %.2f -> %.2f\n", wait_ui, w); wait_ui = w; - - } else if (!strcmp(p, "wait_bog")) { + goto done; + } + if (!strcmp(p, "wait_bog")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, wait_bog); goto qry; } wait_bog = 1; rfbLog("remote_cmd: setting wait_bog to %d\n", wait_bog); - } else if (!strcmp(p, "nowait_bog")) { + goto done; + } + if (!strcmp(p, "nowait_bog")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !wait_bog); goto qry; } wait_bog = 0; rfbLog("remote_cmd: setting wait_bog to %d\n", wait_bog); - - } else if (strstr(p, "slow_fb") == p) { + goto done; + } + if (strstr(p, "slow_fb") == p) { double w; COLON_CHECK("slow_fb:") if (query) { @@ -3697,8 +3997,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting slow_fb factor %.2f -> %.2f\n", slow_fb, w); slow_fb = w; - - } else if (strstr(p, "xrefresh") == p) { + goto done; + } + if (strstr(p, "xrefresh") == p) { double w; COLON_CHECK("xrefresh:") if (query) { @@ -3711,8 +4012,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting xrefresh delay %.2f -> %.2f\n", xrefresh, w); xrefresh = w; - - } else if (strstr(p, "wait") == p) { + goto done; + } + if (strstr(p, "wait") == p) { int w; COLON_CHECK("wait:") if (query) { @@ -3724,8 +4026,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (w < 0) w = 0; rfbLog("remote_cmd: setting wait %d -> %d ms.\n", waitms, w); waitms = w; - - } else if (strstr(p, "readtimeout") == p) { + goto done; + } + if (strstr(p, "readtimeout") == p) { int w, orig = rfbMaxClientWait; COLON_CHECK("readtimeout:") if (query) { @@ -3739,23 +4042,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting rfbMaxClientWait %d -> " "%d msec.\n", orig, w); rfbMaxClientWait = w; - - } else if (!strcmp(p, "nap")) { + goto done; + } + if (!strcmp(p, "nap")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, take_naps); goto qry; } rfbLog("remote_cmd: turning on nap mode.\n"); take_naps = 1; - } else if (!strcmp(p, "nonap")) { + goto done; + } + if (!strcmp(p, "nonap")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !take_naps); goto qry; } rfbLog("remote_cmd: turning off nap mode.\n"); take_naps = 0; - - } else if (strstr(p, "sb") == p) { + goto done; + } + if (strstr(p, "sb") == p) { int w; COLON_CHECK("sb:") if (query) { @@ -3768,7 +4075,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting screen_blank %d -> %d sec.\n", screen_blank, w); screen_blank = w; - } else if (strstr(p, "screen_blank") == p) { + goto done; + } + if (strstr(p, "screen_blank") == p) { int w; COLON_CHECK("screen_blank:") if (query) { @@ -3781,98 +4090,155 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting screen_blank %d -> %d sec.\n", screen_blank, w); screen_blank = w; - - } else if (!strcmp(p, "fbpm")) { + goto done; + } + if (!strcmp(p, "fbpm")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !watch_fbpm); goto qry; } rfbLog("remote_cmd: turning off -nofbpm mode.\n"); watch_fbpm = 0; - } else if (!strcmp(p, "nofbpm")) { + goto done; + } + if (!strcmp(p, "nofbpm")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, watch_fbpm); goto qry; } rfbLog("remote_cmd: turning on -nofbpm mode.\n"); watch_fbpm = 1; - - } else if (!strcmp(p, "dpms")) { + goto done; + } + if (!strcmp(p, "dpms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !watch_dpms); goto qry; } rfbLog("remote_cmd: turning off -nodpms mode.\n"); watch_dpms = 0; - } else if (!strcmp(p, "nodpms")) { + goto done; + } + if (!strcmp(p, "nodpms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, watch_dpms); goto qry; } rfbLog("remote_cmd: turning on -nodpms mode.\n"); watch_dpms = 1; - - } else if (!strcmp(p, "clientdpms")) { + goto done; + } + if (!strcmp(p, "clientdpms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, client_dpms); goto qry; } rfbLog("remote_cmd: turning on -clientdpms mode.\n"); client_dpms = 1; - } else if (!strcmp(p, "noclientdpms")) { + goto done; + } + if (!strcmp(p, "noclientdpms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !client_dpms); goto qry; } rfbLog("remote_cmd: turning off -clientdpms mode.\n"); client_dpms = 0; - - } else if (!strcmp(p, "forcedpms")) { + goto done; + } + if (!strcmp(p, "forcedpms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, force_dpms); goto qry; } rfbLog("remote_cmd: turning on -forcedpms mode.\n"); force_dpms = 1; - } else if (!strcmp(p, "noforcedpms")) { + goto done; + } + if (!strcmp(p, "noforcedpms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !force_dpms); goto qry; } rfbLog("remote_cmd: turning off -forcedpms mode.\n"); force_dpms = 0; - - } else if (!strcmp(p, "noserverdpms")) { + goto done; + } + if (!strcmp(p, "noserverdpms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, no_ultra_dpms); goto qry; } rfbLog("remote_cmd: turning on -noserverdpms mode.\n"); no_ultra_dpms = 1; - } else if (!strcmp(p, "serverdpms")) { + goto done; + } + if (!strcmp(p, "serverdpms")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !no_ultra_dpms); goto qry; } rfbLog("remote_cmd: turning off -noserverdpms mode.\n"); no_ultra_dpms = 0; - - } else if (!strcmp(p, "noultraext")) { + goto done; + } + if (!strcmp(p, "noultraext")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, no_ultra_ext); goto qry; } rfbLog("remote_cmd: turning on -noultraext mode.\n"); no_ultra_ext = 1; - } else if (!strcmp(p, "ultraext")) { + goto done; + } + if (!strcmp(p, "ultraext")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !no_ultra_ext); goto qry; } rfbLog("remote_cmd: turning off -noultraext mode.\n"); no_ultra_ext = 0; - - } else if (strstr(p, "fs") == p) { + goto done; + } + if (!strcmp(p, "chatwindow")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, chat_window); + goto qry; + } + rfbLog("remote_cmd: enabling the local chat window.\n"); + chat_window = 1; + goto done; + } + if (!strcmp(p, "nochatwindow")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, !chat_window); + goto qry; + } + rfbLog("remote_cmd: disabling the local chat window.\n"); + chat_window = 0; + goto done; + } + if (!strcmp(p, "chaton")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, (chat_window_client != NULL)); + goto qry; + } + rfbLog("remote_cmd: turning local chat window on.\n"); + chat_window = 1; + set_text_chat(NULL, rfbTextChatOpen, ""); + goto done; + } + if (!strcmp(p, "chatoff")) { + if (query) { + snprintf(buf, bufn, "ans=%s:%d", p, (chat_window_client == NULL)); + goto qry; + } + rfbLog("remote_cmd: turning local chat window off.\n"); + set_text_chat(NULL, rfbTextChatClose, ""); + set_text_chat(NULL, rfbTextChatFinished, ""); + goto done; + } + if (strstr(p, "fs") == p) { COLON_CHECK("fs:") if (query) { snprintf(buf, bufn, "ans=%s%s%f", p, co, fs_frac); @@ -3881,8 +4247,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("fs:"); fs_frac = atof(p); rfbLog("remote_cmd: setting -fs frac to %f\n", fs_frac); - - } else if (strstr(p, "gaps") == p) { + goto done; + } + if (strstr(p, "gaps") == p) { int g; COLON_CHECK("gaps:") if (query) { @@ -3895,7 +4262,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting gaps_fill %d -> %d.\n", gaps_fill, g); gaps_fill = g; - } else if (strstr(p, "grow") == p) { + goto done; + } + if (strstr(p, "grow") == p) { int g; COLON_CHECK("grow:") if (query) { @@ -3908,7 +4277,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting grow_fill %d -> %d.\n", grow_fill, g); grow_fill = g; - } else if (strstr(p, "fuzz") == p) { + goto done; + } + if (strstr(p, "fuzz") == p) { int f; COLON_CHECK("fuzz:") if (query) { @@ -3921,8 +4292,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting tile_fuzz %d -> %d.\n", tile_fuzz, f); grow_fill = f; - - } else if (!strcmp(p, "snapfb")) { + goto done; + } + if (!strcmp(p, "snapfb")) { int orig = use_snapfb; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, use_snapfb); @@ -3933,7 +4305,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { if (orig != use_snapfb) { do_new_fb(1); } - } else if (!strcmp(p, "nosnapfb")) { + goto done; + } + if (!strcmp(p, "nosnapfb")) { int orig = use_snapfb; if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !use_snapfb); @@ -3945,7 +4319,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { do_new_fb(1); } - } else if (strstr(p, "rawfb") == p) { + goto done; + } + if (strstr(p, "rawfb") == p) { COLON_CHECK("rawfb:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3986,8 +4362,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { raw_fb_back_to_X = 1; do_new_fb(1); raw_fb_back_to_X = 0; - - } else if (strstr(p, "uinput_accel") == p) { + goto done; + } + if (strstr(p, "uinput_accel") == p) { COLON_CHECK("uinput_accel:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -3997,8 +4374,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("uinput_accel:"); rfbLog("set_uinput_accel: %s\n", p); set_uinput_accel(p); - - } else if (strstr(p, "uinput_thresh") == p) { + goto done; + } + if (strstr(p, "uinput_thresh") == p) { COLON_CHECK("uinput_thresh:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -4008,8 +4386,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("uinput_thresh:"); rfbLog("set_uinput_thresh: %s\n", p); set_uinput_thresh(p); - - } else if (strstr(p, "uinput_reset") == p) { + goto done; + } + if (strstr(p, "uinput_reset") == p) { COLON_CHECK("uinput_reset:") p += strlen("uinput_reset:"); if (query) { @@ -4019,8 +4398,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("set_uinput_reset: %s\n", p); set_uinput_reset(atoi(p)); - - } else if (strstr(p, "uinput_always") == p) { + goto done; + } + if (strstr(p, "uinput_always") == p) { COLON_CHECK("uinput_always:") p += strlen("uinput_always:"); if (query) { @@ -4030,8 +4410,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("set_uinput_always: %s\n", p); set_uinput_always(atoi(p)); - - } else if (strstr(p, "progressive") == p) { + goto done; + } + if (strstr(p, "progressive") == p) { int f; COLON_CHECK("progressive:") if (query) { @@ -4049,8 +4430,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: setting progressive %d -> %d.\n", screen->progressiveSliceHeight, f); screen->progressiveSliceHeight = f; - - } else if (strstr(p, "rfbport") == p) { + goto done; + } + if (strstr(p, "rfbport") == p) { int rp, orig = screen ? screen->port : 5900; COLON_CHECK("rfbport:") if (query) { @@ -4060,8 +4442,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("rfbport:"); rp = atoi(p); reset_rfbport(orig, rp); - - } else if (!strcmp(p, "http")) { + goto done; + } + if (!strcmp(p, "http")) { if (query) { int ls = screen ? screen->httpListenSock : -1; snprintf(buf, bufn, "ans=%s:%d", p, (ls > -1)); @@ -4075,7 +4458,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { http_connections(1); } } - } else if (!strcmp(p, "nohttp")) { + goto done; + } + if (!strcmp(p, "nohttp")) { if (query) { int ls = screen ? screen->httpListenSock : -1; snprintf(buf, bufn, "ans=%s:%d", p, !(ls > -1)); @@ -4089,8 +4474,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { http_connections(0); } } - - } else if (strstr(p, "httpport") == p) { + goto done; + } + if (strstr(p, "httpport") == p) { int hp, orig = screen ? screen->httpPort : 0; COLON_CHECK("httpport:") if (query) { @@ -4100,8 +4486,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("httpport:"); hp = atoi(p); reset_httpport(orig, hp); - - } else if (strstr(p, "httpdir") == p) { + goto done; + } + if (strstr(p, "httpdir") == p) { COLON_CHECK("httpdir:") if (query) { snprintf(buf, bufn, "ans=%s%s%s", p, co, @@ -4121,8 +4508,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { http_connections(1); } } - - } else if (!strcmp(p, "enablehttpproxy")) { + goto done; + } + if (!strcmp(p, "enablehttpproxy")) { if (query) { int ht = screen ? screen->httpEnableProxyConnect : 0; snprintf(buf, bufn, "ans=%s:%d", p, ht != 0); @@ -4130,7 +4518,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("turning on enablehttpproxy.\n"); screen->httpEnableProxyConnect = 1; - } else if (!strcmp(p, "noenablehttpproxy")) { + goto done; + } + if (!strcmp(p, "noenablehttpproxy")) { if (query) { int ht = screen ? screen->httpEnableProxyConnect : 0; snprintf(buf, bufn, "ans=%s:%d", p, ht == 0); @@ -4138,8 +4528,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("turning off enablehttpproxy.\n"); screen->httpEnableProxyConnect = 0; - - } else if (!strcmp(p, "alwaysshared")) { + goto done; + } + if (!strcmp(p, "alwaysshared")) { if (query) { int t = screen ? screen->alwaysShared : 0; snprintf(buf, bufn, "ans=%s:%d", p, t != 0); @@ -4147,7 +4538,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("turning on alwaysshared.\n"); screen->alwaysShared = 1; - } else if (!strcmp(p, "noalwaysshared")) { + goto done; + } + if (!strcmp(p, "noalwaysshared")) { if (query) { int t = screen ? screen->alwaysShared : 0; snprintf(buf, bufn, "ans=%s:%d", p, t == 0); @@ -4155,8 +4548,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("turning off alwaysshared.\n"); screen->alwaysShared = 0; - - } else if (!strcmp(p, "nevershared")) { + goto done; + } + if (!strcmp(p, "nevershared")) { if (query) { int t = screen ? screen->neverShared : 1; snprintf(buf, bufn, "ans=%s:%d", p, t != 0); @@ -4164,7 +4558,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("turning on nevershared.\n"); screen->neverShared = 1; - } else if (!strcmp(p, "noalwaysshared")) { + goto done; + } + if (!strcmp(p, "noalwaysshared")) { if (query) { int t = screen ? screen->neverShared : 1; snprintf(buf, bufn, "ans=%s:%d", p, t == 0); @@ -4172,8 +4568,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("turning off nevershared.\n"); screen->neverShared = 0; - - } else if (!strcmp(p, "dontdisconnect")) { + goto done; + } + if (!strcmp(p, "dontdisconnect")) { if (query) { int t = screen ? screen->dontDisconnect : 1; snprintf(buf, bufn, "ans=%s:%d", p, t != 0); @@ -4181,7 +4578,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("turning on dontdisconnect.\n"); screen->dontDisconnect = 1; - } else if (!strcmp(p, "nodontdisconnect")) { + goto done; + } + if (!strcmp(p, "nodontdisconnect")) { if (query) { int t = screen ? screen->dontDisconnect : 1; snprintf(buf, bufn, "ans=%s:%d", p, t == 0); @@ -4189,8 +4588,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("turning off dontdisconnect.\n"); screen->dontDisconnect = 0; - - } else if (!strcmp(p, "desktop") || + goto done; + } + if (!strcmp(p, "desktop") || strstr(p, "desktop:") == p) { /* skip-cmd-list */ COLON_CHECK("desktop:") if (query) { @@ -4206,22 +4606,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { screen->desktopName = rfb_desktop_name; rfbLog("remote_cmd: setting desktop name to %s\n", rfb_desktop_name); - - } else if (!strcmp(p, "debug_xevents")) { + goto done; + } + if (!strcmp(p, "debug_xevents")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_xevents); goto qry; } debug_xevents = 1; rfbLog("set debug_xevents to: %d\n", debug_xevents); - } else if (!strcmp(p, "nodebug_xevents")) { + goto done; + } + if (!strcmp(p, "nodebug_xevents")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_xevents); goto qry; } debug_xevents = 0; rfbLog("set debug_xevents to: %d\n", debug_xevents); - } else if (strstr(p, "debug_xevents") == p) { + goto done; + } + if (strstr(p, "debug_xevents") == p) { COLON_CHECK("debug_xevents:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, debug_xevents); @@ -4230,22 +4635,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("debug_xevents:"); debug_xevents = atoi(p); rfbLog("set debug_xevents to: %d\n", debug_xevents); - - } else if (!strcmp(p, "debug_xdamage")) { + goto done; + } + if (!strcmp(p, "debug_xdamage")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_xdamage); goto qry; } debug_xdamage = 1; rfbLog("set debug_xdamage to: %d\n", debug_xdamage); - } else if (!strcmp(p, "nodebug_xdamage")) { + goto done; + } + if (!strcmp(p, "nodebug_xdamage")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_xdamage); goto qry; } debug_xdamage = 0; rfbLog("set debug_xdamage to: %d\n", debug_xdamage); - } else if (strstr(p, "debug_xdamage") == p) { + goto done; + } + if (strstr(p, "debug_xdamage") == p) { COLON_CHECK("debug_xdamage:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, debug_xdamage); @@ -4254,22 +4664,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("debug_xdamage:"); debug_xdamage = atoi(p); rfbLog("set debug_xdamage to: %d\n", debug_xdamage); - - } else if (!strcmp(p, "debug_wireframe")) { + goto done; + } + if (!strcmp(p, "debug_wireframe")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_wireframe); goto qry; } debug_wireframe = 1; rfbLog("set debug_wireframe to: %d\n", debug_wireframe); - } else if (!strcmp(p, "nodebug_wireframe")) { + goto done; + } + if (!strcmp(p, "nodebug_wireframe")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_wireframe); goto qry; } debug_wireframe = 0; rfbLog("set debug_wireframe to: %d\n", debug_wireframe); - } else if (strstr(p, "debug_wireframe") == p) { + goto done; + } + if (strstr(p, "debug_wireframe") == p) { COLON_CHECK("debug_wireframe:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, @@ -4279,22 +4694,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("debug_wireframe:"); debug_wireframe = atoi(p); rfbLog("set debug_wireframe to: %d\n", debug_wireframe); - - } else if (!strcmp(p, "debug_scroll")) { + goto done; + } + if (!strcmp(p, "debug_scroll")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_scroll); goto qry; } debug_scroll = 1; rfbLog("set debug_scroll to: %d\n", debug_scroll); - } else if (!strcmp(p, "nodebug_scroll")) { + goto done; + } + if (!strcmp(p, "nodebug_scroll")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_scroll); goto qry; } debug_scroll = 0; rfbLog("set debug_scroll to: %d\n", debug_scroll); - } else if (strstr(p, "debug_scroll") == p) { + goto done; + } + if (strstr(p, "debug_scroll") == p) { COLON_CHECK("debug_scroll:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, @@ -4304,22 +4724,27 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("debug_scroll:"); debug_scroll = atoi(p); rfbLog("set debug_scroll to: %d\n", debug_scroll); - - } else if (!strcmp(p, "debug_tiles") || !strcmp(p, "dbt")) { + goto done; + } + if (!strcmp(p, "debug_tiles") || !strcmp(p, "dbt")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_tiles); goto qry; } debug_tiles = 1; rfbLog("set debug_tiles to: %d\n", debug_tiles); - } else if (!strcmp(p, "nodebug_tiles") || !strcmp(p, "nodbt")) { + goto done; + } + if (!strcmp(p, "nodebug_tiles") || !strcmp(p, "nodbt")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_tiles); goto qry; } debug_tiles = 0; rfbLog("set debug_tiles to: %d\n", debug_tiles); - } else if (strstr(p, "debug_tiles") == p) { + goto done; + } + if (strstr(p, "debug_tiles") == p) { COLON_CHECK("debug_tiles:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, @@ -4329,79 +4754,95 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("debug_tiles:"); debug_tiles = atoi(p); rfbLog("set debug_tiles to: %d\n", debug_tiles); - - } else if (!strcmp(p, "debug_grabs")) { + goto done; + } + if (!strcmp(p, "debug_grabs")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_grabs); goto qry; } debug_grabs = 1; rfbLog("set debug_grabs to: %d\n", debug_grabs); - } else if (!strcmp(p, "nodebug_grabs")) { + goto done; + } + if (!strcmp(p, "nodebug_grabs")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_grabs); goto qry; } debug_grabs = 0; rfbLog("set debug_grabs to: %d\n", debug_grabs); - - } else if (!strcmp(p, "debug_sel")) { + goto done; + } + if (!strcmp(p, "debug_sel")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, debug_sel); goto qry; } debug_sel = 1; rfbLog("set debug_sel to: %d\n", debug_sel); - } else if (!strcmp(p, "nodebug_sel")) { + goto done; + } + if (!strcmp(p, "nodebug_sel")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !debug_sel); goto qry; } debug_sel = 0; rfbLog("set debug_sel to: %d\n", debug_sel); - - } else if (!strcmp(p, "dbg")) { + goto done; + } + if (!strcmp(p, "dbg")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, crash_debug); goto qry; } crash_debug = 1; rfbLog("set crash_debug to: %d\n", crash_debug); - } else if (!strcmp(p, "nodbg")) { + goto done; + } + if (!strcmp(p, "nodbg")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !crash_debug); goto qry; } crash_debug = 0; rfbLog("set crash_debug to: %d\n", crash_debug); - - } else if (!strcmp(p, "macnosaver")) { + goto done; + } + if (!strcmp(p, "macnosaver")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, macosx_noscreensaver); goto qry; } rfbLog("remote_cmd: turn on macnosaver.\n"); macosx_noscreensaver = 1; - } else if (!strcmp(p, "macsaver") || !strcmp(p, "nomacnosaver")) { + goto done; + } + if (!strcmp(p, "macsaver") || !strcmp(p, "nomacnosaver")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !macosx_noscreensaver); goto qry; } rfbLog("remote_cmd: turn off macnosaver.\n"); macosx_noscreensaver = 0; - - } else if (!strcmp(p, "macnowait")) { + goto done; + } + if (!strcmp(p, "macnowait")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !macosx_wait_for_switch); goto qry; } rfbLog("remote_cmd: disable macosx_wait_for_switch.\n"); macosx_wait_for_switch = 0; - } else if (!strcmp(p, "macwait") || !strcmp(p, "nomacnowait")) { + goto done; + } + if (!strcmp(p, "macwait") || !strcmp(p, "nomacnowait")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, macosx_wait_for_switch); goto qry; } rfbLog("remote_cmd: enable macosx_wait_for_switch.\n"); macosx_wait_for_switch = 1; - - } else if (strstr(p, "macwheel") == p) { + goto done; + } + if (strstr(p, "macwheel") == p) { COLON_CHECK("macwheel:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, macosx_mouse_wheel_speed); @@ -4410,34 +4851,41 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("macwheel:"); macosx_mouse_wheel_speed = atoi(p); rfbLog("set macosx_mouse_wheel_speed to: %d\n", macosx_mouse_wheel_speed); - - } else if (!strcmp(p, "macnoswap")) { + goto done; + } + if (!strcmp(p, "macnoswap")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !macosx_swap23); goto qry; } rfbLog("remote_cmd: disable macosx_swap23.\n"); macosx_swap23 = 0; - } else if (!strcmp(p, "macswap") || !strcmp(p, "nomacnoswap")) { + goto done; + } + if (!strcmp(p, "macswap") || !strcmp(p, "nomacnoswap")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, macosx_swap23); goto qry; } rfbLog("remote_cmd: enable macosx_swap23.\n"); macosx_swap23 = 1; - - } else if (!strcmp(p, "macnoresize")) { + goto done; + } + if (!strcmp(p, "macnoresize")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !macosx_resize); goto qry; } rfbLog("remote_cmd: disable macosx_resize.\n"); macosx_resize = 0; - } else if (!strcmp(p, "macresize") || !strcmp(p, "nomacnoresize")) { + goto done; + } + if (!strcmp(p, "macresize") || !strcmp(p, "nomacnoresize")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, macosx_resize); goto qry; } rfbLog("remote_cmd: enable macosx_resize.\n"); macosx_resize = 1; - - } else if (strstr(p, "maciconanim") == p) { + goto done; + } + if (strstr(p, "maciconanim") == p) { COLON_CHECK("maciconanim:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, macosx_icon_anim_time); @@ -4446,34 +4894,41 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("maciconanim:"); macosx_icon_anim_time = atoi(p); rfbLog("set macosx_icon_anim_time to: %d\n", macosx_icon_anim_time); - - } else if (!strcmp(p, "macmenu")) { + goto done; + } + if (!strcmp(p, "macmenu")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, macosx_ncache_macmenu); goto qry; } rfbLog("remote_cmd: enable macosx_ncache_macmenu.\n"); macosx_ncache_macmenu = 1; - } else if (!strcmp(p, "macnomenu") || !strcmp(p, "nomacmenu")) { + goto done; + } + if (!strcmp(p, "macnomenu") || !strcmp(p, "nomacmenu")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !macosx_ncache_macmenu); goto qry; } rfbLog("remote_cmd: disable macosx_ncache_macmenu.\n"); macosx_ncache_macmenu = 0; - - } else if (!strcmp(p, "macuskbd")) { + goto done; + } + if (!strcmp(p, "macuskbd")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, macosx_us_kbd); goto qry; } rfbLog("remote_cmd: enable macosx_us_kbd.\n"); macosx_us_kbd = 1; - } else if (!strcmp(p, "nomacuskbd")) { + goto done; + } + if (!strcmp(p, "nomacuskbd")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !macosx_us_kbd); goto qry; } rfbLog("remote_cmd: disable macosx_us_kbd.\n"); macosx_us_kbd = 0; - - } else if (strstr(p, "hack") == p) { /* skip-cmd-list */ + goto done; + } + if (strstr(p, "hack") == p) { /* skip-cmd-list */ COLON_CHECK("hack:") if (query) { snprintf(buf, bufn, "ans=%s%s%d", p, co, hack_val); @@ -4482,8 +4937,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { p += strlen("hack:"); hack_val = atoi(p); rfbLog("set hack_val to: %d\n", hack_val); - - } else if (!strcmp(p, "noremote")) { + goto done; + } + if (!strcmp(p, "noremote")) { if (query) { snprintf(buf, bufn, "ans=%s:%d", p, !accept_remote_cmds); @@ -4491,19 +4947,22 @@ char *process_remote_cmd(char *cmd, int stringonly) { } rfbLog("remote_cmd: disabling remote commands.\n"); accept_remote_cmds = 0; /* cannot be turned back on. */ - - } else if (strstr(p, "client_info_sock") == p) { /* skip-cmd-list */ + goto done; + } + if (strstr(p, "client_info_sock") == p) { /* skip-cmd-list */ NOTAPP p += strlen("client_info_sock:"); if (*p != '\0') { start_client_info_sock(p); } - - } else if (strstr(p, "noop") == p) { + goto done; + } + if (strstr(p, "noop") == p) { NOTAPP rfbLog("remote_cmd: noop\n"); - - } else if (icon_mode && !query && strstr(p, "passwd") == p) { /* skip-cmd-list */ + goto done; + } + if (icon_mode && !query && strstr(p, "passwd") == p) { /* skip-cmd-list */ char **passwds_new = (char **) malloc(3*sizeof(char *)); char **passwds_old = (char **) screen->authPasswdData; @@ -4526,8 +4985,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { screen->authPasswdData = (void*) NULL; } rfbLog("remote_cmd: changed full access passwd.\n"); - - } else if (icon_mode && !query && strstr(p, "viewpasswd") == p) { /* skip-cmd-list */ + goto done; + } + if (icon_mode && !query && strstr(p, "viewpasswd") == p) { /* skip-cmd-list */ char **passwds_new = (char **) malloc(3*sizeof(char *)); char **passwds_old = (char **) screen->authPasswdData; @@ -4553,8 +5013,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { screen->authPasswdData = (void*) passwds_new; rfbLog("remote_cmd: changed view only passwd.\n"); - - } else if (strstr(p, "trayembed") == p) { /* skip-cmd-list */ + goto done; + } + if (strstr(p, "trayembed") == p) { /* skip-cmd-list */ unsigned long id; NOTAPP @@ -4566,7 +5027,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: will try to embed 0x%x in" " the system tray.\n", id); } - } else if (strstr(p, "trayunembed") == p) { /* skip-cmd-list */ + goto done; + } + if (strstr(p, "trayunembed") == p) { /* skip-cmd-list */ unsigned long id; NOTAPP @@ -4578,8 +5041,9 @@ char *process_remote_cmd(char *cmd, int stringonly) { rfbLog("remote_cmd: will try to unembed 0x%x out" " of the system tray.\n", id); } - - } else if (query) { + goto done; + } + if (query) { /* read-only variables that can only be queried: */ if (!strcmp(p, "display")) { @@ -4599,16 +5063,24 @@ char *process_remote_cmd(char *cmd, int stringonly) { snprintf(buf, bufn, "aro=%s:%s", p, d); } } - } else if (!strcmp(p, "vncdisplay")) { + goto qry; + } + if (!strcmp(p, "vncdisplay")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(vnc_desktop_name)); - } else if (!strcmp(p, "desktopname")) { + goto qry; + } + if (!strcmp(p, "desktopname")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(rfb_desktop_name)); - } else if (!strcmp(p, "guess_desktop")) { + goto qry; + } + if (!strcmp(p, "guess_desktop")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(guess_desktop())); - } else if (!strcmp(p, "http_url")) { + goto qry; + } + if (!strcmp(p, "http_url")) { if (!screen) { snprintf(buf, bufn, "aro=%s:", p); } else if (screen->httpListenSock > -1) { @@ -4618,180 +5090,344 @@ char *process_remote_cmd(char *cmd, int stringonly) { snprintf(buf, bufn, "aro=%s:%s", p, "http_not_active"); } - } else if (!strcmp(p, "auth") || !strcmp(p, "xauth")) { + goto qry; + } + if (!strcmp(p, "auth") || !strcmp(p, "xauth")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(auth_file)); - } else if (!strcmp(p, "users")) { + goto qry; + } + if (!strcmp(p, "users")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(users_list)); - } else if (!strcmp(p, "rootshift")) { + goto qry; + } + if (!strcmp(p, "rootshift")) { snprintf(buf, bufn, "aro=%s:%d", p, rootshift); - } else if (!strcmp(p, "clipshift")) { + goto qry; + } + if (!strcmp(p, "clipshift")) { snprintf(buf, bufn, "aro=%s:%d", p, clipshift); - } else if (!strcmp(p, "scale_str")) { + goto qry; + } + if (!strcmp(p, "scale_str")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(scale_str)); - } else if (!strcmp(p, "scaled_x")) { + goto qry; + } + if (!strcmp(p, "scaled_x")) { snprintf(buf, bufn, "aro=%s:%d", p, scaled_x); - } else if (!strcmp(p, "scaled_y")) { + goto qry; + } + if (!strcmp(p, "scaled_y")) { snprintf(buf, bufn, "aro=%s:%d", p, scaled_y); - } else if (!strcmp(p, "scale_numer")) { + goto qry; + } + if (!strcmp(p, "scale_numer")) { snprintf(buf, bufn, "aro=%s:%d", p, scale_numer); - } else if (!strcmp(p, "scale_denom")) { + goto qry; + } + 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_blend")) { + goto qry; + } + if (!strcmp(p, "scale_fac_x")) { + snprintf(buf, bufn, "aro=%s:%f", p, scale_fac_x); + goto qry; + } + if (!strcmp(p, "scale_fac_y")) { + snprintf(buf, bufn, "aro=%s:%f", p, scale_fac_y); + goto qry; + } + if (!strcmp(p, "scaling_blend")) { snprintf(buf, bufn, "aro=%s:%d", p, scaling_blend); - } else if (!strcmp(p, "scaling_nomult4")) { + goto qry; + } + if (!strcmp(p, "scaling_nomult4")) { snprintf(buf, bufn, "aro=%s:%d", p, scaling_nomult4); - } else if (!strcmp(p, "scaling_pad")) { + goto qry; + } + if (!strcmp(p, "scaling_pad")) { snprintf(buf, bufn, "aro=%s:%d", p, scaling_pad); - } else if (!strcmp(p, "scaling_interpolate")) { + goto qry; + } + if (!strcmp(p, "scaling_interpolate")) { snprintf(buf, bufn, "aro=%s:%d", p, scaling_interpolate); - } else if (!strcmp(p, "inetd")) { + goto qry; + } + if (!strcmp(p, "inetd")) { snprintf(buf, bufn, "aro=%s:%d", p, inetd); - } else if (!strcmp(p, "privremote")) { + goto qry; + } + if (!strcmp(p, "privremote")) { snprintf(buf, bufn, "aro=%s:%d", p, priv_remote); - } else if (!strcmp(p, "unsafe")) { + goto qry; + } + if (!strcmp(p, "unsafe")) { snprintf(buf, bufn, "aro=%s:%d", p, !safe_remote_only); - } else if (!strcmp(p, "safer")) { + goto qry; + } + if (!strcmp(p, "safer")) { snprintf(buf, bufn, "aro=%s:%d", p, more_safe); - } else if (!strcmp(p, "nocmds")) { + goto qry; + } + if (!strcmp(p, "nocmds")) { snprintf(buf, bufn, "aro=%s:%d", p, no_external_cmds); - } else if (!strcmp(p, "passwdfile")) { + goto qry; + } + if (!strcmp(p, "passwdfile")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(passwdfile)); + goto qry; + } #ifndef NO_SSL_OR_UNIXPW - } else if (!strcmp(p, "unixpw")) { + if (!strcmp(p, "unixpw")) { snprintf(buf, bufn, "aro=%s:%d", p, unixpw); - } else if (!strcmp(p, "unixpw_nis")) { + goto qry; + } + if (!strcmp(p, "unixpw_nis")) { snprintf(buf, bufn, "aro=%s:%d", p, unixpw_nis); - } else if (!strcmp(p, "unixpw_list")) { + goto qry; + } + if (!strcmp(p, "unixpw_list")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(unixpw_list)); - } else if (!strcmp(p, "ssl")) { + goto qry; + } + if (!strcmp(p, "ssl")) { snprintf(buf, bufn, "aro=%s:%d", p, use_openssl); - } else if (!strcmp(p, "ssl_pem")) { + goto qry; + } + if (!strcmp(p, "ssl_pem")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(openssl_pem)); - } else if (!strcmp(p, "sslverify")) { + goto qry; + } + if (!strcmp(p, "sslverify")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(ssl_verify)); - } else if (!strcmp(p, "stunnel")) { + goto qry; + } + if (!strcmp(p, "stunnel")) { snprintf(buf, bufn, "aro=%s:%d", p, use_stunnel); - } else if (!strcmp(p, "stunnel_pem")) { + goto qry; + } + if (!strcmp(p, "stunnel_pem")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(stunnel_pem)); - } else if (!strcmp(p, "https")) { + goto qry; + } + if (!strcmp(p, "https")) { snprintf(buf, bufn, "aro=%s:%d", p, https_port_num); - } else if (!strcmp(p, "httpsredir")) { + goto qry; + } + if (!strcmp(p, "httpsredir")) { snprintf(buf, bufn, "aro=%s:%d", p, https_port_redir); + goto qry; + } #endif - } else if (!strcmp(p, "usepw")) { + if (!strcmp(p, "usepw")) { snprintf(buf, bufn, "aro=%s:%d", p, usepw); - } else if (!strcmp(p, "using_shm")) { + goto qry; + } + if (!strcmp(p, "using_shm")) { snprintf(buf, bufn, "aro=%s:%d", p, !using_shm); - } else if (!strcmp(p, "logfile") || !strcmp(p, "o")) { + goto qry; + } + if (!strcmp(p, "logfile") || !strcmp(p, "o")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(logfile)); - } else if (!strcmp(p, "flag")) { + goto qry; + } + if (!strcmp(p, "flag")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(flagfile)); - } else if (!strcmp(p, "rc")) { + goto qry; + } + if (!strcmp(p, "rc")) { char *s = rc_rcfile; if (rc_rcfile_default) { s = NULL; } snprintf(buf, bufn, "aro=%s:%s", p, NONUL(s)); - } else if (!strcmp(p, "norc")) { + goto qry; + } + if (!strcmp(p, "norc")) { snprintf(buf, bufn, "aro=%s:%d", p, got_norc); - } else if (!strcmp(p, "h") || !strcmp(p, "help") || + goto qry; + } + 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")) { + goto qry; + } + if (!strcmp(p, "bg")) { snprintf(buf, bufn, "aro=%s:%d", p, opts_bg); - } else if (!strcmp(p, "sigpipe")) { + goto qry; + } + if (!strcmp(p, "sigpipe")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(sigpipe)); - } else if (!strcmp(p, "threads")) { + goto qry; + } + if (!strcmp(p, "threads")) { snprintf(buf, bufn, "aro=%s:%d", p, use_threads); - } else if (!strcmp(p, "readrate")) { + goto qry; + } + if (!strcmp(p, "readrate")) { snprintf(buf, bufn, "aro=%s:%d", p, get_read_rate()); - } else if (!strcmp(p, "netrate")) { + goto qry; + } + if (!strcmp(p, "netrate")) { snprintf(buf, bufn, "aro=%s:%d", p, get_net_rate()); - } else if (!strcmp(p, "netlatency")) { + goto qry; + } + if (!strcmp(p, "netlatency")) { snprintf(buf, bufn, "aro=%s:%d", p, get_net_latency()); - } else if (!strcmp(p, "pipeinput")) { + goto qry; + } + if (!strcmp(p, "pipeinput")) { snprintf(buf, bufn, "aro=%s:%s", p, NONUL(pipeinput_str)); - } else if (!strcmp(p, "clients")) { + goto qry; + } + if (!strcmp(p, "clients")) { char *str = list_clients(); snprintf(buf, bufn, "aro=%s:%s", p, str); free(str); - } else if (!strcmp(p, "client_count")) { + goto qry; + } + if (!strcmp(p, "client_count")) { snprintf(buf, bufn, "aro=%s:%d", p, client_count); - } else if (!strcmp(p, "pid")) { + goto qry; + } + if (!strcmp(p, "pid")) { snprintf(buf, bufn, "aro=%s:%d", p, (int) getpid()); - } else if (!strcmp(p, "ext_xtest")) { + goto qry; + } + if (!strcmp(p, "ext_xtest")) { snprintf(buf, bufn, "aro=%s:%d", p, xtest_present); - } else if (!strcmp(p, "ext_xtrap")) { + goto qry; + } + if (!strcmp(p, "ext_xtrap")) { snprintf(buf, bufn, "aro=%s:%d", p, xtrap_present); - } else if (!strcmp(p, "ext_xrecord")) { + goto qry; + } + if (!strcmp(p, "ext_xrecord")) { snprintf(buf, bufn, "aro=%s:%d", p, xrecord_present); - } else if (!strcmp(p, "ext_xkb")) { + goto qry; + } + if (!strcmp(p, "ext_xkb")) { snprintf(buf, bufn, "aro=%s:%d", p, xkb_present); - } else if (!strcmp(p, "ext_xshm")) { + goto qry; + } + if (!strcmp(p, "ext_xshm")) { snprintf(buf, bufn, "aro=%s:%d", p, xshm_present); - } else if (!strcmp(p, "ext_xinerama")) { + goto qry; + } + if (!strcmp(p, "ext_xinerama")) { snprintf(buf, bufn, "aro=%s:%d", p, xinerama_present); - } else if (!strcmp(p, "ext_overlay")) { + goto qry; + } + if (!strcmp(p, "ext_overlay")) { snprintf(buf, bufn, "aro=%s:%d", p, overlay_present); - } else if (!strcmp(p, "ext_xfixes")) { + goto qry; + } + if (!strcmp(p, "ext_xfixes")) { snprintf(buf, bufn, "aro=%s:%d", p, xfixes_present); - } else if (!strcmp(p, "ext_xdamage")) { + goto qry; + } + if (!strcmp(p, "ext_xdamage")) { snprintf(buf, bufn, "aro=%s:%d", p, xdamage_present); - } else if (!strcmp(p, "ext_xrandr")) { + goto qry; + } + if (!strcmp(p, "ext_xrandr")) { snprintf(buf, bufn, "aro=%s:%d", p, xrandr_present); - } else if (!strcmp(p, "rootwin")) { + goto qry; + } + if (!strcmp(p, "rootwin")) { snprintf(buf, bufn, "aro=%s:0x%x", p, (unsigned int) rootwin); - } else if (!strcmp(p, "num_buttons")) { + goto qry; + } + if (!strcmp(p, "num_buttons")) { snprintf(buf, bufn, "aro=%s:%d", p, num_buttons); - } else if (!strcmp(p, "button_mask")) { + goto qry; + } + if (!strcmp(p, "button_mask")) { snprintf(buf, bufn, "aro=%s:%d", p, button_mask); - } else if (!strcmp(p, "mouse_x")) { + goto qry; + } + if (!strcmp(p, "mouse_x")) { snprintf(buf, bufn, "aro=%s:%d", p, cursor_x); - } else if (!strcmp(p, "mouse_y")) { + goto qry; + } + if (!strcmp(p, "mouse_y")) { snprintf(buf, bufn, "aro=%s:%d", p, cursor_y); - } else if (!strcmp(p, "bpp")) { + goto qry; + } + if (!strcmp(p, "bpp")) { snprintf(buf, bufn, "aro=%s:%d", p, bpp); - } else if (!strcmp(p, "depth")) { + goto qry; + } + if (!strcmp(p, "depth")) { snprintf(buf, bufn, "aro=%s:%d", p, depth); - } else if (!strcmp(p, "indexed_color")) { + goto qry; + } + if (!strcmp(p, "indexed_color")) { snprintf(buf, bufn, "aro=%s:%d", p, indexed_color); - } else if (!strcmp(p, "dpy_x")) { + goto qry; + } + if (!strcmp(p, "dpy_x")) { snprintf(buf, bufn, "aro=%s:%d", p, dpy_x); - } else if (!strcmp(p, "dpy_y")) { + goto qry; + } + if (!strcmp(p, "dpy_y")) { snprintf(buf, bufn, "aro=%s:%d", p, dpy_y); - } else if (!strcmp(p, "wdpy_x")) { + goto qry; + } + if (!strcmp(p, "wdpy_x")) { snprintf(buf, bufn, "aro=%s:%d", p, wdpy_x); - } else if (!strcmp(p, "wdpy_y")) { + goto qry; + } + if (!strcmp(p, "wdpy_y")) { snprintf(buf, bufn, "aro=%s:%d", p, wdpy_y); - } else if (!strcmp(p, "off_x")) { + goto qry; + } + if (!strcmp(p, "off_x")) { snprintf(buf, bufn, "aro=%s:%d", p, off_x); - } else if (!strcmp(p, "off_y")) { + goto qry; + } + if (!strcmp(p, "off_y")) { snprintf(buf, bufn, "aro=%s:%d", p, off_y); - } else if (!strcmp(p, "cdpy_x")) { + goto qry; + } + if (!strcmp(p, "cdpy_x")) { snprintf(buf, bufn, "aro=%s:%d", p, cdpy_x); - } else if (!strcmp(p, "cdpy_y")) { + goto qry; + } + if (!strcmp(p, "cdpy_y")) { snprintf(buf, bufn, "aro=%s:%d", p, cdpy_y); - } else if (!strcmp(p, "coff_x")) { + goto qry; + } + if (!strcmp(p, "coff_x")) { snprintf(buf, bufn, "aro=%s:%d", p, coff_x); - } else if (!strcmp(p, "coff_y")) { + goto qry; + } + if (!strcmp(p, "coff_y")) { snprintf(buf, bufn, "aro=%s:%d", p, coff_y); - } else if (!strcmp(p, "rfbauth")) { + goto qry; + } + if (!strcmp(p, "rfbauth")) { NOTAPPRO - } else if (!strcmp(p, "passwd")) { + goto qry; + } + if (!strcmp(p, "passwd")) { NOTAPPRO - } else if (!strcmp(p, "viewpasswd")) { + goto qry; + } + if (!strcmp(p, "viewpasswd")) { NOTAPPRO - } else { + goto qry; + } + if (1) { NOTAPP + goto qry; } - goto qry; - } else { + goto done; + } + if (1) { char tmp[100]; NOTAPP rfbLog("remote_cmd: warning unknown\n"); @@ -4803,7 +5439,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { done: if (*buf == '\0') { - sprintf(buf, "ack=1"); + sprintf(buf, "%s", "ack=1"); } qry: @@ -4823,7 +5459,7 @@ char *process_remote_cmd(char *cmd, int stringonly) { XFlush_wr(dpy); } } -#endif +#endif /* REMOTE_CONTROL */ return NULL; } |