#include <errno.h>
#include <getopt.h>
#include <stdio.h>
#include <string.h>
static ssize_t
{
ssize_t ret;
if (!ret || ferror(
fd)) {
fprintf(stderr, "ERROR: Failed to write\n");
return -1;
}
return ret * buffer->
used;
}
static void
{
fprintf(stderr,
"ERROR: Finished with error, response code: %d\n", response->
response_code);
return;
}
printf("Download concluded successfully\n");
}
};
static void
{
char *output = NULL, *url = NULL;
static const struct option opts[] = {
{ "output", required_argument, NULL, 'o' },
{ "help", no_argument, NULL, 'h' },
{ 0, 0, 0, 0 }
};
while ((c = getopt_long(argc, argv, "o:h", opts, &opt_idx)) != -1) {
switch (c) {
case 'o':
output = optarg;
break;
case 'h':
default:
fprintf(stderr,
"Usage:\n\t%s [-o <output_file>] <url>\n", argv[0]);
return;
}
}
url = argv[optind];
if (!url) {
fprintf(stderr, "ERROR: missing url.\n");
return;
}
if (output) {
fprintf(stderr, "ERROR: Failed to create the file: %s\n", output);
return;
}
} else {
}
url, NULL, &iface, NULL);
fprintf(stderr, "ERROR: Failed to create the request\n");
return;
}
}
static void
{
}