mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Quick and dirty kill-server command.
This commit is contained in:
		
							
								
								
									
										6
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								CHANGES
									
									
									
									
									
								
							@@ -1,3 +1,7 @@
 | 
				
			|||||||
 | 
					03 June 2008
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* kill-server command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
02 June 2008
 | 
					02 June 2008
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* New command, start-server (alias "start"), to start the tmux server and do
 | 
					* New command, start-server (alias "start"), to start the tmux server and do
 | 
				
			||||||
@@ -368,4 +372,4 @@
 | 
				
			|||||||
  (including mutt, emacs). No status bar yet and no key remapping or other
 | 
					  (including mutt, emacs). No status bar yet and no key remapping or other
 | 
				
			||||||
  customisation.
 | 
					  customisation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$Id: CHANGES,v 1.98 2008-06-02 21:08:36 nicm Exp $
 | 
					$Id: CHANGES,v 1.99 2008-06-03 05:10:38 nicm Exp $
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								GNUmakefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								GNUmakefile
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
# $Id: GNUmakefile,v 1.12 2008-06-01 20:20:25 nicm Exp $
 | 
					# $Id: GNUmakefile,v 1.13 2008-06-03 05:10:38 nicm Exp $
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: clean
 | 
					.PHONY: clean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -13,8 +13,8 @@ META?= \002
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
 | 
					SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
 | 
				
			||||||
      xmalloc.c xmalloc-debug.c input.c input-keys.c screen.c screen-display.c \
 | 
					      xmalloc.c xmalloc-debug.c input.c input-keys.c screen.c screen-display.c \
 | 
				
			||||||
      window.c session.c log.c client.c client-msg.c client-fn.c \
 | 
					      window.c session.c log.c client.c client-msg.c client-fn.c cfg.c \
 | 
				
			||||||
      key-string.c key-bindings.c resize.c cmd.c cmd-new-session.c \
 | 
					      key-string.c key-bindings.c resize.c cmd.c cmd-generic.c \
 | 
				
			||||||
      cmd-detach-client.c cmd-list-sessions.c cmd-new-window.c cmd-bind-key.c \
 | 
					      cmd-detach-client.c cmd-list-sessions.c cmd-new-window.c cmd-bind-key.c \
 | 
				
			||||||
      cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
 | 
					      cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
 | 
				
			||||||
      cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
 | 
					      cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
 | 
				
			||||||
@@ -23,7 +23,9 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
 | 
				
			|||||||
      cmd-link-window.c cmd-unlink-window.c cmd-next-window.c cmd-send-keys.c \
 | 
					      cmd-link-window.c cmd-unlink-window.c cmd-next-window.c cmd-send-keys.c \
 | 
				
			||||||
      cmd-swap-window.c cmd-rename-session.c cmd-kill-session.c \
 | 
					      cmd-swap-window.c cmd-rename-session.c cmd-kill-session.c \
 | 
				
			||||||
      cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \
 | 
					      cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \
 | 
				
			||||||
      cmd-paste-buffer.c window-scroll.c window-more.c window-copy.c \
 | 
					      cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \
 | 
				
			||||||
 | 
					      cmd-kill-server.c \
 | 
				
			||||||
 | 
					      window-scroll.c window-more.c window-copy.c \
 | 
				
			||||||
      tty.c tty-keys.c tty-write.c screen-write.c screen-redraw.c
 | 
					      tty.c tty-keys.c tty-write.c screen-write.c screen-redraw.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CC?= gcc
 | 
					CC?= gcc
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
# $Id: Makefile,v 1.55 2008-06-02 21:08:36 nicm Exp $
 | 
					# $Id: Makefile,v 1.56 2008-06-03 05:10:38 nicm Exp $
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.SUFFIXES: .c .o .y .h
 | 
					.SUFFIXES: .c .o .y .h
 | 
				
			||||||
.PHONY: clean update-index.html upload-index.html
 | 
					.PHONY: clean update-index.html upload-index.html
 | 
				
			||||||
@@ -28,6 +28,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
 | 
				
			|||||||
      cmd-swap-window.c cmd-rename-session.c cmd-kill-session.c \
 | 
					      cmd-swap-window.c cmd-rename-session.c cmd-kill-session.c \
 | 
				
			||||||
      cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \
 | 
					      cmd-switch-client.c cmd-has-session.c cmd-scroll-mode.c cmd-copy-mode.c \
 | 
				
			||||||
      cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \
 | 
					      cmd-paste-buffer.c cmd-new-session.c cmd-start-server.c \
 | 
				
			||||||
 | 
					      cmd-kill-server.c \
 | 
				
			||||||
      window-scroll.c window-more.c window-copy.c \
 | 
					      window-scroll.c window-more.c window-copy.c \
 | 
				
			||||||
      tty.c tty-keys.c tty-write.c screen-write.c screen-redraw.c
 | 
					      tty.c tty-keys.c tty-write.c screen-write.c screen-redraw.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO
									
									
									
									
									
								
							@@ -29,7 +29,6 @@
 | 
				
			|||||||
  is missing (like, eg, xterm-color in an aterm)
 | 
					  is missing (like, eg, xterm-color in an aterm)
 | 
				
			||||||
- refer to windows by name etc (duplicates? fnmatch?)
 | 
					- refer to windows by name etc (duplicates? fnmatch?)
 | 
				
			||||||
