1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 12:26:40 +02:00

exec: execute commands from input of exec buffers

This commit is contained in:
Sebastien Helleu
2014-03-13 07:38:16 +01:00
parent ed6ea18c30
commit 571a7a5dbe
3 changed files with 208 additions and 166 deletions
+15
View File
@@ -26,6 +26,7 @@
#include "../weechat-plugin.h"
#include "exec.h"
#include "exec-buffer.h"
#include "exec-command.h"
#include "exec-config.h"
@@ -37,6 +38,9 @@ int
exec_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
const char *input_data)
{
char **argv, **argv_eol;
int argc;
/* make C compiler happy */
(void) data;
@@ -47,6 +51,17 @@ exec_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
return WEECHAT_RC_OK;
}
argv = weechat_string_split (input_data, " ", 0, 0, &argc);
argv_eol = weechat_string_split (input_data, " ", 1, 0, NULL);
if (argv && argv_eol)
exec_command_run (buffer, argc, argv, argv_eol, 0);
if (argv)
weechat_string_free_split (argv);
if (argv_eol)
weechat_string_free_split (argv_eol);
return WEECHAT_RC_OK;
}