aboutsummaryrefslogtreecommitdiff
path: root/src/tool_operate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool_operate.c')
-rw-r--r--src/tool_operate.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 689ffb2d7..ffb37ff1b 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -388,6 +388,11 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
}
}
+#ifdef HAVE_LIBMETALINK
+ config->metalinkfile_last = config->metalinkfile_list;
+ config->metalink_last = config->metalink_list;
+#endif /* HAVE_LIBMETALINK */
+
/*
** Nested loops start here.
*/
@@ -439,6 +444,24 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
}
}
+ /* process metalink download in the separate function */
+ if(urlnode->flags & GETOUT_METALINK) {
+ struct OutStruct outs;
+ long retry_sleep_default;
+ struct getout *nextnode;
+
+ retry_sleep_default = (config->retry_delay) ?
+ config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */
+ /* default output stream is stdout */
+ memset(&outs, 0, sizeof(struct OutStruct));
+ outs.stream = stdout;
+ outs.config = config;
+ operatemetalink(curl, urlnode, retry_sleep_default, outs, heads,
+ outfiles, config);
+ /* move on to the next URL */
+ continue;
+ }
+
/* Here's the loop for uploading multiple files within the same
single globbed string. If no upload, we enter the loop once anyway. */
for(up = 0 ; up < infilenum; up++) {
@@ -1608,6 +1631,11 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
if(config->errors_fopened && config->errors)
fclose(config->errors);
+#ifdef HAVE_LIBMETALINK
+ /* Release metalink related resources here */
+ clean_metalink(config);
+#endif /* HAVE_LIBMETALINK */
+
main_free(); /* cleanup */
return res;