From 979c46cd940e2d8ddb6aeabfaf8156a9024972a6 Mon Sep 17 00:00:00 2001 From: erana Date: Wed, 18 Jan 2012 03:48:00 +0900 Subject: [PATCH] tmail refactor --- scsh/SPAN/SPAN-server-daemon.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scsh/SPAN/SPAN-server-daemon.scm b/scsh/SPAN/SPAN-server-daemon.scm index f5ffdf2..0040f3e 100644 --- a/scsh/SPAN/SPAN-server-daemon.scm +++ b/scsh/SPAN/SPAN-server-daemon.scm @@ -32,6 +32,14 @@ (define (eoln) (string #\newline)) (define (servermsg) (display "::message::")) +(define (get-package package-name) + (let* ((in (open-input-file (if (string<=? ".tar.gz" package-name) + package-name + (string-append package-name ".tar.gz")))) + (contents "")) + (do ((c (read-char in) (read-char in))) + ((eof-object? c)contents) + (set! contents (string-append contents (string c)))))) (define (run-daemon-child-SPAN rec) (let ((*hostname (hostname rec)) @@ -63,7 +71,7 @@ (if (symbol? answer) (cond ((eq? 'get answer) (let ((answer2 (read (make-string-input-port in)))) - (write (tmail-get-mail-with-index (getenv "USER") idx) out))) + (write (get-package answer2) out))) ((eq? 'QUIT answer) (write *bye out) (close-input-port in)