mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Warn and bork on nested sessions ($TMUX exists).
This commit is contained in:
		
							
								
								
									
										3
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								CHANGES
									
									
									
									
									
								
							@@ -1,5 +1,6 @@
 | 
			
		||||
12 October 2007
 | 
			
		||||
 | 
			
		||||
* (nicm) Add a warning if $TMUX exists on new/attach.
 | 
			
		||||
* (nicm) send-prefix command. Bound to C-b by default.
 | 
			
		||||
* (nicm) set status, status-fg, status-bg commands. fg and bg are as a number
 | 
			
		||||
  from 0 to 8 or a string ("red", "blue", etc). status may be 1/0, on/off,
 | 
			
		||||
@@ -126,5 +127,5 @@
 | 
			
		||||
  (including mutt, emacs). No status bar yet and no key remapping or other
 | 
			
		||||
  customisation.
 | 
			
		||||
 | 
			
		||||
$Id: CHANGES,v 1.40 2007-10-12 13:51:44 nicm Exp $
 | 
			
		||||
$Id: CHANGES,v 1.41 2007-10-12 14:46:48 nicm Exp $
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO
									
									
									
									
									
								
							@@ -57,5 +57,4 @@
 | 
			
		||||
	kill window (C-b backsp)
 | 
			
		||||
	kill session (no not bind by default)
 | 
			
		||||
	set shell
 | 
			
		||||
- handle tmux in tmux (check $TMUX and abort)
 | 
			
		||||
- check for some reqd terminfo caps on startup
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd-attach-session.c,v 1.5 2007-10-04 22:04:01 nicm Exp $ */
 | 
			
		||||
/* $Id: cmd-attach-session.c,v 1.6 2007-10-12 14:46:48 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -38,7 +38,7 @@ struct cmd_attach_session_data {
 | 
			
		||||
 | 
			
		||||
const struct cmd_entry cmd_attach_session_entry = {
 | 
			
		||||
	"attach-session", "attach", "[-d]",
 | 
			
		||||
	0,
 | 
			
		||||
	CMD_CANTNEST,
 | 
			
		||||
	cmd_attach_session_parse,
 | 
			
		||||
	cmd_attach_session_exec, 
 | 
			
		||||
	cmd_attach_session_send,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd-new-session.c,v 1.10 2007-10-04 22:04:01 nicm Exp $ */
 | 
			
		||||
/* $Id: cmd-new-session.c,v 1.11 2007-10-12 14:46:48 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -40,7 +40,7 @@ struct cmd_new_session_data {
 | 
			
		||||
 | 
			
		||||
const struct cmd_entry cmd_new_session_entry = {
 | 
			
		||||
	"new-session", "new", "[-d] [-n session name] [command]",
 | 
			
		||||
	CMD_STARTSERVER|CMD_NOSESSION,
 | 
			
		||||
	CMD_STARTSERVER|CMD_NOSESSION|CMD_CANTNEST,
 | 
			
		||||
	cmd_new_session_parse,
 | 
			
		||||
	cmd_new_session_exec, 
 | 
			
		||||
	cmd_new_session_send,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: server-msg.c,v 1.25 2007-10-04 22:04:01 nicm Exp $ */
 | 
			
		||||
/* $Id: server-msg.c,v 1.26 2007-10-12 14:46:48 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -123,6 +123,12 @@ server_msg_fn_command(struct hdr *hdr, struct client *c)
 | 
			
		||||
	ctx.client = c;
 | 
			
		||||
	ctx.flags = 0;
 | 
			
		||||
 | 
			
		||||
	if (data.sid.pid != -1 && (cmd->entry->flags & CMD_CANTNEST)) {
 | 
			
		||||
		server_msg_fn_command_error(&ctx, "sessions should be nested "
 | 
			
		||||
		    "with care. unset $TMUX and retry to force");
 | 
			
		||||
		return (0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (cmd->entry->flags & CMD_NOSESSION)
 | 
			
		||||
		ctx.session = NULL;
 | 
			
		||||
	else {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tmux.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: tmux.c,v 1.30 2007-10-12 12:08:51 nicm Exp $ */
 | 
			
		||||
/* $Id: tmux.c,v 1.31 2007-10-12 14:46:48 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -210,7 +210,8 @@ main(int argc, char **argv)
 | 
			
		||||
		exit(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!(cmd->entry->flags & CMD_NOSESSION))
 | 
			
		||||
	if (!(cmd->entry->flags & CMD_NOSESSION) ||
 | 
			
		||||
	    (cmd->entry->flags & CMD_CANTNEST))
 | 
			
		||||
		client_fill_sessid(&data.sid, name);
 | 
			
		||||
	if (client_init(path, &cctx, cmd->entry->flags & CMD_STARTSERVER) != 0)
 | 
			
		||||
		exit(1);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: tmux.h,v 1.57 2007-10-12 13:51:44 nicm Exp $ */
 | 
			
		||||
/* $Id: tmux.h,v 1.58 2007-10-12 14:46:48 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -470,6 +470,7 @@ struct cmd_entry {
 | 
			
		||||
 | 
			
		||||
#define CMD_STARTSERVER 0x1
 | 
			
		||||
#define CMD_NOSESSION 0x2
 | 
			
		||||
#define CMD_CANTNEST 0x4
 | 
			
		||||
	int		 flags;
 | 
			
		||||
 | 
			
		||||
	int		 (*parse)(void **, int, char **, char **);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user