X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fmain.c;h=8414f5e54d0e85caaa203405b51fa48b9be0cb37;hp=2b42d2d7235eda6c1d7295b974423a6bb13c1084;hb=42c78fdd71c311cf96210b709ec0a18ef45ef87f;hpb=54fd8de415cd31e015cf3a391818d3c83fce21c6 diff --git a/src/main.c b/src/main.c index 2b42d2d7..8414f5e5 100644 --- a/src/main.c +++ b/src/main.c @@ -217,6 +217,7 @@ static struct cmdline_option option_data[] = { "http-passwd", 0, OPT_VALUE, "httppassword", -1 }, /* deprecated */ { "http-password", 0, OPT_VALUE, "httppassword", -1 }, { "http-user", 0, OPT_VALUE, "httpuser", -1 }, + { IF_SSL ("https-only"), 0, OPT_BOOLEAN, "httpsonly", -1 }, { "ignore-case", 0, OPT_BOOLEAN, "ignorecase", -1 }, { "ignore-length", 0, OPT_BOOLEAN, "ignorelength", -1 }, { "ignore-tags", 0, OPT_VALUE, "ignoretags", -1 }, @@ -635,6 +636,8 @@ HTTPS (SSL/TLS) options:\n"), N_("\ --secure-protocol=PR choose secure protocol, one of auto, SSLv2,\n\ SSLv3, and TLSv1.\n"), + N_("\ + --https-only only follow secure HTTPS links\n"), N_("\ --no-check-certificate don't validate the server's certificate.\n"), N_("\ @@ -714,6 +717,9 @@ Recursive download:\n"), N_("\ -k, --convert-links make links in downloaded HTML or CSS point to\n\ local files.\n"), + N_("\ + --backups=N before writing file X, rotate up to N backup files.\n"), + #ifdef __VMS N_("\ -K, --backup-converted before converting file X, back up as X_orig.\n"), @@ -837,15 +843,16 @@ format_and_print_line (const char *prefix, const char *line, assert (prefix != NULL); assert (line != NULL); + assert (line_length > TABULATION); line_dup = xstrdup (line); - if (line_length <= 0) - line_length = MAX_CHARS_PER_LINE - TABULATION; - if (printf ("%s", prefix) < 0) return -1; - remaining_chars = line_length; + + /* Wrap to new line after prefix. */ + remaining_chars = 0; + /* We break on spaces. */ token = strtok (line_dup, " "); while (token != NULL) @@ -853,7 +860,7 @@ format_and_print_line (const char *prefix, const char *line, /* If however a token is much larger than the maximum line length, all bets are off and we simply print the token on the next line. */ - if (remaining_chars <= strlen (token)) + if (remaining_chars <= (int) strlen (token)) { if (printf ("\n%*c", TABULATION, ' ') < 0) return -1; @@ -927,7 +934,7 @@ print_version (void) #ifdef ENABLE_NLS if (format_and_print_line (locale_title, - LOCALEDIR, + LOCALEDIR, MAX_CHARS_PER_LINE) < 0) exit (3); #endif /* def ENABLE_NLS */ @@ -1397,6 +1404,13 @@ for details.\n\n")); } } + /* Set various options as required for opt.method. */ + + /* When user specifies HEAD as the method, we do not wish to download any + files. Hence, set wget to run in spider mode. */ + if (opt.method && strcasecmp (opt.method, "HEAD") == 0) + setoptval ("spider", "1", "spider"); + /* Convert post_data to body-data and post_file_name to body-file options. This is required so as to remove redundant code later on in gethttp(). The --post-data and --post-file options may also be removed in