Mercurial > gftp.yaz
diff lib/rfc959.c @ 485:7334a74db6f6
2004-6-15 Brian Masney <masneyb@gftp.org>
* lib/protocols.c - added supported for multiline VMS directory
listings. Also, parse the date correctly for single line VMS
directory listings
* lib/gftp.h lib/local.c lib/rfc2068.c lib/rfc959.c lib/sshv.c -
added function pointer get_next_dirlist_line to gftp_request structure.
This will retrieve the next line of input for the directory listing.
This is only implemented in the FTP protocol at the moment. It shouldn't
be needed in the other protocols
author | masneyb |
---|---|
date | Wed, 16 Jun 2004 02:57:02 +0000 |
parents | 97fd5eb34be0 |
children | 39e9945288ea |
line wrap: on
line diff
--- a/lib/rfc959.c Wed Jun 16 00:59:07 2004 +0000 +++ b/lib/rfc959.c Wed Jun 16 02:57:02 2004 +0000 @@ -1457,11 +1457,29 @@ } +static ssize_t +rfc959_get_next_dirlist_line (gftp_request * request, int fd, + char *buf, size_t buflen) +{ + ssize_t (*oldread_func) (gftp_request * request, void *ptr, size_t size, + int fd); + rfc959_parms * parms; + ssize_t len; + + parms = request->protocol_data; + + oldread_func = request->read_function; + request->read_function = parms->data_conn_read; + len = gftp_get_line (request, &parms->dataconn_rbuf, buf, buflen, fd); + request->read_function = oldread_func; + + return (len); +} + + int rfc959_get_next_file (gftp_request * request, gftp_file * fle, int fd) { - ssize_t (*oldread_func) (gftp_request * request, void *ptr, size_t size, - int fd); rfc959_parms * parms; char tempstr[1024]; ssize_t len; @@ -1483,19 +1501,15 @@ do { - oldread_func = request->read_function; - request->read_function = parms->data_conn_read; - len = gftp_get_line (request, &parms->dataconn_rbuf, tempstr, - sizeof (tempstr), fd); - request->read_function = oldread_func; - + len = rfc959_get_next_dirlist_line (request, fd, tempstr, + sizeof (tempstr)); if (len <= 0) { gftp_file_destroy (fle); return ((int) len); } - if (gftp_parse_ls (request, tempstr, fle) != 0) + if (gftp_parse_ls (request, tempstr, fle, fd) != 0) { if (strncmp (tempstr, "total", strlen ("total")) != 0 && strncmp (tempstr, _("total"), strlen (_("total"))) != 0) @@ -1797,6 +1811,7 @@ request->abort_transfer = rfc959_abort_transfer; request->list_files = rfc959_list_files; request->get_next_file = rfc959_get_next_file; + request->get_next_dirlist_line = rfc959_get_next_dirlist_line; request->get_file_size = rfc959_get_file_size; request->chdir = rfc959_chdir; request->rmdir = rfc959_rmdir;