[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Bug-wget] QuickStart tutorial
From: |
Tony Lewis |
Subject: |
RE: [Bug-wget] QuickStart tutorial |
Date: |
Wed, 13 Oct 2010 22:07:07 -0700 |
Rahul Prasad wrote:
> I want to implement a batch download feature.
[snip]
> Plz tell me where show I add
> if(opt.batch) {
In main.c you will find the following line:
url = alloca_array (char *, nurl + 1);
You will need to change that to something like:
if (opt.batch)
{
process_batch_arg();
url = alloca_array (char *, nurl + n_batch_urls + 1);
}
else
url = alloca_array (char *, nurl + 1);
Immediately following that you will find:
for (i = 0; i < nurl; i++, optind++)
{
char *rewritten = rewrite_shorthand_url (argv[optind]);
if (rewritten)
url[i] = rewritten;
else
url[i] = xstrdup (argv[optind]);
}
You will need a similar loop that adds your batch URLs to the url array:
for (; opt.batch & i < nurl + n_batch_urls; i++)
{
url[i] = batchurl(i - nurl);
}
This code assumes that process_batch_arg will set n_batch_urls and store
away the information that batchurl will need to compute each URL. The
batchurl function will need to allocate a string and fill in each URL. You
might not structure your code that way, but it was the simplest way to
provide a quick pointer to where you need to tweak wget.
Having said all of that, you can more easily do the same thing with a shell
script that invokes wget repeatedly. The downside of the shell script
approach is that you won't be reusing the connection to the server.
Hope that helps regardless of how you proceed with building your solution.
Tony
- [Bug-wget] QuickStart tutorial, Rahul Prasad, 2010/10/13
- Re: [Bug-wget] QuickStart tutorial, Ángel González, 2010/10/13
- Re: [Bug-wget] QuickStart tutorial, Rahul Prasad, 2010/10/13
- RE: [Bug-wget] QuickStart tutorial, Tony Lewis, 2010/10/13
- Re: [Bug-wget] QuickStart tutorial, Rahul Prasad, 2010/10/13
- RE: [Bug-wget] QuickStart tutorial,
Tony Lewis <=
- Re: [Bug-wget] QuickStart tutorial, Ángel González, 2010/10/14
- Re: [Bug-wget] QuickStart tutorial, Rahul Prasad, 2010/10/14
- Re: [Bug-wget] QuickStart tutorial, Giuseppe Scrivano, 2010/10/15
- Re: [Bug-wget] QuickStart tutorial, Rahul Prasad, 2010/10/15
- Re: [Bug-wget] QuickStart tutorial, Giuseppe Scrivano, 2010/10/15
- Message not available
- Re: [Bug-wget] QuickStart tutorial, Giuseppe Scrivano, 2010/10/16
Re: [Bug-wget] QuickStart tutorial, Micah Cowan, 2010/10/13