diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-05 20:38:30 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-04-05 20:38:30 +0200 |
commit | a6a5b5e00e98aa27644a1afa4a461819221b758d (patch) | |
tree | cf1fc8ba118e3114172f488f3b3fddde73399240 /src/config.c | |
parent | 9720307ab4d78bec3fc7bc7e44cf8ba217584a17 (diff) | |
download | fastd-a6a5b5e00e98aa27644a1afa4a461819221b758d.tar fastd-a6a5b5e00e98aa27644a1afa4a461819221b758d.zip |
Add on-establish and on-disestablish commandsv0.2
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index 0d9a62b..f18d975 100644 --- a/src/config.c +++ b/src/config.c @@ -79,6 +79,13 @@ static void default_config(fastd_config *conf) { conf->on_down = NULL; conf->on_down_dir = NULL; + + conf->on_establish = NULL; + conf->on_establish_dir = NULL; + + conf->on_disestablish = NULL; + conf->on_disestablish_dir = NULL; + } static bool config_match(const char *opt, ...) { @@ -506,6 +513,26 @@ void fastd_configure(fastd_context *ctx, fastd_config *conf, int argc, char *con continue; } + IF_OPTION_ARG("--on-establish") { + free(conf->on_establish); + free(conf->on_establish_dir); + + conf->on_establish = strdup(arg); + conf->on_establish_dir = get_current_dir_name(); + + continue; + } + + IF_OPTION_ARG("--on-disestablish") { + free(conf->on_disestablish); + free(conf->on_disestablish_dir); + + conf->on_disestablish = strdup(arg); + conf->on_disestablish_dir = get_current_dir_name(); + + continue; + } + IF_OPTION("--generate-key") { keygen = true; continue; @@ -640,5 +667,9 @@ void fastd_config_release(fastd_context *ctx, fastd_config *conf) { free(conf->on_up_dir); free(conf->on_down); free(conf->on_down_dir); + free(conf->on_establish); + free(conf->on_establish_dir); + free(conf->on_disestablish); + free(conf->on_disestablish_dir); free(conf->protocol_config); } |