| * Copyright (c) 2018 Virtuozzo International GmbH |
| * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| int download_url(const char *name, const char *url) |
| CURL *curl = curl_easy_init(); |
| file = fopen(name, "wb"); |
| curl_easy_setopt(curl, CURLOPT_URL, url); |
| curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL); |
| curl_easy_setopt(curl, CURLOPT_WRITEDATA, file); |
| curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); |
| curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); |
| if (curl_easy_perform(curl) != CURLE_OK) { |