=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-new-session.c,v retrieving revision 1.34 retrieving revision 1.35 diff -c -r1.34 -r1.35 *** src/usr.bin/tmux/cmd-new-session.c 2011/01/04 00:42:47 1.34 --- src/usr.bin/tmux/cmd-new-session.c 2011/01/14 23:49:23 1.35 *************** *** 1,4 **** ! /* $OpenBSD: cmd-new-session.c,v 1.34 2011/01/04 00:42:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-new-session.c,v 1.35 2011/01/14 23:49:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 19,24 **** --- 19,25 ---- #include #include + #include #include #include #include *************** *** 34,41 **** const struct cmd_entry cmd_new_session_entry = { "new-session", "new", ! "dn:s:t:", 0, 1, ! "[-d] [-n window-name] [-s session-name] [-t target-session] [command]", CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, NULL, cmd_new_session_check, --- 35,43 ---- const struct cmd_entry cmd_new_session_entry = { "new-session", "new", ! "dn:s:t:x:y:", 0, 1, ! "[-d] [-n window-name] [-s session-name] [-t target-session] " ! "[-x width] [-y height] [command]", CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, NULL, cmd_new_session_check, *************** *** 47,52 **** --- 49,57 ---- { if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) return (-1); + if (!args_has(args, 'd') && + (args_has(args, 'x') || args_has(args, 'y'))) + return (-1); return (0); } *************** *** 60,66 **** struct environ env; struct termios tio, *tiop; struct passwd *pw; ! const char *newname, *target, *update, *cwd; char *overrides, *cmd, *cause; int detached, idx; u_int sx, sy, i; --- 65,71 ---- struct environ env; struct termios tio, *tiop; struct passwd *pw; ! const char *newname, *target, *update, *cwd, *errstr; char *overrides, *cmd, *cause; int detached, idx; u_int sx, sy, i; *************** *** 149,154 **** --- 154,175 ---- if (detached) { sx = 80; sy = 24; + if (args_has(args, 'x')) { + sx = strtonum( + args_get(args, 'x'), 1, USHRT_MAX, &errstr); + if (errstr != NULL) { + ctx->error(ctx, "width %s", errstr); + return (-1); + } + } + if (args_has(args, 'y')) { + sy = strtonum( + args_get(args, 'y'), 1, USHRT_MAX, &errstr); + if (errstr != NULL) { + ctx->error(ctx, "height %s", errstr); + return (-1); + } + } } else if (ctx->cmdclient != NULL) { sx = ctx->cmdclient->tty.sx; sy = ctx->cmdclient->tty.sy;