Clean up usage message and choice of flags

This commit is contained in:
Henri DF 2016-04-12 20:16:34 -07:00
parent 86e2e17c33
commit a529b11e0d

View File

@ -46,9 +46,10 @@ 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"
" -c Configuration file (default " DIGWATCH_SOURCE_CONF_FILE ", " DIGWATCH_INSTALL_CONF_FILE ")\n"
" -o Output type (options are 'stdout', 'syslog', default is 'stdout')\n" " -o Output type (options are 'stdout', 'syslog', default is 'stdout')\n"
" -r <readfile>, --read=<readfile>\n" " -e <events_file> Read the events from <events_file> (in .scap format) instead of tapping into live.\n"
" Read the events from <readfile>.\n" " -r <rules_file> Rules configuration file (defaults to value set in configuration file, or /etc/digwatch_rules.conf).\n"
"\n" "\n"
); );
} }
@ -212,7 +213,6 @@ int digwatch_init(int argc, char **argv)
static struct option long_options[] = static struct option long_options[] =
{ {
{"help", no_argument, 0, 'h' }, {"help", no_argument, 0, 'h' },
{"readfile", required_argument, 0, 'r' },
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -225,7 +225,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,
"c:ho:r:u:", "c:ho:e:r:",
long_options, &long_index)) != -1) long_options, &long_index)) != -1)
{ {
switch(op) switch(op)
@ -244,10 +244,10 @@ int digwatch_init(int argc, char **argv)
} }
output_name = optarg; output_name = optarg;
break; break;
case 'r': case 'e':
scap_filename = optarg; scap_filename = optarg;
break; break;
case 'u': case 'r':
rules_filename = optarg; rules_filename = optarg;
break; break;
case '?': case '?':