diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-03 05:35:51 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-03 05:35:51 +0000 |
commit | f91e7bfd381826eb88edacc7b5766c262a71b033 (patch) | |
tree | 13fdab052b3993bb54adb54bc976afe27b666e94 /cmd-new-window.c | |
parent | eaee4dc800734a8ccebb78af02440a8e3d7769bd (diff) |
If no command is specified, assume new-session.
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r-- | cmd-new-window.c | 31 |
1 files changed, 19 insertions, 12 deletions
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; |