curl-library
Re: ftp enhancement - FTP wildcard download
Date: Wed, 27 Jan 2010 17:10:15 +0100
Hi Pavel,
On Wednesday 27 of January 2010 16:51:31 Pavel Raiskup wrote:
> First of all I'd like to ask you if there is a big problem with source
> size (binary size/number of source lines) or code complexity. I know, that
I don't think the size of code is somehow important in this case. However,
there might be problem with the time schedule in the first place. It would
be great to make it working with the easier variant first, though keeping
the future enhancement in mind. If time permits, you can move to the more
complex variant later.
> Here is the easy-to-use wildcard callback prototype.
>
> /**
> * function is called by libcurl before the downloading started
> * - user can set/change/keep the FILE * pointer
> * - user can discard downloading -> return FALSE value.
> * - libcurl have to reinitializate progressbar before calling
> * this callback
> * - filetype is enum dir/file to allow user easy to create
> * directories if it is important for him
> */
> int wildcard_callback(char *matchedstring, FILE *f,
> int filetype)
> {
> // keep "f" or close it and open new .. by default keep on "f == stdout"
> return 0; // discard downloading this file .. or
> return 1;
> }
Is the opened file intended to be managed by libcurl? I would discourage such
approach then since the user of libcurl might be not interested in work with
local files at all. The incoming data may be simply processed on the fly. I
suggest to pass a general (void *) pointer to the callback, previously set by
the application. Perhaps shared with CURLOPT_WRITEDATA or something?
> And I have forgotten to idea about deepness of recoursive match, I think
> it is easy to implement in libcurl too. The CURLOPT_RECOURSIVE could be
> integer - and "0" does mean no recoursive match (default), "-1" unlimited
> and positive values could set concrete deepness ..
I also don't think it would be that easy. For inspiration you can look
at the gnulib FTS module works to estimate what walk-flags etc. are
usually necessary for such a traversal:
http://www.kernel.org/doc/man-pages/online/pages/man3/fts.3.html
Kamil
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-27