From: Vsevolod Stakhov Date: Mon, 17 May 2010 15:26:32 +0000 (+0400) Subject: * Parse options 'by hand' avoiding usage of Getopt::Std in rspamc.pl X-Git-Tag: 0.3.0~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dbc2966a053cfb6b49821f2c5a7c5f486e1a5ece;p=rspamd.git * Parse options 'by hand' avoiding usage of Getopt::Std in rspamc.pl --- 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 - 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';