diff options
author | Andrey <kolovskiy83@yahoo.com> | 2020-11-19 20:36:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 20:36:39 +0300 |
commit | b3930a95891c4bdee37e0187cf7391184d0e1eab (patch) | |
tree | fb9b6cb5eb6437ca8de5c699c9d182e49b98e3b4 | |
parent | 1091421fe9235256e05b61884c081eb21076b093 (diff) |
Update dmarcts-report-parser.pl
Add command line option to set configuration file path
-rwxr-xr-x | dmarcts-report-parser.pl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/dmarcts-report-parser.pl b/dmarcts-report-parser.pl index 1af6445..3457334 100755 --- a/dmarcts-report-parser.pl +++ b/dmarcts-report-parser.pl @@ -128,6 +128,11 @@ $maxsize_xml = 50000; # to be in the current working directory. my $conf_file = 'dmarcts-report-parser.conf'; +# Get command line options. +my %options = (); +use constant { TS_IMAP => 0, TS_MESSAGE_FILE => 1, TS_XML_FILE => 2, TS_MBOX_FILE => 3, TS_ZIP_FILE => 4 }; +GetOptions( \%options, 'd', 'r', 'x', 'm', 'e', 'i', 'z', 'delete', 'info', 'c' => \$conf_file ); + # locate conf file or die if ( -e $conf_file ) { #$conf_file = "./$conf_file"; @@ -153,11 +158,6 @@ if (!defined $imapreadfolder ) { if (!defined $imapignoreerror ) { $imapignoreerror = 0; # maintain compatibility to old version } - -# Get command line options. -my %options = (); -use constant { TS_IMAP => 0, TS_MESSAGE_FILE => 1, TS_XML_FILE => 2, TS_MBOX_FILE => 3, TS_ZIP_FILE => 4 }; -GetOptions( \%options, 'd', 'r', 'x', 'm', 'e', 'i', 'z', 'delete', 'info' ); # Evaluate command line options my $source_options = 0; @@ -188,6 +188,10 @@ if (exists $options{z}) { $reports_source = TS_ZIP_FILE; } +if (exists $options{c}) { + $source_options++; +} + if ($source_options > 1) { show_usage(); die "Only one source option can be used (-i, -x, -m, -e or -z).\n"; |