aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--client-msg.c14
-rw-r--r--op.c14
-rw-r--r--server-msg.c5
4 files changed, 28 insertions, 8 deletions
diff --git a/CHANGES b/CHANGES
index b5ba385b..4ae850f7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,6 @@
29 September 2007
+* (nicm) Allow creation of detached sessions: "tmux new-session -d".
* (nicm) Permit error messages to be passed back for transient clients like
rename. Also make rename -i work.
* (nicm) Pass through bell in any window to current.
@@ -74,5 +75,5 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.15 2007-09-29 13:22:15 nicm Exp $
+$Id: CHANGES,v 1.16 2007-09-29 14:57:07 nicm Exp $
diff --git a/client-msg.c b/client-msg.c
index ec0c6c8e..8ecc38d0 100644
--- a/client-msg.c
+++ b/client-msg.c
@@ -1,4 +1,4 @@
-/* $Id: client-msg.c,v 1.3 2007-09-26 18:50:49 nicm Exp $ */
+/* $Id: client-msg.c,v 1.4 2007-09-29 14:57:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -26,6 +26,7 @@
int client_msg_fn_output(struct hdr *, struct client_ctx *, char **);
int client_msg_fn_pause(struct hdr *, struct client_ctx *, char **);
+int client_msg_fn_done(struct hdr *, struct client_ctx *, char **);
int client_msg_fn_exit(struct hdr *, struct client_ctx *, char **);
int client_msg_fn_error(struct hdr *, struct client_ctx *, char **);
@@ -37,6 +38,7 @@ struct client_msg {
struct client_msg client_msg_table[] = {
{ MSG_OUTPUT, client_msg_fn_output },
{ MSG_PAUSE, client_msg_fn_pause },
+ { MSG_DONE, client_msg_fn_done },
{ MSG_EXIT, client_msg_fn_exit },
{ MSG_ERROR, client_msg_fn_error },
};
@@ -100,6 +102,16 @@ client_msg_fn_exit(
return (-1);
}
+/* Done message from server. */
+int
+client_msg_fn_done(
+ struct hdr *hdr, unused struct client_ctx *cctx, unused char **error)
+{
+ if (hdr->size != 0)
+ fatalx("bad MSG_DONE size");
+ return (0);
+}
+
/* Error message from server. */
int
client_msg_fn_error(struct hdr *hdr, struct client_ctx *cctx, char **error)
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));
}
diff --git a/server-msg.c b/server-msg.c
index 0ffa0ede..d52e0812 100644
--- a/server-msg.c
+++ b/server-msg.c
@@ -1,4 +1,4 @@
-/* $Id: server-msg.c,v 1.9 2007-09-29 13:22:15 nicm Exp $ */
+/* $Id: server-msg.c,v 1.10 2007-09-29 14:57:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -128,7 +128,8 @@ server_msg_fn_new(struct hdr *hdr, struct client *c)
if (c->session == NULL)
fatalx("session_create failed");
xfree(cmd);
-
+
+ server_write_client(c, MSG_DONE, NULL, 0);
server_draw_client(c, 0, c->sy - 1);
return (0);