summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--cmd-attach-session.c5
-rw-r--r--cmd-bind-key.c5
-rw-r--r--cmd-copy-mode.c5
-rw-r--r--cmd-detach-client.c5
-rw-r--r--cmd-has-session.c5
-rw-r--r--cmd-kill-server.c3
-rw-r--r--cmd-kill-session.c5
-rw-r--r--cmd-kill-window.c5
-rw-r--r--cmd-last-window.c5
-rw-r--r--cmd-link-window.c5
-rw-r--r--cmd-list-clients.c3
-rw-r--r--cmd-list-keys.c3
-rw-r--r--cmd-list-sessions.c4
-rw-r--r--cmd-list-windows.c5
-rw-r--r--cmd-new-session.c29
-rw-r--r--cmd-new-window.c31
-rw-r--r--cmd-next-window.c5
-rw-r--r--cmd-paste-buffer.c5
-rw-r--r--cmd-previous-window.c5
-rw-r--r--cmd-refresh-client.c5
-rw-r--r--cmd-rename-session.c5
-rw-r--r--cmd-rename-window.c5
-rw-r--r--cmd-scroll-mode.c5
-rw-r--r--cmd-select-window.c15
-rw-r--r--cmd-send-keys.c5
-rw-r--r--cmd-send-prefix.c5
-rw-r--r--cmd-set-option.c5
-rw-r--r--cmd-start-server.c3
-rw-r--r--cmd-swap-window.c5
-rw-r--r--cmd-switch-client.c5
-rw-r--r--cmd-unbind-key.c5
-rw-r--r--cmd-unlink-window.c6
-rw-r--r--key-bindings.c73
-rw-r--r--tmux.118
-rw-r--r--tmux.c12
-rw-r--r--tmux.h4
37 files changed, 189 insertions, 134 deletions
diff --git a/CHANGES b/CHANGES
index 817edebd..11a74aa2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
03 June 2008
+* If no command is specified, assume new-session. As a byproduct, clean up
+ command default values into seperate init functions.
* kill-server command.
02 June 2008
@@ -372,4 +374,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.99 2008-06-03 05:10:38 nicm Exp $
+$Id: CHANGES,v 1.100 2008-06-03 05:35:50 nicm Exp $
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index f11a93f1..04b6c349 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-attach-session.c,v 1.13 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: cmd-attach-session.c,v 1.14 2008-06-03 05:35:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -45,7 +45,8 @@ const struct cmd_entry cmd_attach_session_entry = {
cmd_attach_session_exec,
cmd_attach_session_send,
cmd_attach_session_recv,
- cmd_attach_session_free
+ cmd_attach_session_free,
+ NULL
};
int
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index 49535b97..f02c440b 100644
--- a/cmd-bind-key.c
+++ b/cmd-bind-key.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-bind-key.c,v 1.11 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-bind-key.c,v 1.12 2008-06-03 05:35:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -45,7 +45,8 @@ const struct cmd_entry cmd_bind_key_entry = {
cmd_bind_key_exec,
cmd_bind_key_send,
cmd_bind_key_recv,
- cmd_bind_key_free
+ cmd_bind_key_free,
+ NULL
};
int
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index 20ea5c15..88123043 100644
--- a/cmd-copy-mode.c
+++ b/cmd-copy-mode.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-copy-mode.c,v 1.7 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-copy-mode.c,v 1.8 2008-06-03 05:35:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_copy_mode_entry = {
cmd_copy_mode_exec,
cmd_windowonly_send,
cmd_windowonly_recv,
- cmd_windowonly_free
+ cmd_windowonly_free,
+ NULL
};
void
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index f93df01b..934f948d 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-detach-client.c,v 1.3 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-detach-client.c,v 1.4 2008-06-03 05:35:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_detach_client_entry = {
cmd_detach_client_exec,
cmd_clientonly_send,
cmd_clientonly_recv,
- cmd_clientonly_free
+ cmd_clientonly_free,
+ NULL
};
void
diff --git a/cmd-has-session.c b/cmd-has-session.c
index 4e34d11e..fade7de7 100644
--- a/cmd-has-session.c
+++ b/cmd-has-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-has-session.c,v 1.6 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-has-session.c,v 1.7 2008-06-03 05:35:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_has_session_entry = {
cmd_has_session_exec,
cmd_sessiononly_send,
cmd_sessiononly_recv,
- cmd_sessiononly_free
+ cmd_sessiononly_free,
+ NULL
};
void
diff --git a/cmd-kill-server.c b/cmd-kill-server.c
index 6d3d8f59..279929da 100644
--- a/cmd-kill-server.c
+++ b/cmd-kill-server.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-server.c,v 1.1 2008-06-03 05:10:38 nicm Exp $ */
+/* $Id: cmd-kill-server.c,v 1.2 2008-06-03 05:35:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -37,6 +37,7 @@ const struct cmd_entry cmd_kill_server_entry = {
cmd_kill_server_exec,
NULL,
NULL,
+ NULL,
NULL
};
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index 63d9ae1c..abca8ca1 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-session.c,v 1.7 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-kill-session.c,v 1.8 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -37,7 +37,8 @@ const struct cmd_entry cmd_kill_session_entry = {
cmd_kill_session_exec,
cmd_sessiononly_send,
cmd_sessiononly_recv,
- cmd_sessiononly_free
+ cmd_sessiononly_free,
+ NULL
};
void
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index b88f5adc..6fd3de3a 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-kill-window.c,v 1.10 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-kill-window.c,v 1.11 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_kill_window_entry = {
cmd_kill_window_exec,
cmd_windowonly_send,
cmd_windowonly_recv,
- cmd_windowonly_free
+ cmd_windowonly_free,
+ NULL
};
void
diff --git a/cmd-last-window.c b/cmd-last-window.c
index d6f4e687..8d55a23c 100644
--- a/cmd-last-window.c
+++ b/cmd-last-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-last-window.c,v 1.8 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-last-window.c,v 1.9 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_last_window_entry = {
cmd_last_window_exec,
cmd_sessiononly_send,
cmd_sessiononly_recv,
- cmd_sessiononly_free
+ cmd_sessiononly_free,
+ NULL
};
void
diff --git a/cmd-link-window.c b/cmd-link-window.c
index 328cb89f..b2ef4486 100644
--- a/cmd-link-window.c
+++ b/cmd-link-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-link-window.c,v 1.13 2008-06-02 21:36:51 nicm Exp $ */
+/* $Id: cmd-link-window.c,v 1.14 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -50,7 +50,8 @@ const struct cmd_entry cmd_link_window_entry = {
cmd_link_window_exec,
cmd_link_window_send,
cmd_link_window_recv,
- cmd_link_window_free
+ cmd_link_window_free,
+ NULL
};
int
diff --git a/cmd-list-clients.c b/cmd-list-clients.c
index e48ab4c1..2abf436e 100644
--- a/cmd-list-clients.c
+++ b/cmd-list-clients.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-clients.c,v 1.5 2008-06-03 05:10:38 nicm Exp $ */
+/* $Id: cmd-list-clients.c,v 1.6 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -37,6 +37,7 @@ const struct cmd_entry cmd_list_clients_entry = {
cmd_list_clients_exec,
NULL,
NULL,
+ NULL,
NULL
};
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index 2800512e..d31c4ef8 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-keys.c,v 1.7 2008-06-03 05:10:38 nicm Exp $ */
+/* $Id: cmd-list-keys.c,v 1.8 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,6 +34,7 @@ const struct cmd_entry cmd_list_keys_entry = {
cmd_list_keys_exec,
NULL,
NULL,
+ NULL,
NULL
};
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index d463aa92..fab1064b 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-sessions.c,v 1.11 2008-06-03 05:10:38 nicm Exp $ */
+/* $Id: cmd-list-sessions.c,v 1.12 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -18,6 +18,7 @@
#include <sys/types.h>
+#include <string.h>
#include <time.h>
#include "tmux.h"
@@ -35,6 +36,7 @@ const struct cmd_entry cmd_list_sessions_entry = {
cmd_list_sessions_exec,
NULL,
NULL,
+ NULL,
NULL
};
diff --git a/cmd-list-windows.c b/cmd-list-windows.c
index 7ac60e5e..990e32cc 100644
--- a/cmd-list-windows.c
+++ b/cmd-list-windows.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-windows.c,v 1.17 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-list-windows.c,v 1.18 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -36,7 +36,8 @@ const struct cmd_entry cmd_list_windows_entry = {
cmd_list_windows_exec,
cmd_sessiononly_send,
cmd_sessiononly_recv,
- cmd_sessiononly_free
+ cmd_sessiononly_free,
+ NULL
};
void
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 3815f468..66bf6a9f 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-session.c,v 1.22 2008-06-02 21:36:51 nicm Exp $ */
+/* $Id: cmd-new-session.c,v 1.23 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -31,6 +31,7 @@ void cmd_new_session_exec(void *, struct cmd_ctx *);
void cmd_new_session_send(void *, struct buffer *);
void cmd_new_session_recv(void **, struct buffer *);
void cmd_new_session_free(void *);
+void cmd_new_session_init(void **, int);
struct cmd_new_session_data {
char *name;
@@ -47,21 +48,31 @@ const struct cmd_entry cmd_new_session_entry = {
cmd_new_session_exec,
cmd_new_session_send,
cmd_new_session_recv,
- cmd_new_session_free
+ cmd_new_session_free,
+ cmd_new_session_init
};
-int
-cmd_new_session_parse(
- struct cmd *self, void **ptr, int argc, char **argv, char **cause)
+void
+cmd_new_session_init(void **ptr, unused int arg)
{
- struct cmd_new_session_data *data;
- int opt;
+ struct cmd_new_session_data *data;
*ptr = data = xmalloc(sizeof *data);
data->flag_detached = 0;
data->name = NULL;
data->winname = NULL;
data->cmd = NULL;
+}
+
+int
+cmd_new_session_parse(
+ struct cmd *self, void **ptr, int argc, char **argv, char **cause)
+{
+ struct cmd_new_session_data *data;
+ int opt;
+
+ self->entry->init(ptr, 0);
+ data = *ptr;
while ((opt = getopt(argc, argv, "ds:n:")) != EOF) {
switch (opt) {
@@ -99,15 +110,11 @@ void
cmd_new_session_exec(void *ptr, struct cmd_ctx *ctx)
{
struct cmd_new_session_data *data = ptr;
- struct cmd_new_session_data std = { NULL, NULL, NULL, 0 };
struct client *c = ctx->cmdclient;
struct session *s;
char *cmd, *cause;
u_int sx, sy;
- if (data == NULL)
- data = &std;
-
if (ctx->flags & CMD_KEY)
return;
diff --git a/cmd-new-window.c b/cmd-new-window.c
index b01a77a7..cb13fd66 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-new-window.c,v 1.17 2008-06-02 21:36:51 nicm Exp $ */
+/* $Id: cmd-new-window.c,v 1.18 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -32,6 +32,7 @@ void cmd_new_window_exec(void *, struct cmd_ctx *);
void cmd_new_window_send(void *, struct buffer *);
void cmd_new_window_recv(void **, struct buffer *);
void cmd_new_window_free(void *);
+void cmd_new_window_init(void **, int);
struct cmd_new_window_data {
char *sname;
@@ -49,16 +50,14 @@ const struct cmd_entry cmd_new_window_entry = {
cmd_new_window_exec,
cmd_new_window_send,
cmd_new_window_recv,
- cmd_new_window_free
+ cmd_new_window_free,
+ cmd_new_window_init
};
-int
-cmd_new_window_parse(
- struct cmd *self, void **ptr, int argc, char **argv, char **cause)
+void
+cmd_new_window_init(void **ptr, unused int arg)
{
- struct cmd_new_window_data *data;
- const char *errstr;
- int opt;
+ struct cmd_new_window_data *data;
*ptr = data = xmalloc(sizeof *data);
data->sname = NULL;
@@ -66,6 +65,18 @@ cmd_new_window_parse(
data->flag_detached = 0;
data->name = NULL;
data->cmd = NULL;
+}
+
+int
+cmd_new_window_parse(
+ struct cmd *self, void **ptr, int argc, char **argv, char **cause)
+{
+ struct cmd_new_window_data *data;
+ const char *errstr;
+ int opt;
+
+ self->entry->init(ptr, 0);
+ data = *ptr;
while ((opt = getopt(argc, argv, "di:n:s:")) != EOF) {
switch (opt) {
@@ -111,14 +122,10 @@ void
cmd_new_window_exec(void *ptr, struct cmd_ctx *ctx)
{
struct cmd_new_window_data *data = ptr;
- struct cmd_new_window_data std = { NULL, NULL, NULL, -1, 0 };
struct session *s;
struct winlink *wl;
char *cmd;
- if (data == NULL)
- data = &std;
-
cmd = data->cmd;
if (cmd == NULL)
cmd = default_command;
diff --git a/cmd-next-window.c b/cmd-next-window.c
index f2c1c214..5c331643 100644
--- a/cmd-next-window.c
+++ b/cmd-next-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-next-window.c,v 1.8 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-next-window.c,v 1.9 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_next_window_entry = {
cmd_next_window_exec,
cmd_sessiononly_send,
cmd_sessiononly_recv,
- cmd_sessiononly_free
+ cmd_sessiononly_free,
+ NULL
};
void
diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c
index d0be9c9b..96e0d4f0 100644
--- a/cmd-paste-buffer.c
+++ b/cmd-paste-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-paste-buffer.c,v 1.5 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-paste-buffer.c,v 1.6 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -36,7 +36,8 @@ const struct cmd_entry cmd_paste_buffer_entry = {
cmd_paste_buffer_exec,
cmd_windowonly_send,
cmd_windowonly_recv,
- cmd_windowonly_free
+ cmd_windowonly_free,
+ NULL
};
void
diff --git a/cmd-previous-window.c b/cmd-previous-window.c
index 42149f01..2758343f 100644
--- a/cmd-previous-window.c
+++ b/cmd-previous-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-previous-window.c,v 1.8 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-previous-window.c,v 1.9 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_previous_window_entry = {
cmd_previous_window_exec,
cmd_sessiononly_send,
cmd_sessiononly_recv,
- cmd_sessiononly_free
+ cmd_sessiononly_free,
+ NULL
};
void
diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c
index d1ecebb2..90df0ea5 100644
--- a/cmd-refresh-client.c
+++ b/cmd-refresh-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-refresh-client.c,v 1.3 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-refresh-client.c,v 1.4 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_refresh_client_entry = {
cmd_refresh_client_exec,
cmd_clientonly_send,
cmd_clientonly_recv,
- cmd_clientonly_free
+ cmd_clientonly_free,
+ NULL
};
void
diff --git a/cmd-rename-session.c b/cmd-rename-session.c
index 7007350b..ed64c98f 100644
--- a/cmd-rename-session.c
+++ b/cmd-rename-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-rename-session.c,v 1.6 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: cmd-rename-session.c,v 1.7 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -46,7 +46,8 @@ const struct cmd_entry cmd_rename_session_entry = {
cmd_rename_session_exec,
cmd_rename_session_send,
cmd_rename_session_recv,
- cmd_rename_session_free
+ cmd_rename_session_free,
+ NULL
};
int
diff --git a/cmd-rename-window.c b/cmd-rename-window.c
index 4ff5f873..ef6657b9 100644
--- a/cmd-rename-window.c
+++ b/cmd-rename-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-rename-window.c,v 1.16 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: cmd-rename-window.c,v 1.17 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -47,7 +47,8 @@ const struct cmd_entry cmd_rename_window_entry = {
cmd_rename_window_exec,
cmd_rename_window_send,
cmd_rename_window_recv,
- cmd_rename_window_free
+ cmd_rename_window_free,
+ NULL
};
int
diff --git a/cmd-scroll-mode.c b/cmd-scroll-mode.c
index 0688e0a9..dc75de66 100644
--- a/cmd-scroll-mode.c
+++ b/cmd-scroll-mode.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-scroll-mode.c,v 1.9 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-scroll-mode.c,v 1.10 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_scroll_mode_entry = {
cmd_scroll_mode_exec,
cmd_windowonly_send,
cmd_windowonly_recv,
- cmd_windowonly_free
+ cmd_windowonly_free,
+ NULL
};
void
diff --git a/cmd-select-window.c b/cmd-select-window.c
index db1894af..a5a4e341 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-select-window.c,v 1.13 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: cmd-select-window.c,v 1.14 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -32,6 +32,7 @@ void cmd_select_window_exec(void *, struct cmd_ctx *);
void cmd_select_window_send(void *, struct buffer *);
void cmd_select_window_recv(void **, struct buffer *);
void cmd_select_window_free(void *);
+void cmd_select_window_init(void **, int);
struct cmd_select_window_data {
char *sname;
@@ -46,22 +47,18 @@ const struct cmd_entry cmd_select_window_entry = {
cmd_select_window_exec,
cmd_select_window_send,
cmd_select_window_recv,
- cmd_select_window_free
+ cmd_select_window_free,
+ cmd_select_window_init
};
-/*
- * select-window requires different defaults depending on the key, so this
- * fills in the right data. XXX should this be extended to them all and get
- * rid of std/NULL rubbish?
- */
void
-cmd_select_window_default(void **ptr, int key)
+cmd_select_window_init(void **ptr, int arg)
{
struct cmd_select_window_data *data;
*ptr = data = xmalloc(sizeof *data);
data->sname = NULL;
- data->idx = key - '0';
+ data->idx = arg - '0';
}
int
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index ae5e4ef4..22f48323 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-send-keys.c,v 1.5 2008-06-03 05:10:38 nicm Exp $ */
+/* $Id: cmd-send-keys.c,v 1.6 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -46,7 +46,8 @@ const struct cmd_entry cmd_send_keys_entry = {
cmd_send_keys_exec,
cmd_send_keys_send,
cmd_send_keys_recv,
- cmd_send_keys_free
+ cmd_send_keys_free,
+ NULL
};
int
diff --git a/cmd-send-prefix.c b/cmd-send-prefix.c
index 7a29511a..4a67a434 100644
--- a/cmd-send-prefix.c
+++ b/cmd-send-prefix.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-send-prefix.c,v 1.9 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-send-prefix.c,v 1.10 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,7 +34,8 @@ const struct cmd_entry cmd_send_prefix_entry = {
cmd_send_prefix_exec,
cmd_clientonly_send,
cmd_clientonly_recv,
- cmd_clientonly_free
+ cmd_clientonly_free,
+ NULL
};
void
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 25d47d55..45b8d1bd 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-option.c,v 1.17 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: cmd-set-option.c,v 1.18 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -47,7 +47,8 @@ const struct cmd_entry cmd_set_option_entry = {
cmd_set_option_exec,
cmd_set_option_send,
cmd_set_option_recv,
- cmd_set_option_free
+ cmd_set_option_free,
+ NULL
};
int
diff --git a/cmd-start-server.c b/cmd-start-server.c
index cd3c0bb5..7bd89341 100644
--- a/cmd-start-server.c
+++ b/cmd-start-server.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-start-server.c,v 1.2 2008-06-03 05:10:38 nicm Exp $ */
+/* $Id: cmd-start-server.c,v 1.3 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,6 +34,7 @@ const struct cmd_entry cmd_start_server_entry = {
cmd_start_server_exec,
NULL,
NULL,
+ NULL,
NULL
};
diff --git a/cmd-swap-window.c b/cmd-swap-window.c
index 7f3c9918..d76344c4 100644
--- a/cmd-swap-window.c
+++ b/cmd-swap-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-swap-window.c,v 1.6 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: cmd-swap-window.c,v 1.7 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -49,7 +49,8 @@ const struct cmd_entry cmd_swap_window_entry = {
cmd_swap_window_exec,
cmd_swap_window_send,
cmd_swap_window_recv,
- cmd_swap_window_free
+ cmd_swap_window_free,
+ NULL
};
int
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index 24fbf2ab..d823d8b9 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-switch-client.c,v 1.4 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: cmd-switch-client.c,v 1.5 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -47,7 +47,8 @@ const struct cmd_entry cmd_switch_client_entry = {
cmd_switch_client_exec,
cmd_switch_client_send,
cmd_switch_client_recv,
- cmd_switch_client_free
+ cmd_switch_client_free,
+ NULL
};
int
diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c
index 9d7e6693..1e660a1d 100644
--- a/cmd-unbind-key.c
+++ b/cmd-unbind-key.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-unbind-key.c,v 1.10 2008-06-02 21:08:36 nicm Exp $ */
+/* $Id: cmd-unbind-key.c,v 1.11 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -44,7 +44,8 @@ const struct cmd_entry cmd_unbind_key_entry = {
cmd_unbind_key_exec,
cmd_unbind_key_send,
cmd_unbind_key_recv,
- cmd_unbind_key_free
+ cmd_unbind_key_free,
+ NULL
};
int
diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c
index d44f3d9f..d06203d3 100644
--- a/cmd-unlink-window.c
+++ b/cmd-unlink-window.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-unlink-window.c,v 1.8 2008-06-02 22:09:49 nicm Exp $ */
+/* $Id: cmd-unlink-window.c,v 1.9 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -34,8 +34,8 @@ const struct cmd_entry cmd_unlink_window_entry = {
cmd_unlink_window_exec,
cmd_windowonly_send,
cmd_windowonly_recv,
- cmd_windowonly_free
-
+ cmd_windowonly_free,
+ NULL
};
void
diff --git a/key-bindings.c b/key-bindings.c
index 8754a7a0..f3cb2852 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -1,4 +1,4 @@
-/* $Id: key-bindings.c,v 1.27 2008-06-02 18:23:37 nicm Exp $ */
+/* $Id: key-bindings.c,v 1.28 2008-06-03 05:35:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -77,41 +77,40 @@ key_bindings_init(void)
struct {
int key;
const struct cmd_entry *entry;
- void (*fn)(void **, int);
} table[] = {
- { 'D', &cmd_detach_client_entry, NULL },
- { 'd', &cmd_detach_client_entry, NULL },
- { 'S', &cmd_list_sessions_entry, NULL },
- { 's', &cmd_list_sessions_entry, NULL },
- { 'W', &cmd_list_windows_entry, NULL },
- { 'w', &cmd_list_windows_entry, NULL },
- { '?', &cmd_list_keys_entry, NULL },
- { '/', &cmd_list_keys_entry, NULL },
- { 'C', &cmd_new_window_entry, NULL },
- { 'c', &cmd_new_window_entry, NULL },
- { 'N', &cmd_next_window_entry, NULL },
- { 'n', &cmd_next_window_entry, NULL },
- { 'P', &cmd_previous_window_entry, NULL },
- { 'p', &cmd_previous_window_entry, NULL },
- { 'L', &cmd_last_window_entry, NULL },
- { 'l', &cmd_last_window_entry, NULL },
- { '0', &cmd_select_window_entry, cmd_select_window_default },
- { '1', &cmd_select_window_entry, cmd_select_window_default },
- { '2', &cmd_select_window_entry, cmd_select_window_default },
- { '3', &cmd_select_window_entry, cmd_select_window_default },
- { '4', &cmd_select_window_entry, cmd_select_window_default },
- { '5', &cmd_select_window_entry, cmd_select_window_default },
- { '6', &cmd_select_window_entry, cmd_select_window_default },
- { '7', &cmd_select_window_entry, cmd_select_window_default },
- { '8', &cmd_select_window_entry, cmd_select_window_default },
- { '9', &cmd_select_window_entry, cmd_select_window_default },
- { 'R', &cmd_refresh_client_entry, NULL },
- { 'r', &cmd_refresh_client_entry, NULL },
- { '&', &cmd_kill_window_entry, NULL },
- { '=', &cmd_scroll_mode_entry, NULL },
- { '[', &cmd_copy_mode_entry, NULL },
- { ']', &cmd_paste_buffer_entry,