From fa537abf8384ce9ebd285749314c05bd2abd25ad Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 29 Sep 2007 14:57:07 +0000 Subject: tmux new-session -d. --- op.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'op.c') diff --git a/op.c b/op.c index 8fb0fb05..3b8aaaea 100644 --- a/op.c +++ b/op.c @@ -1,4 +1,4 @@ -/* $Id: op.c,v 1.8 2007-09-29 13:22:15 nicm Exp $ */ +/* $Id: op.c,v 1.9 2007-09-29 14:57:07 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -30,11 +30,12 @@ op_new(char *path, int argc, char **argv) struct new_data data; struct client_ctx cctx; char name[MAXNAMELEN]; - int opt; + int opt, detached; *name = '\0'; + detached = 0; optind = 1; - while ((opt = getopt(argc, argv, "s:?")) != EOF) { + while ((opt = getopt(argc, argv, "s:d?")) != EOF) { switch (opt) { case 's': if (strlcpy(name, optarg, sizeof name) >= sizeof name) { @@ -42,9 +43,12 @@ op_new(char *path, int argc, char **argv) return (1); } break; + case 'd': + detached = 1; + break; case '?': default: - return (usage("new [-s session]")); + return (usage("new [-d] [-s session]")); } } argc -= optind; @@ -60,6 +64,8 @@ op_new(char *path, int argc, char **argv) data.sy = cctx.ws.ws_row; client_write_server(&cctx, MSG_NEW, &data, sizeof data); + if (detached) + return (client_flush(&cctx)); return (client_main(&cctx)); } -- cgit