Merge pull request #23 from draios/config

Command-line options simplification
This commit is contained in:
Henri DF 2016-04-07 16:28:07 -07:00
commit 28b21eb5b3

View File

@ -44,12 +44,7 @@ static void usage()
"Usage: digwatch [options] rules_filename\n\n" "Usage: digwatch [options] rules_filename\n\n"
"Options:\n" "Options:\n"
" -h, --help Print this page\n" " -h, --help Print this page\n"
" -m <filename>, --main-lua <filename>\n"
" Name of lua compiler main file\n"
" (default: rules_loader.lua)\n"
" -N Don't convert port numbers to names.\n"
" -o Output type (options are 'stdout', 'syslog', default is 'stdout')\n" " -o Output type (options are 'stdout', 'syslog', default is 'stdout')\n"
" process or into a script.\n"
"\n" "\n"
); );
} }
@ -190,7 +185,7 @@ int digwatch_init(int argc, char **argv)
// Parse the args // Parse the args
// //
while((op = getopt_long(argc, argv, while((op = getopt_long(argc, argv,
"hNo:", "ho:",
long_options, &long_index)) != -1) long_options, &long_index)) != -1)
{ {
switch(op) switch(op)
@ -198,9 +193,6 @@ int digwatch_init(int argc, char **argv)
case 'h': case 'h':
usage(); usage();
goto exit; goto exit;
case 'N':
inspector->set_hostname_and_port_resolution_mode(false);
break;
case 'o': case 'o':
valid = std::find(valid_output_names.begin(), valid_output_names.end(), optarg) != valid_output_names.end(); valid = std::find(valid_output_names.begin(), valid_output_names.end(), optarg) != valid_output_names.end();
if (!valid) if (!valid)
@ -294,6 +286,8 @@ int digwatch_init(int argc, char **argv)
rules->load_rules(rules_file); rules->load_rules(rules_file);
inspector->set_filter(rules->get_filter()); inspector->set_filter(rules->get_filter());
inspector->set_hostname_and_port_resolution_mode(false);
try try
{ {
inspector->open(""); inspector->open("");