mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
-d option to attach. Also fix CC in Makefile and make it build with DEBUG again.
This commit is contained in:
parent
4add09eab7
commit
5a3b92c2df
3
CHANGES
3
CHANGES
@ -1,5 +1,6 @@
|
||||
04 October 2007
|
||||
|
||||
* (nicm) -d option to attach to detach all other clients on the same session.
|
||||
* (nicm) Partial resizing support. Still buggy. A C-b S and back sometimes fixes
|
||||
it when it goes wonky.
|
||||
* (mxey) Added my tmux start script as an example (examples/start-tmux.sh).
|
||||
@ -117,5 +118,5 @@
|
||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||
customisation.
|
||||
|
||||
$Id: CHANGES,v 1.35 2007-10-04 19:03:51 nicm Exp $
|
||||
$Id: CHANGES,v 1.36 2007-10-04 21:21:48 nicm Exp $
|
||||
|
||||
|
4
Makefile
4
Makefile
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.23 2007-10-04 19:03:51 nicm Exp $
|
||||
# $Id: Makefile,v 1.24 2007-10-04 21:21:48 nicm Exp $
|
||||
|
||||
.SUFFIXES: .c .o .y .h
|
||||
.PHONY: clean
|
||||
@ -26,7 +26,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
|
||||
|
||||
YACC= yacc -d
|
||||
|
||||
CC= cc
|
||||
CC?= cc
|
||||
INCDIRS+= -I. -I- -I/usr/local/include
|
||||
CFLAGS+= -DBUILD="\"$(VERSION) ($(DATE))\"" -DMETA="'${META}'"
|
||||
.ifdef PROFILE
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-attach-session.c,v 1.2 2007-10-04 19:03:51 nicm Exp $ */
|
||||
/* $Id: cmd-attach-session.c,v 1.3 2007-10-04 21:21:48 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -26,23 +26,71 @@
|
||||
* Attach existing session to the current terminal.
|
||||
*/
|
||||
|
||||
void cmd_attach_session_exec(void *, struct cmd_ctx *);
|
||||
int cmd_attach_session_parse(void **, int, char **, char **);
|
||||
const char *cmd_attach_session_usage(void);
|
||||
void cmd_attach_session_exec(void *, struct cmd_ctx *);
|
||||
void cmd_attach_session_send(void *, struct buffer *);
|
||||
void cmd_attach_session_recv(void **, struct buffer *);
|
||||
void cmd_attach_session_free(void *);
|
||||
|
||||
const struct cmd_entry cmd_attach_session_entry = {
|
||||
CMD_ATTACHSESSION, "attach-session", "attach", 0,
|
||||
NULL,
|
||||
NULL,
|
||||
cmd_attach_session_exec,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
struct cmd_attach_session_data {
|
||||
int flag_detach;
|
||||
};
|
||||
|
||||
void
|
||||
cmd_attach_session_exec(unused void *ptr, struct cmd_ctx *ctx)
|
||||
const struct cmd_entry cmd_attach_session_entry = {
|
||||
CMD_NEWWINDOW, "attach-session", "attach", 0,
|
||||
cmd_attach_session_parse,
|
||||
cmd_attach_session_usage,
|
||||
cmd_attach_session_exec,
|
||||
cmd_attach_session_send,
|
||||
cmd_attach_session_recv,
|
||||
cmd_attach_session_free
|
||||
};
|
||||
|
||||
int
|
||||
cmd_attach_session_parse(void **ptr, int argc, char **argv, char **cause)
|
||||
{
|
||||
struct client *c = ctx->client;
|
||||
struct session *s = ctx->session;
|
||||
struct cmd_attach_session_data *data;
|
||||
int opt;
|
||||
|
||||
*ptr = data = xmalloc(sizeof *data);
|
||||
data->flag_detach = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "dn:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
data->flag_detach = 1;
|
||||
break;
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (argc != 0)
|
||||
goto usage;
|
||||
|
||||
return (0);
|
||||
|
||||
usage:
|
||||
usage(cause, "%s", cmd_attach_session_usage());
|
||||
|
||||
cmd_attach_session_free(data);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
const char *
|
||||
cmd_attach_session_usage(void)
|
||||
{
|
||||
return ("attach-session [-d]");
|
||||
}
|
||||
|
||||
void
|
||||
cmd_attach_session_exec(void *ptr, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct cmd_attach_session_data *data = ptr;
|
||||
struct client *c = ctx->client;
|
||||
struct session *s = ctx->session;
|
||||
|
||||
if (ctx->flags & CMD_KEY)
|
||||
return;
|
||||
@ -51,10 +99,37 @@ cmd_attach_session_exec(unused void *ptr, struct cmd_ctx *ctx)
|
||||
ctx->error(ctx, "not a terminal");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (data->flag_detach)
|
||||
server_write_session(s, MSG_DETACH, NULL, 0);
|
||||
c->session = s;
|
||||
|
||||
server_write_client(c, MSG_READY, NULL, 0);
|
||||
recalculate_sizes();
|
||||
server_redraw_client(c);
|
||||
}
|
||||
|
||||
void
|
||||
cmd_attach_session_send(void *ptr, struct buffer *b)
|
||||
{
|
||||
struct cmd_attach_session_data *data = ptr;
|
||||
|
||||
buffer_write(b, data, sizeof *data);
|
||||
}
|
||||
|
||||
void
|
||||
cmd_attach_session_recv(void **ptr, struct buffer *b)
|
||||
{
|
||||
struct cmd_attach_session_data *data;
|
||||
|
||||
*ptr = data = xmalloc(sizeof *data);
|
||||
buffer_read(b, data, sizeof *data);
|
||||
}
|
||||
|
||||
void
|
||||
cmd_attach_session_free(void *ptr)
|
||||
{
|
||||
struct cmd_attach_session_data *data = ptr;
|
||||
|
||||
xfree(data);
|
||||
}
|
||||
|
4
server.c
4
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.25 2007-10-04 20:01:10 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.26 2007-10-04 21:21:48 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -74,7 +74,9 @@ server_start(char *path)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
xmalloc_clear();
|
||||
#endif
|
||||
|
||||
logfile("server");
|
||||
setproctitle("server (%s)", path);
|
||||
|
Loading…
Reference in New Issue
Block a user