// TODO: Move memory allocation and deallocation logic to the caller function for better resource management.
returnfilepath;
returnfilepath;
}
}
void
void
usage()
usage()
{
{
puts("Usage:\n\t-u url to get file from, other arguments can be omited.\n\t-f filepath to save file to. Can be omited, filename from url will be used.\n\t-uf file with urls to fetch files from. \n\t-ff filepath file, file with paths to save files from urls file. Can be omited, filename from url will be used.\n\tTo perform at least one of -u arguments should be given.\nSupported combinations:\n\t<url>\n\t-u <url>\n\t-u <url> -f <path to save fileto>\n\t-uf <path to file with urls>\n\t-uf <path to file with url> -ff<path to file with filenames>\n!Program rewrites files!");
puts("Usage:\n"
"\t-u <url> to get file from. Other arguments can be omitted.\n"
"\t-f <filepath> to save file to. Can be omitted; filename from URL will be used.\n"
"\t-uf <filepath> file with URLs to fetch files from.\n"
"\t-ff <filepath> file with paths to save files from URLs file. Can be omitted; filename from URL will be used.\n"
"At least one of the -u arguments should be given.\n"
"Supported combinations:\n"
"\t<url>\n"
"\t-u <url>\n"
"\t-u <url> -f <path to save file to>\n"
"\t-uf <path to file with URLs>\n"
"\t-uf <path to file with URL> -ff <path to file with filenames>\n"