---
cmd.c | 14 ++++++++++++--
tmux.c | 2 +-
tmux.h | 4 +++-
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/cmd.c b/cmd.c
index c8e9702..083c5eb 100644
--- a/cmd.c
+++ b/cmd.c
@@ -27,7 +27,8 @@
#include "tmux.h"
-const struct cmd_entry *cmd_table[] = {
+struct cmd_entry ** cmd_table;
+static const struct cmd_entry *cmd_table_builtin[] = {
&cmd_attach_session_entry,
&cmd_bind_key_entry,
&cmd_break_pane_entry,
@@ -134,6 +135,15 @@ struct winlink *cmd_find_window_offset(const char *,
struct session *, int *);
int cmd_find_index_offset(const char *, struct session *, int *);
struct window_pane *cmd_find_pane_offset(const char *, struct winlink *);
+void
+cmd_table_init(void)
+{
+ int nitems = nitems (cmd_table_builtin);
+
+ cmd_table = calloc (nitems, sizeof (struct cmd_entry *));
+ memcpy (cmd_table, cmd_table_builtin, nitems*sizeof (struct cmd_entry *));
+}
+
int
cmd_pack_argv(int argc, char **argv, char *buf, size_t len)
{
@@ -209,7 +219,7 @@ cmd_free_argv(int argc, char **argv)
struct cmd *
cmd_parse(int argc, char **argv, const char *file, u_int line, char **cause)
{
- const struct cmd_entry **entryp, *entry;
+ struct cmd_entry **entryp, *entry;
struct cmd *cmd;
struct args *args;
char s[BUFSIZ];
diff --git a/tmux.c b/tmux.c
index 8ea91eb..58d585b 100644
--- a/tmux.c
+++ b/tmux.c
@@ -400,7 +400,7 @@ main(int argc, char **argv)
/* Set process title. */
setproctitle("%s (%s)", __progname, socket_path);
#endif
-
+ cmd_table_init();
/* Pass control to the client. */
ev_base = osdep_event_init();
exit(client_main(argc, argv, flags));
diff --git a/tmux.h b/tmux.h
index 834ac6e..42847c0 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1732,6 +1732,7 @@ long long args_strtonum(
struct args *, u_char, long long, long long, char **);
/* cmd.c */
+void cmd_table_init (void);
int cmd_pack_argv(int, char **, char *, size_t);
int cmd_unpack_argv(char *, size_t, int, char ***);
char **cmd_copy_argv(int, char *const *);
@@ -1750,7 +1751,8 @@ struct winlink *cmd_find_pane(struct cmd_q *, const
char *, struct session **,
struct window_pane **);
char *cmd_template_replace(const char *, const char *, int);
const char *cmd_get_default_path(struct cmd_q *, const char *);
-extern const struct cmd_entry *cmd_table[];
+
+extern struct cmd_entry **cmd_table;
extern const struct cmd_entry cmd_attach_session_entry;
extern const struct cmd_entry cmd_bind_key_entry;
extern const struct cmd_entry cmd_break_pane_entry;
--
1.7.10.4
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users