=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-refresh-client.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/tmux/cmd-refresh-client.c 2018/10/18 08:38:01 1.28 --- src/usr.bin/tmux/cmd-refresh-client.c 2019/07/10 11:20:10 1.29 *************** *** 1,4 **** ! /* $OpenBSD: cmd-refresh-client.c,v 1.28 2018/10/18 08:38:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-refresh-client.c,v 1.29 2019/07/10 11:20:10 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 19,24 **** --- 19,25 ---- #include #include + #include #include "tmux.h" *************** *** 33,40 **** .name = "refresh-client", .alias = "refresh", ! .args = { "cC:DlLRSt:U", 0, 1 }, ! .usage = "[-cDlLRSU] [-C size] " CMD_TARGET_CLIENT_USAGE " [adjustment]", .flags = CMD_AFTERHOOK, .exec = cmd_refresh_client_exec --- 34,42 ---- .name = "refresh-client", .alias = "refresh", ! .args = { "cC:DF:lLRSt:U", 0, 1 }, ! .usage = "[-cDlLRSU] [-C XxY] [-F flags] " CMD_TARGET_CLIENT_USAGE ! " [adjustment]", .flags = CMD_AFTERHOOK, .exec = cmd_refresh_client_exec *************** *** 48,53 **** --- 50,56 ---- struct tty *tty; struct window *w; const char *size, *errstr; + char *copy, *next, *s; u_int x, y, adjust; if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL) *************** *** 107,134 **** if (args_has(args, 'l')) { if (c->session != NULL) tty_putcode_ptr2(&c->tty, TTYC_MS, "", "?"); ! } else if (args_has(args, 'C')) { ! if ((size = args_get(args, 'C')) == NULL) { ! cmdq_error(item, "missing size"); ! return (CMD_RETURN_ERROR); } ! if (sscanf(size, "%u,%u", &x, &y) != 2 && ! sscanf(size, "%ux%u", &x, &y)) { ! cmdq_error(item, "bad size argument"); ! return (CMD_RETURN_ERROR); } - if (x < WINDOW_MINIMUM || x > WINDOW_MAXIMUM || - y < WINDOW_MINIMUM || y > WINDOW_MAXIMUM) { - cmdq_error(item, "size too small or too big"); - return (CMD_RETURN_ERROR); - } - if (!(c->flags & CLIENT_CONTROL)) { - cmdq_error(item, "not a control client"); - return (CMD_RETURN_ERROR); - } - tty_set_size(&c->tty, x, y); - c->flags |= CLIENT_SIZECHANGED; - recalculate_sizes(); return (CMD_RETURN_NORMAL); } --- 110,152 ---- if (args_has(args, 'l')) { if (c->session != NULL) tty_putcode_ptr2(&c->tty, TTYC_MS, "", "?"); ! return (CMD_RETURN_NORMAL); ! } ! ! if (args_has(args, 'C') || args_has(args, 'F')) { ! if (args_has(args, 'C')) { ! if (!(c->flags & CLIENT_CONTROL)) { ! cmdq_error(item, "not a control client"); ! return (CMD_RETURN_ERROR); ! } ! size = args_get(args, 'C'); ! if (sscanf(size, "%u,%u", &x, &y) != 2 && ! sscanf(size, "%ux%u", &x, &y) != 2) { ! cmdq_error(item, "bad size argument"); ! return (CMD_RETURN_ERROR); ! } ! if (x < WINDOW_MINIMUM || x > WINDOW_MAXIMUM || ! y < WINDOW_MINIMUM || y > WINDOW_MAXIMUM) { ! cmdq_error(item, "size too small or too big"); ! return (CMD_RETURN_ERROR); ! } ! tty_set_size(&c->tty, x, y); ! c->flags |= CLIENT_SIZECHANGED; ! recalculate_sizes(); } ! if (args_has(args, 'F')) { ! if (!(c->flags & CLIENT_CONTROL)) { ! cmdq_error(item, "not a control client"); ! return (CMD_RETURN_ERROR); ! } ! s = copy = xstrdup(args_get(args, 'F')); ! while ((next = strsep(&s, ",")) != NULL) { ! /* Unknown flags are ignored. */ ! if (strcmp(next, "no-output") == 0) ! c->flags |= CLIENT_CONTROL_NOOUTPUT; ! } ! free(copy); } return (CMD_RETURN_NORMAL); }