From 045ded0d3032676138d2717adb892234fb5c7be9 Mon Sep 17 00:00:00 2001 From: sperber Date: Thu, 16 Jan 2003 09:23:05 +0000 Subject: [PATCH] Rewrite FTP-BUILD-PORT-STRING in terms of FORMAT-INTERNET-HOST-ADDRESS and FORMAT-PORT. --- scheme/lib/ftp.scm | 22 ++++++---------------- scheme/packages.scm | 1 + 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/scheme/lib/ftp.scm b/scheme/lib/ftp.scm index 11f0475..b2775d7 100644 --- a/scheme/lib/ftp.scm +++ b/scheme/lib/ftp.scm @@ -392,22 +392,12 @@ (define (ftp-build-PORT-string sockaddr) (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 - ))))) - + (receive (hst-address srvc-port) + (socket-address->internet-address sockaddr) + (string-append "PORT " + (format-internet-host-address ip-address ",") + "," + (format-port srvc-port))))) (define (ftp-send-command connection command . maybe-expected) (let-optionals* maybe-expected ((expected "2..")) diff --git a/scheme/packages.scm b/scheme/packages.scm index a649e3e..11a90af 100644 --- a/scheme/packages.scm +++ b/scheme/packages.scm @@ -412,6 +412,7 @@ (subset srfi-13 (string-join)) let-opt sunet-utilities + format-net crlf-io) (files (lib ftp)))