diff --git a/scheme/lib/ftp.scm b/scheme/lib/ftp.scm index 048605d..2d53ad6 100644 --- a/scheme/lib/ftp.scm +++ b/scheme/lib/ftp.scm @@ -146,18 +146,17 @@ connection)))) (exactly-code "230"))))))) -;; Type must be one of 'binary or 'text or 'ascii, or a string which will be -;; sent verbatim +(define-enumerated-type ftp-type :ftp-type + ftp-type? + ftp-types + ftp-type-name + ftp-type-index + (binary ascii)) -(define (ftp-type connection type) +(define (ftp-set-type! connection type) (let ((ttype (cond - ((string? type) type) - ((eq? type 'binary) "I") - ((or (eq? type 'ascii) - (eq? type 'text)) "A") - (else - (call-error "type must be one of 'binary or 'text or 'ascii" - ftp-type type))))) + ((eq? type (ftp-type binary)) "I") + ((eq? type (ftp-type ascii)) "A")))) (ftp-send-command connection (build-command "TYPE" ttype)))) ;;: connection x string x string -> status diff --git a/scheme/packages.scm b/scheme/packages.scm index beae1d4..54b2780 100644 --- a/scheme/packages.scm +++ b/scheme/packages.scm @@ -90,7 +90,8 @@ (define-interface ftp-interface (export ftp-connect - ftp-type + (ftp-type :syntax) + ftp-set-type! ftp-rename ftp-delete ftp-cd @@ -414,6 +415,7 @@ (open scheme-with-scsh netrc define-record-types + finite-types receiving handle conditions