diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-05-17 19:26:32 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-05-17 19:26:32 +0400 |
commit | dbc2966a053cfb6b49821f2c5a7c5f486e1a5ece (patch) | |
tree | 0ed11976c9e1bdb1ca73785db64c76e50e7108f7 | |
parent | 6d44c6b5ce1e47674248dd074c77d847b3b8f8f2 (diff) | |
download | rspamd-dbc2966a053cfb6b49821f2c5a7c5f486e1a5ece.tar.gz rspamd-dbc2966a053cfb6b49821f2c5a7c5f486e1a5ece.zip |
* Parse options 'by hand' avoiding usage of Getopt::Std in rspamc.pl
-rwxr-xr-x | rspamc.pl.in | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/rspamc.pl.in b/rspamc.pl.in index ae8470a2e..077832438 100755 --- a/rspamc.pl.in +++ b/rspamc.pl.in @@ -8,7 +8,6 @@ # By default rspamc.pl would read ./rspamd.conf and default command is SYMBOLS use Socket qw(:DEFAULT :crlf); -use Getopt::Std; use Term::Cap; use Mail::Rspamd::Client; @@ -68,7 +67,7 @@ OR <search-key1> <search-key2> - Messages that match either search key (same for Version: @RSPAMD_VERSION@ EOD -exit; + exit; }; sub load_hosts_file { @@ -192,10 +191,51 @@ my %args; HELP_MESSAGE() unless scalar @ARGV >= 1; -getopt('pc:h:P:s:d:w:S:H:i:', \%args); +while (my $opt = shift @ARGV) { + if ($opt eq '-c') { + $args{c} = shift @ARGV; + } + elsif ($opt eq '-h') { + $args{h} = shift @ARGV; + } + elsif ($opt eq '-P') { + $args{P} = shift @ARGV; + } + elsif ($opt eq '-s') { + $args{s} = shift @ARGV; + } + elsif ($opt eq '-w') { + $args{w} = shift @ARGV; + } + elsif ($opt eq '-d') { + $args{d} = shift @ARGV; + } + elsif ($opt eq '-S') { + $args{S} = shift @ARGV; + } + elsif ($opt eq '-H') { + $args{H} = shift @ARGV; + } + elsif ($opt eq '-i') { + $args{i} = shift @ARGV; + } + elsif ($opt eq '-p') { + $args{p} = 1; + } + elsif ($opt eq '-?' || $opt eq '--help') { + HELP_MESSAGE(); + } + elsif ($opt eq '--') { + last; + } + else { + unshift @ARGV,$opt; + last; + } +} -my $cmd = shift; -my @path = shift; +my $cmd = shift @ARGV; +my @path = shift @ARGV; if (!defined ($cmd) || $cmd eq '') { $cmd = 'SYMBOLS'; |