--- net.cc.bak 2008-01-21 08:47:51.124059200 +0100 +++ net.cc 2008-01-21 02:03:58.139059200 +0100 @@ -28,16 +28,20 @@ #include "win32.h" #include #include +#include #include "dialog.h" #include "resource.h" #include "netio.h" #include "msg.h" +#include "getopt++/StringOption.h" #include "propsheet.h" #include "threebar.h" #include "ConnectionSetting.h" extern ThreeBarProgressPage Progress; +static StringOption ProxyOption ("", 'p', "proxy", "HTTP/FTP proxy (host:port)", false); + static int rb[] = { IDC_NET_IE5, IDC_NET_DIRECT, IDC_NET_PROXY, 0 }; static ConnectionSetting theSetting; static bool doing_loading = false; @@ -110,9 +114,28 @@ NetPage::OnInit () { HWND h = GetHWND (); + std::string proxyString(((std::string)ProxyOption).c_str()); if (!NetIO::net_method) NetIO::net_method = IDC_NET_DIRECT; + + if (proxyString.size()) + { + NetIO::net_method = IDC_NET_PROXY; + + unsigned int pos = proxyString.find_last_of(':'); + if (pos >= 0) + { + NetIO::net_proxy_host = strdup(proxyString.substr(0, pos).c_str()); + if (pos < proxyString.size()-1) + { + std::string portString = proxyString.substr(pos+1, proxyString.size()-(pos+1)); + std::istringstream iss(portString, std::istringstream::in); + iss >> NetIO::net_proxy_port; + } + } + } + load_dialog (h); CheckIfEnableNext();