- commands:
 | 
					- commands:
 | 
				
			||||||
	start server
 | 
					 | 
				
			||||||
	kill server
 | 
						kill server
 | 
				
			||||||
	show-options command
 | 
						show-options command
 | 
				
			||||||
	command to run something without a window at all?
 | 
						command to run something without a window at all?
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										50
									
								
								cmd-kill-server.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								cmd-kill-server.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
				
			|||||||
 | 
					/* $Id: cmd-kill-server.c,v 1.1 2008-06-03 05:10:38 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Permission to use, copy, modify, and distribute this software for any
 | 
				
			||||||
 | 
					 * purpose with or without fee is hereby granted, provided that the above
 | 
				
			||||||
 | 
					 * copyright notice and this permission notice appear in all copies.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 | 
				
			||||||
 | 
					 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 | 
				
			||||||
 | 
					 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 | 
				
			||||||
 | 
					 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 | 
				
			||||||
 | 
					 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
 | 
				
			||||||
 | 
					 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 | 
				
			||||||
 | 
					 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <signal.h>
 | 
				
			||||||
 | 
					#include <unistd.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "tmux.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Kill the server and do nothing else.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void	cmd_kill_server_exec(void *, struct cmd_ctx *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const struct cmd_entry cmd_kill_server_entry = {
 | 
				
			||||||
 | 
						"kill-server", NULL,
 | 
				
			||||||
 | 
						"",
 | 
				
			||||||
 | 
						0,
 | 
				
			||||||
 | 
						NULL,
 | 
				
			||||||
 | 
						cmd_kill_server_exec,
 | 
				
			||||||
 | 
						NULL,
 | 
				
			||||||
 | 
						NULL,
 | 
				
			||||||
 | 
						NULL
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void
 | 
				
			||||||
 | 
					cmd_kill_server_exec(unused void *ptr, struct cmd_ctx *ctx)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						kill(getpid(), SIGTERM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (ctx->cmdclient != NULL)
 | 
				
			||||||
 | 
							server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd-list-clients.c,v 1.4 2008-06-02 18:08:16 nicm Exp $ */
 | 
					/* $Id: cmd-list-clients.c,v 1.5 2008-06-03 05:10:38 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -18,7 +18,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <getopt.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd-list-keys.c,v 1.6 2008-06-02 18:08:16 nicm Exp $ */
 | 
					/* $Id: cmd-list-keys.c,v 1.7 2008-06-03 05:10:38 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -18,9 +18,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <getopt.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd-list-sessions.c,v 1.10 2008-06-02 18:08:16 nicm Exp $ */
 | 
					/* $Id: cmd-list-sessions.c,v 1.11 2008-06-03 05:10:38 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -18,8 +18,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <getopt.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
#include <time.h>
 | 
					#include <time.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd-send-keys.c,v 1.4 2008-06-02 21:36:51 nicm Exp $ */
 | 
					/* $Id: cmd-send-keys.c,v 1.5 2008-06-03 05:10:38 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -24,7 +24,7 @@
 | 
				
			|||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Change session name.
 | 
					 * Send keys to client.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int	cmd_send_keys_parse(struct cmd *, void **, int, char **, char **);
 | 
					int	cmd_send_keys_parse(struct cmd *, void **, int, char **, char **);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd-start-server.c,v 1.1 2008-06-02 21:08:53 nicm Exp $ */
 | 
					/* $Id: cmd-start-server.c,v 1.2 2008-06-03 05:10:38 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -18,9 +18,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <getopt.h>
 | 
					 | 
				
			||||||
#include <string.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "tmux.h"
 | 
					#include "tmux.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								cmd.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: cmd.c,v 1.36 2008-06-02 21:08:36 nicm Exp $ */
 | 
					/* $Id: cmd.c,v 1.37 2008-06-03 05:10:38 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -30,6 +30,7 @@ const struct cmd_entry *cmd_table[] = {
 | 
				
			|||||||
	&cmd_copy_mode_entry,
 | 
						&cmd_copy_mode_entry,
 | 
				
			||||||
	&cmd_detach_client_entry,
 | 
						&cmd_detach_client_entry,
 | 
				
			||||||
	&cmd_has_session_entry,
 | 
						&cmd_has_session_entry,
 | 
				
			||||||
 | 
						&cmd_kill_server_entry,
 | 
				
			||||||
	&cmd_kill_session_entry,
 | 
						&cmd_kill_session_entry,
 | 
				
			||||||
	&cmd_kill_window_entry,
 | 
						&cmd_kill_window_entry,
 | 
				
			||||||
	&cmd_last_window_entry,
 | 
						&cmd_last_window_entry,
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: tmux.h,v 1.120 2008-06-02 22:09:49 nicm Exp $ */
 | 
					/* $Id: tmux.h,v 1.121 2008-06-03 05:10:38 nicm Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -737,6 +737,7 @@ extern const struct cmd_entry cmd_bind_key_entry;
 | 
				
			|||||||
extern const struct cmd_entry cmd_copy_mode_entry;
 | 
					extern const struct cmd_entry cmd_copy_mode_entry;
 | 
				
			||||||
extern const struct cmd_entry cmd_detach_client_entry;
 | 
					extern const struct cmd_entry cmd_detach_client_entry;
 | 
				
			||||||
extern const struct cmd_entry cmd_has_session_entry;
 | 
					extern const struct cmd_entry cmd_has_session_entry;
 | 
				
			||||||
 | 
					extern const struct cmd_entry cmd_kill_server_entry;
 | 
				
			||||||
extern const struct cmd_entry cmd_kill_session_entry;
 | 
					extern const struct cmd_entry cmd_kill_session_entry;
 | 
				
			||||||
extern const struct cmd_entry cmd_kill_window_entry;
 | 
					extern const struct cmd_entry cmd_kill_window_entry;
 | 
				
			||||||
extern const struct cmd_entry cmd_last_window_entry;
 | 
					extern const struct cmd_entry cmd_last_window_entry;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user