Fix some mis-indentations of RECEIVE.
This commit is contained in:
parent
f7ca3d5393
commit
fcbc62f29e
|
@ -244,11 +244,11 @@
|
|||
(ftp-build-command-string "NLST" maybe-dir)
|
||||
"1..")
|
||||
(receive (newsock newsockaddr)
|
||||
(accept-connection sock)
|
||||
(dump (socket:inport newsock))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(ftp-read-response connection "2.."))))
|
||||
(accept-connection sock)
|
||||
(dump (socket:inport newsock))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(ftp-read-response connection "2.."))))
|
||||
|
||||
;;: connection [ x string ] -> status
|
||||
(define (ftp-dir connection . maybe-dir)
|
||||
|
@ -257,11 +257,11 @@
|
|||
(ftp-build-command-string "LIST" maybe-dir)
|
||||
"1..")
|
||||
(receive (newsock newsockaddr)
|
||||
(accept-connection sock)
|
||||
(dump (socket:inport newsock))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(ftp-read-response connection "2.."))))
|
||||
(accept-connection sock)
|
||||
(dump (socket:inport newsock))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(ftp-read-response connection "2.."))))
|
||||
|
||||
|
||||
;; maybe-local may be a filename to which the data should be written,
|
||||
|
@ -284,16 +284,16 @@
|
|||
(format #f "RETR ~a" remote-file)
|
||||
"150")
|
||||
(receive (newsock newsockaddr)
|
||||
(accept-connection sock)
|
||||
(with-current-output-port OUT
|
||||
(dump (socket:inport newsock)))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(let ((status (ftp-read-response connection "2..")))
|
||||
(if (string? local) (close OUT))
|
||||
(if (eq? local #f)
|
||||
(string-output-port-output OUT)
|
||||
status)))))
|
||||
(accept-connection sock)
|
||||
(with-current-output-port OUT
|
||||
(dump (socket:inport newsock)))
|
||||
(close-socket newsock)
|
||||
(close-socket sock)
|
||||
(let ((status (ftp-read-response connection "2..")))
|
||||
(if (string? local) (close OUT))
|
||||
(if (eq? local #f)
|
||||
(string-output-port-output OUT)
|
||||
status)))))
|
||||
|
||||
|
||||
;; FIXME: should have an optional argument :rename which defaults to
|
||||
|
@ -309,18 +309,18 @@
|
|||
(define (ftp-put connection local-file . maybe-remote-file)
|
||||
(let-optionals* maybe-remote-file ((remote-file #f))
|
||||
(let* ((sock (ftp-open-data-connection connection))
|
||||
(IN (open-input-file local-file))
|
||||
(IN (open-input-file local-file))
|
||||
(cmd (format #f "STOR ~a" (or remote-file local-file))))
|
||||
(ftp-send-command connection cmd "150")
|
||||
(receive (newsock newsockaddr)
|
||||
(accept-connection sock)
|
||||
(with-current-output-port (socket:outport newsock) (dump IN))
|
||||
(close (socket:outport newsock)) ; send the server EOF
|
||||
(close-socket newsock)
|
||||
(let ((status (ftp-read-response connection "2..")))
|
||||
(close IN)
|
||||
(close-socket sock)
|
||||
status)))))
|
||||
(accept-connection sock)
|
||||
(with-current-output-port (socket:outport newsock) (dump IN))
|
||||
(close (socket:outport newsock)) ; send the server EOF
|
||||
(close-socket newsock)
|
||||
(let ((status (ftp-read-response connection "2..")))
|
||||
(close IN)
|
||||
(close-socket sock)
|
||||
status)))))
|
||||
|
||||
;;: connection x string [x string] -> status
|
||||
(define (ftp-append connection local-file . maybe-remote-file)
|
||||
|
@ -330,15 +330,15 @@
|
|||
(cmd (format #f "APPE ~a" (or remote-file local-file))))
|
||||
(ftp-send-command connection cmd "150")
|
||||
(receive (newsock newsockaddr)
|
||||
(accept-connection sock)
|
||||
(with-current-output-port (socket:outport newsock)
|
||||
(dump IN))
|
||||
(close (socket:outport newsock)) ; send the server EOF
|
||||
(close-socket newsock)
|
||||
(let ((status (ftp-read-response connection "2..")))
|
||||
(close IN)
|
||||
(close-socket sock)
|
||||
status)))))
|
||||
(accept-connection sock)
|
||||
(with-current-output-port (socket:outport newsock)
|
||||
(dump IN))
|
||||
(close (socket:outport newsock)) ; send the server EOF
|
||||
(close-socket newsock)
|
||||
(let ((status (ftp-read-response connection "2..")))
|
||||
(close IN)
|
||||
(close-socket sock)
|
||||
status)))))
|
||||
|
||||
;; send a command verbatim to the remote server and wait for a
|
||||
;; response.
|
||||
|
@ -393,20 +393,20 @@
|
|||
(let* ((hst-info (host-info (system-name)))
|
||||
(ip-address (car (host-info:addresses hst-info))))
|
||||
(receive (hst-address srvc-port)
|
||||
(socket-address->internet-address sockaddr)
|
||||
(let* ((num32 ip-address)
|
||||
(num24 (arithmetic-shift num32 -8))
|
||||
(num16 (arithmetic-shift num24 -8))
|
||||
(num08 (arithmetic-shift num16 -8))
|
||||
(byte0 (bitwise-and #b11111111 num08))
|
||||
(byte1 (bitwise-and #b11111111 num16))
|
||||
(byte2 (bitwise-and #b11111111 num24))
|
||||
(byte3 (bitwise-and #b11111111 num32)))
|
||||
(format #f "PORT ~a,~a,~a,~a,~a,~a"
|
||||
byte0 byte1 byte2 byte3
|
||||
(arithmetic-shift srvc-port -8) ; high order byte
|
||||
(bitwise-and #b11111111 srvc-port) ; lower order byte
|
||||
)))))
|
||||
(socket-address->internet-address sockaddr)
|
||||
(let* ((num32 ip-address)
|
||||
(num24 (arithmetic-shift num32 -8))
|
||||
(num16 (arithmetic-shift num24 -8))
|
||||
(num08 (arithmetic-shift num16 -8))
|
||||
(byte0 (bitwise-and #b11111111 num08))
|
||||
(byte1 (bitwise-and #b11111111 num16))
|
||||
(byte2 (bitwise-and #b11111111 num24))
|
||||
(byte3 (bitwise-and #b11111111 num32)))
|
||||
(format #f "PORT ~a,~a,~a,~a,~a,~a"
|
||||
byte0 byte1 byte2 byte3
|
||||
(arithmetic-shift srvc-port -8) ; high order byte
|
||||
(bitwise-and #b11111111 srvc-port) ; lower order byte
|
||||
)))))
|
||||
|
||||
|
||||
(define (ftp-send-command connection command . maybe-expected)
|
||||
|
|
Loading…
Reference in New Issue