tmux new-session -d.

This commit is contained in:
Nicholas Marriott 2007-09-29 14:57:07 +00:00
parent 1e316cfc7c
commit fa537abf83
4 changed files with 28 additions and 8 deletions

View File

@ -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 $

View File

@ -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)

14
op.c
View File

@ -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));
}

View File

@ -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);