Have FTP-LS and FTP-DIR returns list of directory lines rather than
printing the directory to (current-output-port).
This commit is contained in:
parent
101109e785
commit
f0448cb34f
|
@ -245,10 +245,11 @@
|
|||
(code-with-prefix "1"))
|
||||
(receive (newsock newsockaddr)
|
||||
(accept-connection sock)
|
||||
(dump (socket:inport newsock))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(ftp-read-reply connection))))
|
||||
(let ((lines (port->lines (socket:inport newsock))))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(ftp-read-reply connection)
|
||||
lines))))
|
||||
|
||||
;;: connection [ x string ] -> status
|
||||
(define (ftp-dir connection . maybe-dir)
|
||||
|
@ -258,10 +259,18 @@
|
|||
(code-with-prefix "1"))
|
||||
(receive (newsock newsockaddr)
|
||||
(accept-connection sock)
|
||||
(dump (socket:inport newsock))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(ftp-read-reply connection))))
|
||||
(let ((lines (port->lines (socket:inport newsock))))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(ftp-read-reply connection)
|
||||
lines))))
|
||||
|
||||
(define (port->lines port)
|
||||
(let loop ((reverse-lines '()))
|
||||
(let ((line (rread-crlf-line port)))
|
||||
(if (eof-object? line)
|
||||
(reverse reverse-lines)
|
||||
(loop (cons line reverse-lines))))))
|
||||
|
||||
|
||||
;; maybe-local may be a filename to which the data should be written,
|
||||
|
|
Loading…
Reference in New Issue