+2014-02-10 Yousong Zhou <yszhou4tech@gmail.com>
+
+ * wget.texi: Add documentation for --start-pos.
+
2013-12-29 Giuseppe Scrivano <gscrivan@redhat.com>
* wget.texi: Update to GFDL 1.3.
Note that @samp{-c} only works with @sc{ftp} servers and with @sc{http}
servers that support the @code{Range} header.
+@cindex offset
+@cindex continue retrieval
+@cindex incomplete downloads
+@cindex resume download
+@cindex start position
+@item --start-pos=@var{OFFSET}
+Start downloading at zero-based position @var{OFFSET}. Offset may be expressed
+in bytes, kilobytes with the `k' suffix, or megabytes with the `m' suffix, etc.
+
+@samp{--start-pos} has higher precedence over @samp{--continue}. When
+@samp{--start-pos} and @samp{--continue} are both specified, wget will emit a
+warning then proceed as if @samp{--continue} was absent.
+
+Server support for continued download is required, otherwise @samp{--start-pos}
+cannot help. See @samp{-c} for details.
+
@cindex progress indicator
@cindex dot style
@item --progress=@var{type}
+2014-03-19 Yousong Zhou <yszhou4tech@gmail.com>
+
+ * init.c, main.c, options.h: Add option --start-pos for specifying
+ start position of a download.
+ * http.c: Utilize opt.start_pos for HTTP download.
+ * ftp.c: Utilize opt.start_pos for FTP retrieval.
+
2014-03-04 Giuseppe Scrivano <gscrivan@redhat.com>
* http.c (modify_param_value, extract_param): Aesthetic change.
/* Decide whether or not to restart. */
if (con->cmd & DO_LIST)
restval = 0;
+ else if (opt.start_pos >= 0)
+ restval = opt.start_pos;
else if (opt.always_rest
&& stat (locf, &st) == 0
&& S_ISREG (st.st_mode))
/* Decide whether or not to restart. */
if (force_full_retrieve)
hstat.restval = hstat.len;
+ else if (opt.start_pos >= 0)
+ hstat.restval = opt.start_pos;
else if (opt.always_rest
&& got_name
&& stat (hstat.local_file, &st) == 0
{ "showalldnsentries", &opt.show_all_dns_entries, cmd_boolean },
{ "spanhosts", &opt.spanhost, cmd_boolean },
{ "spider", &opt.spider, cmd_boolean },
+ { "startpos", &opt.start_pos, cmd_bytes },
{ "strictcomments", &opt.strict_comments, cmd_boolean },
{ "timeout", NULL, cmd_spec_timeout },
{ "timestamping", &opt.timestamping, cmd_boolean },
opt.warc_cdx_dedup_filename = NULL;
opt.warc_tempdir = NULL;
opt.warc_keep_log = true;
+
+ /* Use a negative value to mark the absence of --start-pos option */
+ opt.start_pos = -1;
}
\f
/* Return the user's home directory (strdup-ed), or NULL if none is
{ "server-response", 'S', OPT_BOOLEAN, "serverresponse", -1 },
{ "span-hosts", 'H', OPT_BOOLEAN, "spanhosts", -1 },
{ "spider", 0, OPT_BOOLEAN, "spider", -1 },
+ { "start-pos", 0, OPT_VALUE, "startpos", -1 },
{ "strict-comments", 0, OPT_BOOLEAN, "strictcomments", -1 },
{ "timeout", 'T', OPT_VALUE, "timeout", -1 },
{ "timestamping", 'N', OPT_BOOLEAN, "timestamping", -1 },
existing files (overwriting them).\n"),
N_("\
-c, --continue resume getting a partially-downloaded file.\n"),
+ N_("\
+ --start-pos=OFFSET start downloading from zero-based position OFFSET.\n"),
N_("\
--progress=TYPE select progress gauge type.\n"),
N_("\
_("WARC output does not work with --spider.\n"));
exit (1);
}
- if (opt.always_rest)
+ if (opt.always_rest || opt.start_pos >= 0)
{
fprintf (stderr,
- _("WARC output does not work with --continue, "
- "--continue will be disabled.\n"));
+ _("WARC output does not work with --continue or"
+ " --start-pos, they will be disabled.\n"));
opt.always_rest = false;
+ opt.start_pos = -1;
}
if (opt.warc_cdx_dedup_filename != 0 && !opt.warc_digests_enabled)
{
exit (1);
}
+ if (opt.start_pos >= 0 && opt.always_rest)
+ {
+ fprintf (stderr,
+ _("Specifying both --start-pos and --continue is not "
+ "recommended; --continue will be disabled.\n"));
+ opt.always_rest = false;
+ }
+
if (!nurl && !opt.input_filename)
{
/* No URL specified. */
bool ask_passwd; /* Ask for password? */
bool always_rest; /* Always use REST. */
+ wgint start_pos; /* Start position of a download. */
char *ftp_user; /* FTP username */
char *ftp_passwd; /* FTP password */
bool netrc; /* Whether to read .netrc. */