aboutsummaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-09-29 14:57:07 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-09-29 14:57:07 +0000
commitfa537abf8384ce9ebd285749314c05bd2abd25ad (patch)
treef0c57728b7a5c2ec2e5ae5d4f73db5c639c70276 /op.c
parent1e316cfc7c0623038f850de1a2f2688497c51914 (diff)
downloadrtmux-fa537abf8384ce9ebd285749314c05bd2abd25ad.tar.gz
rtmux-fa537abf8384ce9ebd285749314c05bd2abd25ad.tar.bz2
rtmux-fa537abf8384ce9ebd285749314c05bd2abd25ad.zip
tmux new-session -d.
Diffstat (limited to 'op.c')
-rw-r--r--op.c14
1 files changed, 10 insertions, 4 deletions
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 <nicm@users.sourceforge.net>
@@ -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));
}