cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] a new option WILDCARDMATCH (FTP only for now)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 1 Apr 2010 12:51:29 +0200 (CEST)

On Thu, 1 Apr 2010, Jamie Lokier wrote:

>> 14 - when a directory linsting line is parsed, how come it doesn't store
>> timestamp, permission, user + group etc and provides that in the callback
>> as well? I'm sure applications who want info about files would like that
>> info too.
>
> FTP directory parsing is a somewhat arcane art to do portably for all FTP
> servers, especially when the FTP server isn't unix.

Yes, it is indeed an art of fuzzy matching.

> Permission, user + group is surely a very unix-centric thing?

Yes, indeed. I was just thinking that since the info might very well be there
and application might very well want that info, it would be fairly easy to (if
the info is found and parsed) provide it to the app.

> Timestamp from directory listing is a bit iffy, because I gather FTP servers
> flip between giving the day+month+hour+minute (no year) and giving just the
> day+month+year (no time), according to distance from the time of the
> request, and occasionally getting confused by timezones in that decision
> (especially on Windows), and occasionally getting confused if a file's
> timestamp is in the future.

Ah, yes true. The time stamp is probably next to useless for most users.
Possibly providing it as pure text in the same shape it was found on the
server could be interesting to some, as then the app could display a listing
quite similar to that the server provided.

>> 19 - fnmatch() is not portable enough for unconditional use.
>
> Or just leave that to the application? I.e. return each filename and let
> the application decide which ones it wants. That's more flexible than
> fnmatch and avoids portability of fnmatch issues. Even when you have native
> fnmatch(), they don't all behave exactly the same.

Yes, I'm leaning towards this being the best idea. It also allows the app to
use what patchern matchin style it likes, be it old dos-style simple *?,
fnmatch shell-style patterns or even full regex style ones.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-01