mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	-S for socket, -s for session.
This commit is contained in:
		
							
								
								
									
										10
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								TODO
									
									
									
									
									
								
							@@ -21,4 +21,14 @@
 | 
				
			|||||||
  and buffer_insert_range/delete_range are abominations. this should be
 | 
					  and buffer_insert_range/delete_range are abominations. this should be
 | 
				
			||||||
  rethought
 | 
					  rethought
 | 
				
			||||||
- figure out once and for all what is going on with backspace and del
 | 
					- figure out once and for all what is going on with backspace and del
 | 
				
			||||||
 | 
					- deal properly with ambiguous ops... list-sessions & list-windows
 | 
				
			||||||
- split list into list-sessions and list-windows
 | 
					- split list into list-sessions and list-windows
 | 
				
			||||||
 | 
					- command form:
 | 
				
			||||||
 | 
						tmux <flags> cmd [-s session] <flags> data
 | 
				
			||||||
 | 
					  eg
 | 
				
			||||||
 | 
						tmux rename-session -ssession newname
 | 
				
			||||||
 | 
						tmux rename-window -ssession 5 newname
 | 
				
			||||||
 | 
					  if no session specified:
 | 
				
			||||||
 | 
						- inside tmux, check $TMUX (pid:session or something)
 | 
				
			||||||
 | 
					        - otherwise if 1 session, use it
 | 
				
			||||||
 | 
						- otherwise bail with error
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								op-list.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								op-list.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: op-list.c,v 1.2 2007-09-26 18:32:16 nicm Exp $ */
 | 
					/* $Id: op-list.c,v 1.3 2007-09-26 19:38:42 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -39,9 +39,9 @@ op_list(char *path, int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	*name = '\0';
 | 
						*name = '\0';
 | 
				
			||||||
	optind = 1;
 | 
						optind = 1;
 | 
				
			||||||
	while ((opt = getopt(argc, argv, "n:?")) != EOF) {
 | 
						while ((opt = getopt(argc, argv, "s:?")) != EOF) {
 | 
				
			||||||
		switch (opt) {
 | 
							switch (opt) {
 | 
				
			||||||
		case 'n':
 | 
							case 's':
 | 
				
			||||||
			if (strlcpy(name, optarg, sizeof name) >= sizeof name) {
 | 
								if (strlcpy(name, optarg, sizeof name) >= sizeof name) {
 | 
				
			||||||
				log_warnx("%s: session name too long", optarg);
 | 
									log_warnx("%s: session name too long", optarg);
 | 
				
			||||||
				return (1);
 | 
									return (1);
 | 
				
			||||||
@@ -49,13 +49,13 @@ op_list(char *path, int argc, char **argv)
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		case '?':
 | 
							case '?':
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			return (usage("list [-n session]"));
 | 
								return (usage("list [-s session]"));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}	
 | 
						}	
 | 
				
			||||||
	argc -= optind;
 | 
						argc -= optind;
 | 
				
			||||||
	argv += optind;			
 | 
						argv += optind;			
 | 
				
			||||||
	if (argc != 0)
 | 
						if (argc != 0)
 | 
				
			||||||
		return (usage("list [-n session]"));
 | 
							return (usage("list [-s session]"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (client_init(path, &cctx, 0) != 0)
 | 
						if (client_init(path, &cctx, 0) != 0)
 | 
				
			||||||
		return (1);
 | 
							return (1);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								op.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								op.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: op.c,v 1.4 2007-09-26 18:18:39 nicm Exp $ */
 | 
					/* $Id: op.c,v 1.5 2007-09-26 19:38:42 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -33,9 +33,9 @@ op_new(char *path, int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	*name = '\0';
 | 
						*name = '\0';
 | 
				
			||||||
	optind = 1;
 | 
						optind = 1;
 | 
				
			||||||
	while ((opt = getopt(argc, argv, "n:?")) != EOF) {
 | 
						while ((opt = getopt(argc, argv, "s:?")) != EOF) {
 | 
				
			||||||
		switch (opt) {
 | 
							switch (opt) {
 | 
				
			||||||
		case 'n':
 | 
							case 's':
 | 
				
			||||||
			if (strlcpy(name, optarg, sizeof name) >= sizeof name) {
 | 
								if (strlcpy(name, optarg, sizeof name) >= sizeof name) {
 | 
				
			||||||
				log_warnx("%s: session name too long", optarg);
 | 
									log_warnx("%s: session name too long", optarg);
 | 
				
			||||||
				return (1);
 | 
									return (1);
 | 
				
			||||||
@@ -43,13 +43,13 @@ op_new(char *path, int argc, char **argv)
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		case '?':
 | 
							case '?':
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			return (usage("new [-n session]"));
 | 
								return (usage("new [-s session]"));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}	
 | 
						}	
 | 
				
			||||||
	argc -= optind;
 | 
						argc -= optind;
 | 
				
			||||||
	argv += optind;			
 | 
						argv += optind;			
 | 
				
			||||||
	if (argc != 0)
 | 
						if (argc != 0)
 | 
				
			||||||
		return (usage("new [-n session]"));
 | 
							return (usage("new [-s session]"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (client_init(path, &cctx, 1) != 0)
 | 
						if (client_init(path, &cctx, 1) != 0)
 | 
				
			||||||
		return (1);
 | 
							return (1);
 | 
				
			||||||
@@ -72,9 +72,9 @@ op_attach(char *path, int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	*name = '\0';
 | 
						*name = '\0';
 | 
				
			||||||
	optind = 1;
 | 
						optind = 1;
 | 
				
			||||||
	while ((opt = getopt(argc, argv, "n:?")) != EOF) {
 | 
						while ((opt = getopt(argc, argv, "s:?")) != EOF) {
 | 
				
			||||||
		switch (opt) {
 | 
							switch (opt) {
 | 
				
			||||||
		case 'n':
 | 
							case 's':
 | 
				
			||||||
			if (strlcpy(name, optarg, sizeof name) >= sizeof name) {
 | 
								if (strlcpy(name, optarg, sizeof name) >= sizeof name) {
 | 
				
			||||||
				log_warnx("%s: session name too long", optarg);
 | 
									log_warnx("%s: session name too long", optarg);
 | 
				
			||||||
				return (1);
 | 
									return (1);
 | 
				
			||||||
@@ -82,13 +82,13 @@ op_attach(char *path, int argc, char **argv)
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		case '?':
 | 
							case '?':
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			return (usage("attach [-n session]"));
 | 
								return (usage("attach [-s session]"));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}	
 | 
						}	
 | 
				
			||||||
	argc -= optind;
 | 
						argc -= optind;
 | 
				
			||||||
	argv += optind;			
 | 
						argv += optind;			
 | 
				
			||||||
	if (argc != 0)
 | 
						if (argc != 0)
 | 
				
			||||||
		return (usage("attach [-n session]"));
 | 
							return (usage("attach [-s session]"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (client_init(path, &cctx, 1) != 0)
 | 
						if (client_init(path, &cctx, 1) != 0)
 | 
				
			||||||
		return (1);
 | 
							return (1);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								tmux.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: tmux.c,v 1.12 2007-09-26 19:09:30 nicm Exp $ */
 | 
					/* $Id: tmux.c,v 1.13 2007-09-26 19:38:42 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -55,7 +55,7 @@ usage(const char *s)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if (s == NULL)
 | 
						if (s == NULL)
 | 
				
			||||||
		s = "command [flags]";
 | 
							s = "command [flags]";
 | 
				
			||||||
	fprintf(stderr, "usage: %s [-v] [-s path] %s\n", __progname, s);
 | 
						fprintf(stderr, "usage: %s [-v] [-S path] %s\n", __progname, s);
 | 
				
			||||||
	return (1);
 | 
						return (1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -161,9 +161,9 @@ main(int argc, char **argv)
 | 
				
			|||||||
	u_int			 i;
 | 
						u_int			 i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	path = NULL;
 | 
						path = NULL;
 | 
				
			||||||
        while ((opt = getopt(argc, argv, "s:v?")) != EOF) {
 | 
					        while ((opt = getopt(argc, argv, "S:v?")) != EOF) {
 | 
				
			||||||
                switch (opt) {
 | 
					                switch (opt) {
 | 
				
			||||||
		case 's':
 | 
							case 'S':
 | 
				
			||||||
			path = xstrdup(optarg);
 | 
								path = xstrdup(optarg);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case 'v':
 | 
							case 'v':
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user