version 1.34, 2011/01/04 00:42:47 |
version 1.35, 2011/01/14 23:49:23 |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include <pwd.h> |
#include <pwd.h> |
|
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <termios.h> |
#include <termios.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
|
|
const struct cmd_entry cmd_new_session_entry = { |
const struct cmd_entry cmd_new_session_entry = { |
"new-session", "new", |
"new-session", "new", |
"dn:s:t:", 0, 1, |
"dn:s:t:x:y:", 0, 1, |
"[-d] [-n window-name] [-s session-name] [-t target-session] [command]", |
"[-d] [-n window-name] [-s session-name] [-t target-session] " |
|
"[-x width] [-y height] [command]", |
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, |
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, |
NULL, |
NULL, |
cmd_new_session_check, |
cmd_new_session_check, |
|
|
{ |
{ |
if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) |
if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) |
return (-1); |
return (-1); |
|
if (!args_has(args, 'd') && |
|
(args_has(args, 'x') || args_has(args, 'y'))) |
|
return (-1); |
return (0); |
return (0); |
} |
} |
|
|
|
|
struct environ env; |
struct environ env; |
struct termios tio, *tiop; |
struct termios tio, *tiop; |
struct passwd *pw; |
struct passwd *pw; |
const char *newname, *target, *update, *cwd; |
const char *newname, *target, *update, *cwd, *errstr; |
char *overrides, *cmd, *cause; |
char *overrides, *cmd, *cause; |
int detached, idx; |
int detached, idx; |
u_int sx, sy, i; |
u_int sx, sy, i; |
|
|
if (detached) { |
if (detached) { |
sx = 80; |
sx = 80; |
sy = 24; |
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) { |
} else if (ctx->cmdclient != NULL) { |
sx = ctx->cmdclient->tty.sx; |
sx = ctx->cmdclient->tty.sx; |
sy = ctx->cmdclient->tty.sy; |
sy = ctx->cmdclient->tty.sy; |