Return a file size string when possible.

This takes the advice from
  http://files.stairways.com/other/ftp-list-specs-info.txt
further: search for the date by an explicit occurrence of a known month
name.  This means that we won't see files with bad names (they'd be
filtered out of the result), but the filtered out entries are ones that
would not be usable with `ftp-make-file-seconds'.

When the month is found, and the entry is a file, look for a number
preceding the month, and if found, return it as the file size string.
This is a minor change in the API.  (But it's probably better to either
revise it further, or eventually make it irrelevant by exposing the
interesting functionality via `net/url'.)

original commit: 6a1336e75e
This commit is contained in:
Eli Barzilay 2011-08-05 01:08:21 -04:00
parent 55405d017b
commit 6a6f849c5c

View File

@ -46,13 +46,16 @@ Returns a list of files and directories in the current directory of
the server, assuming that the server provides directory information in the server, assuming that the server provides directory information in
the quasi-standard Unix format. the quasi-standard Unix format.
Each file or directory is represented by a list of three strings. The Each file or directory is represented by a list of three or four
first string is either @racket["-"], @racket["d"], or @racket["l"], strings. The first string is either @racket["-"], @racket["d"], or
depending on whether the items is a file, directory, or link, @racket["l"], depending on whether the items is a file, directory, or
respectively. The second item is the file's date; to convert this link, respectively. The second item is the file's date; to convert this
value to seconds consistent with @racket[file-seconds], pass the date value to seconds consistent with @racket[file-seconds], pass the date
string to @racket[ftp-make-file-seconds], below. The third string is string to @racket[ftp-make-file-seconds]. The third string is the name
the name of the file or directory. of the file or directory. If the item is a file (the first string is
@racket["-"]), and if the line that the server replied with has a size
in the expected place, then a fourth string containing this size is
included.
Warning: the FTP protocol has no specification for the reply format, so Warning: the FTP protocol has no specification for the reply format, so
this information can be unreliable.} this information can be unreliable.}