summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-03 05:10:38 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-03 05:10:38 +0000
commiteaee4dc800734a8ccebb78af02440a8e3d7769bd (patch)
treef69744d3896c8fd3fa03a0fd7ec7132357aae4f0
parent48490b14da295726a8e87ea105051c28d232df2e (diff)
Quick and dirty kill-server command.
-rw-r--r--CHANGES6
-rw-r--r--GNUmakefile10
-rw-r--r--Makefile3
-rw-r--r--TODO1
-rw-r--r--cmd-kill-server.c50
-rw-r--r--cmd-list-clients.c3
-rw-r--r--cmd-list-keys.c5
-rw-r--r--cmd-list-sessions.c4
-rw-r--r--cmd-send-keys.c4
-rw-r--r--cmd-start-server.c5
-rw-r--r--cmd.c3
-rw-r--r--tmux.h3
12 files changed, 73 insertions, 24 deletions
diff --git a/CHANGES b/CHANGES
index 3e665e91..817edebd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+03 June 2008
+
+* kill-server command.
+
02 June 2008
* 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
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 $
diff --git a/GNUmakefile b/GNUmakefile
index e9cf5da3..b688b760 100644
--- a/GNUmakefile
+++ b/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
@@ -13,8 +13,8 @@ META?= \002
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 \
- window.c session.c log.c client.c client-msg.c client-fn.c \
- key-string.c key-bindings.c resize.c cmd.c cmd-new-session.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-generic.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-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-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-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
CC?= gcc
diff --git a/Makefile b/Makefile
index 40d2545f..bdc5c056 100644
--- a/Makefile
+++ b/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
.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-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-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
diff --git a/TODO b/TODO
index 3b0efa35..cab4ac12 100644
--- a/TODO
+++ b/TODO
@@ -29,7 +29,6 @@
is missing (like, eg, xterm-color in an aterm)
- refer to windows by name etc (duplicates? fnmatch?)
- commands:
- start server
kill server
show-options command
command to run something without a window at all?
diff --git a/cmd-kill-server.c b/cmd-kill-server.c
new file mode 100644
index 00000000..6d3d8f59
--- /dev/null
+++ b/cmd-kill-server.c
@@ -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);
+}
diff --git a/cmd-list-clients.c b/cmd-list-clients.c
index e3624b2f..e48ab4c1 100644
--- a/cmd-list-clients.c
+++ b/cmd-list-clients.c
@@ -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>
@@ -18,7 +18,6 @@
#include <sys/types.h>
-#include <getopt.h>
#include <string.h>
#include <time.h>
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index c5d622e9..2800512e 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -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>
@@ -18,9 +18,6 @@
#include <sys/types.h>
-#include <getopt.h>
-#include <string.h>
-
#include "tmux.h"
/*
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index 2c86d7e5..d463aa92 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -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>
@@ -18,8 +18,6 @@
#include <sys/types.h>
-#include <getopt.h>
-#include <string.h>
#include <time.h>
#include "tmux.h"
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index b27abe08..ae5e4ef4 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -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>
@@ -24,7 +24,7 @@
#include "tmux.h"
/*
- * Change session name.
+ * Send keys to client.
*/
int cmd_send_keys_parse(struct cmd *, void **, int, char **, char **);
diff --git a/cmd-start-server.c b/cmd-start-server.c
index 2a43e606..cd3c0bb5 100644
--- a/cmd-start-server.c
+++ b/cmd-start-server.c
@@ -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>
@@ -18,9 +18,6 @@
#include <sys/types.h>
-#include <getopt.h>
-#include <string.h>
-
#include "tmux.h"
/*
diff --git a/cmd.c b/cmd.c
index 159d76c0..cfae414e 100644
--- a/cmd.c
+++ b/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>
@@ -30,6 +30,7 @@ const struct cmd_entry *cmd_table[] = {
&cmd_copy_mode_entry,
&cmd_detach_client_entry,
&cmd_has_session_entry,
+ &cmd_kill_server_entry,
&cmd_kill_session_entry,
&cmd_kill_window_entry,
&cmd_last_window_entry,
diff --git a/tmux.h b/tmux.h
index 646c6ff5..b56f44cf 100644
--- a/tmux.h
+++ b/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>
@@ -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_detach_client_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_window_entry;
extern const struct cmd_entry cmd_last_window_entry;