diff options
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -174,6 +174,7 @@ int options_parse(options_t* opt, int argc, char* argv[]) PARSE_STRING_LIST("-L","--log", opt->log_targets_) PARSE_STRING_PARAM("-s","--command-sock", opt->command_sock_) PARSE_STRING_PARAM("-x","--script", opt->script_) + PARSE_INT_PARAM("-m","--max-children", opt->max_children_) else return i; } @@ -186,6 +187,14 @@ int options_parse_post(options_t* opt) if(!opt) return -1; + if(opt->max_children_ < 0) { + log_printf(ERROR, "-m|--max-children invalid value %d", opt->max_children_); + return 1; + } + + if(opt->max_children_ == 0) + log_printf(WARNING, "disabling child limit, this may be harmful to your system"); + return 0; } @@ -205,6 +214,7 @@ void options_default(options_t* opt) opt->command_sock_ = strdup("/var/run/rhdropbox/cmd.sock"); opt->script_ = strdup("newfile.sh"); + opt->max_children_ = 8; } void options_clear(options_t* opt) @@ -244,6 +254,7 @@ void options_print_usage() printf(" add a log target, can be invoked several times\n"); printf(" [-s|--command-sock] <unix sock> the command socket e.g. /var/run/rhdropbox/cmd.sock\n"); printf(" [-x|--script] <script> the command socket e.g. newfile.sh\n"); + printf(" [-m|--max-children] <#of children> limit of children to be started e.g. 8\n"); } void options_print(options_t* opt) @@ -262,4 +273,5 @@ void options_print(options_t* opt) printf("command_sock: '%s'\n", opt->command_sock_); printf("script: '%s'\n", opt->script_); + printf("max_children: %d\n", opt->max_children_); } |