From 4ef92c949ada9210c965f8eb660e8a44ece82bc0 Mon Sep 17 00:00:00 2001 From: sperber Date: Mon, 20 Jan 2003 15:07:51 +0000 Subject: [PATCH] In POP3: replace uses of FORMAT --- scheme/lib/pop3.scm | 21 +++++++++++++-------- scheme/packages.scm | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/scheme/lib/pop3.scm b/scheme/lib/pop3.scm index 493a3ad..7b310f8 100644 --- a/scheme/lib/pop3.scm +++ b/scheme/lib/pop3.scm @@ -107,8 +107,8 @@ ((pop3-connection-challenge connection) (pop3-apop-login connection login password)))) (lambda () - (pop3-send-command connection (format #f "USER ~a" login)) - (pop3-send-command connection (format #f "PASS ~a" password)) + (pop3-send-command connection (build-command "USER" login)) + (pop3-send-command connection (build-command "PASS" password)) (set-pop3-connection-login! connection login) (set-pop3-connection-password! connection password) (set-pop3-connection-state! connection 'connected)))))) @@ -143,7 +143,7 @@ (md5-digest->number (md5-digest-for-string key)) 16)) (status (pop3-send-command connection - (format #f "APOP ~a ~a" login digest)))) + (build-command "APOP" login digest)))) (set-pop3-connection-login! connection login) (set-pop3-connection-password! connection password) (set-pop3-connection-state! connection 'connected) @@ -163,14 +163,16 @@ ;;: connection x integer -> status (define (pop3-get connection msgid) (pop3-check-transaction-state connection 'pop3-get) - (let ((status (pop3-send-command connection (format #f "RETR ~a" msgid)))) + (let ((status (pop3-send-command connection + (build-command "RETR" (number->string msgid))))) (pop3-dump (socket:inport (pop3-connection-command-socket connection))) status)) ;;: connection x integer -> status (define (pop3-headers connection msgid) (pop3-check-transaction-state connection 'pop3-headers) - (let ((status (pop3-send-command connection (format #f "TOP ~a 0" msgid)))) + (let ((status (pop3-send-command connection + (build-command "TOP" (number->string msgid) "0")))) (pop3-dump (socket:inport (pop3-connection-command-socket connection))) status)) @@ -188,7 +190,7 @@ ;;: connection x integer -> status (define (pop3-delete connection msgid) (pop3-check-transaction-state connection 'pop3-delete) - (pop3-send-command connection (format #f "DELE ~a" msgid))) + (pop3-send-command connection (build-command "DELE" (number->string msgid)))) ;; any messages which have been marked for deletion are unmarked @@ -230,7 +232,7 @@ (let* ((sock (pop3-connection-command-socket connection)) (in (socket:inport sock)) (line (read-crlf-line in))) - (pop3-log connection (format #f "-> ~a" line)) + (pop3-log connection (string-append "-> " line)) line)) ;; this could perhaps be improved @@ -257,7 +259,7 @@ (out (socket:outport sock))) (write-string command out) (write-crlf out) - (pop3-log connection (format #f "<- ~a" command)) + (pop3-log connection (string-append "<- " command)) (pop3-handle-response (pop3-read-response connection) command))) (define (pop3-dump fd) @@ -272,4 +274,7 @@ (newline) (loop)))))) +(define (build-command str . opt-args) + (string-join (cons str opt-args))) + ;; EOF diff --git a/scheme/packages.scm b/scheme/packages.scm index 0dbe5e7..8c6db36 100644 --- a/scheme/packages.scm +++ b/scheme/packages.scm @@ -449,7 +449,7 @@ handle conditions handle-fatal-error signals - (subset srfi-13 (string-index string-prefix?)) + (subset srfi-13 (string-index string-prefix? string-join)) let-opt crlf-io) (files (lib pop3)))