summaryrefslogtreecommitdiffstats
path: root/src/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c42
1 files changed, 7 insertions, 35 deletions
diff --git a/src/options.c b/src/options.c
index 1e469a0..03f50ae 100644
--- a/src/options.c
+++ b/src/options.c
@@ -270,59 +270,31 @@ static void option_forward(fastd_context_t *ctx UNUSED, fastd_config_t *conf) {
#ifdef WITH_CMDLINE_COMMANDS
static void option_on_pre_up(fastd_context_t *ctx UNUSED, fastd_config_t *conf, const char *arg) {
- free(conf->on_pre_up);
- free(conf->on_pre_up_dir);
-
- conf->on_pre_up = strdup(arg);
- conf->on_pre_up_dir = get_current_dir_name();
+ fastd_shell_command_set(&conf->on_pre_up, arg);
}
static void option_on_up(fastd_context_t *ctx UNUSED, fastd_config_t *conf, const char *arg) {
- free(conf->on_up);
- free(conf->on_up_dir);
-
- conf->on_up = strdup(arg);
- conf->on_up_dir = get_current_dir_name();
+ fastd_shell_command_set(&conf->on_up, arg);
}
static void option_on_down(fastd_context_t *ctx UNUSED, fastd_config_t *conf, const char *arg) {
- free(conf->on_down);
- free(conf->on_down_dir);
-
- conf->on_down = strdup(arg);
- conf->on_down_dir = get_current_dir_name();
+ fastd_shell_command_set(&conf->on_down, arg);
}
static void option_on_post_down(fastd_context_t *ctx UNUSED, fastd_config_t *conf, const char *arg) {
- free(conf->on_post_down);
- free(conf->on_post_down_dir);
-
- conf->on_post_down = strdup(arg);
- conf->on_post_down_dir = get_current_dir_name();
+ fastd_shell_command_set(&conf->on_post_down, arg);
}
static void option_on_establish(fastd_context_t *ctx UNUSED, fastd_config_t *conf, const char *arg) {
- free(conf->on_establish);
- free(conf->on_establish_dir);
-
- conf->on_establish = strdup(arg);
- conf->on_establish_dir = get_current_dir_name();
+ fastd_shell_command_set(&conf->on_establish, arg);
}
static void option_on_disestablish(fastd_context_t *ctx UNUSED, fastd_config_t *conf, const char *arg) {
- free(conf->on_disestablish);
- free(conf->on_disestablish_dir);
-
- conf->on_disestablish = strdup(arg);
- conf->on_disestablish_dir = get_current_dir_name();
+ fastd_shell_command_set(&conf->on_disestablish, arg);
}
static void option_on_verify(fastd_context_t *ctx UNUSED, fastd_config_t *conf, const char *arg) {
- free(conf->on_verify);
- free(conf->on_verify_dir);
-
- conf->on_verify = strdup(arg);
- conf->on_verify_dir = get_current_dir_name();
+ fastd_shell_command_set(&conf->on_verify, arg);
}
#endif