diff options
Diffstat (limited to 'urpmq')
-rwxr-xr-x | urpmq | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -101,17 +101,19 @@ for (@ARGV) { urpm::sync_webfetch($options, @_) }; next }; /^--curl$/ and do { $urpm->{sync} = \&urpm::sync_webfetch; next }; /^--proxy$/ and do { - ($_ = shift @_) =~ m,^http://([^:]+)(:([\d]+)|[^:])$, or usage; - $_ .= ":1080" if /[^\d]/; - $urpm->{proxy}->{http_proxy} = $_; - next; - }; + my ($proxy, $port) = ($_ = shift @ARGV) =~ m,^(?:http://)?([^:]+(:\d+)?)/*$, or + die _("bad proxy declaration on command line\n"); + $proxy .= ":1080" unless $port; + $urpm->{proxy}{http_proxy} = "http://$proxy"; + next; + }; /^--proxy-user$/ and do { - ($_ = shift @_) =~ /(.+):(.+)/, or usage; - $urpm->{proxy}->{user} = $1; - $urpm->{proxy}->{pwd} = $2; - next; - }; + ($_ = shift @ARGV) =~ /(.+):(.+)/, or + die _("bad proxy declaration on command line\n"); + $urpm->{proxy}{user} = $1; + $urpm->{proxy}{pwd} = $2; + next; + }; /^-(.*)$/ and do { foreach (split //, $1) { /[\?h]/ and do { usage; next }; /d/ and do { $query->{deps} = 1; next }; |