From 6f2fca53add357b98dc07ef846a65fd927e7d3dc Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 25 Jun 2001 12:56:06 +0000 Subject: [PATCH] =?UTF-8?q?'resume=20from'-fix.=20When=20using=20"-C=20-"?= =?UTF-8?q?=20and=20doing=20multiple=20file=20download,=20the=20first=20re?= =?UTF-8?q?sume=20was=20used=20on=20all=20files=20instead=20of=20being=20r?= =?UTF-8?q?eset=20between=20each=20file.=20As=20found=20by=20Bj=F6rn=20Ste?= =?UTF-8?q?nberg.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 4466751a2..125222db5 100644 --- a/src/main.c +++ b/src/main.c @@ -309,6 +309,7 @@ struct Configurable { char *useragent; char *cookie; bool use_resume; + bool resume_from_current; int resume_from; char *postfields; long postfieldsize; @@ -757,8 +758,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'C': /* This makes us continue an ftp transfer at given position */ - if(!strequal(nextarg, "-")) + if(!strequal(nextarg, "-")) { config->resume_from= atoi(nextarg); + config->resume_from_current = FALSE; + } + else { + config->resume_from_current = TRUE; + config->resume_from = 0; + } config->use_resume=TRUE; break; case 'd': @@ -1639,7 +1646,7 @@ operate(struct Configurable *config, int argc, char *argv[]) free(storefile); } - if((0 == config->resume_from) && config->use_resume) { + if(config->resume_from_current) { /* we're told to continue where we are now, then we get the size of the file as it is now and open it for append instead */ @@ -1707,8 +1714,7 @@ operate(struct Configurable *config, int argc, char *argv[]) } if((config->conf&CONF_UPLOAD) && - config->use_resume && - (0==config->resume_from)) { + config->resume_from_current) { config->resume_from = -1; /* -1 will then force get-it-yourself */ } if(config->headerfile) {