" 31 46 1365 /etc/passwd\n"
#define wget_trivial_usage \
- "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url"
+ "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-Y|--proxy on/off] [-P DIR] url"
#define wget_full_usage \
"wget retrieves files via HTTP or FTP\n\n" \
"Options:\n" \
"\t-c\tcontinue retrieval of aborted transfers\n" \
"\t-q\tquiet mode - do not print\n" \
"\t-P\tSet directory prefix to DIR\n" \
- "\t-O\tsave to filename ('-' for stdout)"
+ "\t-O\tsave to filename ('-' for stdout)\n" \
+ "\t-Y\tuse proxy ('on' or 'off')"
#define which_trivial_usage \
"[COMMAND ...]"
{
int n, try=5, status;
int port;
- char *proxy;
+ char *proxy = 0;
char *dir_prefix=NULL;
char *s, buf[512];
struct stat sbuf;
int got_clen = 0; /* got content-length: from server */
FILE *output; /* socket to web server */
int quiet_flag = FALSE; /* Be verry, verry quiet... */
+ int noproxy = 0; /* Use proxies if env vars are set */
#define LONG_HEADER 1
struct option long_options[] = {
{ "quiet", 0, NULL, 'q' },
{ "output-document", 1, NULL, 'O' },
{ "header", 1, &which_long_opt, LONG_HEADER },
+ { "proxy", 1, NULL, 'Y' },
{ 0, 0, 0, 0 }
};
/*
* Crack command line.
*/
- while ((n = getopt_long(argc, argv, "cqO:P:", long_options, &option_index)) != EOF) {
+ while ((n = getopt_long(argc, argv, "cqO:P:Y:", long_options, &option_index)) != EOF) {
switch (n) {
case 'c':
++do_continue;
*/
fname_out = optarg;
break;
+ case 'Y':
+ if (strcmp(optarg, "off") == 0)
+ noproxy=1;
+ break;
case 0:
switch (which_long_opt) {
case LONG_HEADER: {
/*
* Use the proxy if necessary.
*/
- proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy");
- if (proxy)
- parse_url(xstrdup(proxy), &server);
+ if (!noproxy) {
+ proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy");
+ if (proxy)
+ parse_url(xstrdup(proxy), &server);
+ }
/* Guess an output filename */
if (!fname_out) {
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.48 2002/04/17 15:33:24 kraai Exp $
+ * $Id: wget.c,v 1.49 2002/05/14 23:36:45 sandman Exp $
*/