diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2013-03-24 09:58:40 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2013-03-24 09:58:40 +0000 |
commit | 14fad6a5ccd6d5f2b9e372975e0062219853f891 (patch) | |
tree | 144c54008dae40e6be3df8559c4f8eb2b295e070 /cmd-new-session.c | |
parent | c71844de631186f3df7ff5a6e3aab613da1e4853 (diff) |
Add -A flag to new-session to make it behave like attach-session if the
session exists. If -A is used, -D behaves like -d to attach-session.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r-- | cmd-new-session.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c index 13ab667e..1cc6fbab 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -35,8 +35,8 @@ enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *); 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] " CMD_TARGET_SESSION_USAGE + "AdDn:s:t:x:y:", 0, 1, + "[-AdD] [-n window-name] [-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] [-y height] [command]", CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, NULL, @@ -76,6 +76,10 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); } if (session_find(newname) != NULL) { + if (args_has(args, 'A')) { + return (cmd_attach_session(cmdq, newname, + args_has(args, 'D'), 0)); + } cmdq_error(cmdq, "duplicate session: %s", newname); return (CMD_RETURN_ERROR); } |