summaryrefslogtreecommitdiff
path: root/src/plugins/exec/exec-config.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2014-03-12 09:57:39 +0100
committerSebastien Helleu <flashcode@flashtux.org>2014-03-12 09:57:39 +0100
commit07908366953fbf6bedba565182c84d5c43116977 (patch)
tree441c12cbb4cee1fc687868c8bff450a7718e75db /src/plugins/exec/exec-config.c
parent9543f9c03494a9ced1dd0d5529c43b931e7d9d0a (diff)
downloadweechat-07908366953fbf6bedba565182c84d5c43116977.zip
exec: add option exec.command.default_options
Diffstat (limited to 'src/plugins/exec/exec-config.c')
-rw-r--r--src/plugins/exec/exec-config.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/plugins/exec/exec-config.c b/src/plugins/exec/exec-config.c
index 4c5cb1c69..05ecc027e 100644
--- a/src/plugins/exec/exec-config.c
+++ b/src/plugins/exec/exec-config.c
@@ -32,6 +32,7 @@ struct t_config_file *exec_config_file = NULL;
/* exec config, command section */
+struct t_config_option *exec_config_command_default_options;
struct t_config_option *exec_config_command_purge_delay;
/* exec config, color section */
@@ -39,6 +40,30 @@ struct t_config_option *exec_config_command_purge_delay;
struct t_config_option *exec_config_color_flag_running;
struct t_config_option *exec_config_color_flag_finished;
+char **exec_config_cmd_options = NULL;
+int exec_config_cmd_num_options = 0;
+
+
+/*
+ * Callback for changes on option "exec.command.default_options".
+ */
+
+void
+exec_config_change_command_default_options (void *data,
+ struct t_config_option *option)
+{
+ /* make C compiler happy */
+ (void) data;
+ (void) option;
+
+ if (exec_config_cmd_options)
+ weechat_string_free_split (exec_config_cmd_options);
+
+ exec_config_cmd_options = weechat_string_split (
+ weechat_config_string (exec_config_command_default_options),
+ " ", 0, 0, &exec_config_cmd_num_options);
+}
+
/*
* Reloads exec configuration file.
*/
@@ -82,6 +107,14 @@ exec_config_init ()
return 0;
}
+ exec_config_command_default_options = weechat_config_new_option (
+ exec_config_file, ptr_section,
+ "default_options", "string",
+ N_("default options for command /exec (see /help exec); example: "
+ "\"-nosh -bg\" to run all commands in background (no output), and "
+ "without using the shell"),
+ NULL, 0, 0, "", NULL, 0, NULL, NULL,
+ &exec_config_change_command_default_options, NULL, NULL, NULL);
exec_config_command_purge_delay = weechat_config_new_option (
exec_config_file, ptr_section,
"purge_delay", "integer",
@@ -148,4 +181,11 @@ void
exec_config_free ()
{
weechat_config_free (exec_config_file);
+
+ if (exec_config_cmd_options)
+ {
+ weechat_string_free_split (exec_config_cmd_options);
+ exec_config_cmd_options = NULL;
+ exec_config_cmd_num_options = 0;
+ }
}