From e9f2877acbf41f99135b8c9f32b01e91bb8830c6 Mon Sep 17 00:00:00 2001 From: erana Date: Wed, 18 Jan 2012 00:42:36 +0900 Subject: [PATCH] SPAN - question 1 --- scsh/SPAN/SPAN-client.scm | 2 +- scsh/SPAN/SPAN-server.scm | 2 +- scsh/SPAN/SPAN.scm | 26 +++++++++++++++++++++++++- scsh/SPAN/load.scm | 6 ++++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/scsh/SPAN/SPAN-client.scm b/scsh/SPAN/SPAN-client.scm index a57c4b1..b957bd3 100644 --- a/scsh/SPAN/SPAN-client.scm +++ b/scsh/SPAN/SPAN-client.scm @@ -26,7 +26,7 @@ ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -(define (ask-server request port-number) +(define (SPAN-ask-server request port-number) (call-with-values (lambda () (socket-client (get-host-name) port-number)) diff --git a/scsh/SPAN/SPAN-server.scm b/scsh/SPAN/SPAN-server.scm index 6a9b2a7..55228b6 100644 --- a/scsh/SPAN/SPAN-server.scm +++ b/scsh/SPAN/SPAN-server.scm @@ -26,7 +26,7 @@ ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -(define (tell-client request port-number sock) +(define (SPAN-tell-client request port-number sock) (call-with-values (lambda () (socket-accept sock)) diff --git a/scsh/SPAN/SPAN.scm b/scsh/SPAN/SPAN.scm index 872689b..492feb6 100644 --- a/scsh/SPAN/SPAN.scm +++ b/scsh/SPAN/SPAN.scm @@ -1,4 +1,4 @@ -;;; SPAN.scm - Scheme Perl Archive Network +;;; SPAN.scm - Scheme Perl Archive Network ;;; ;;; Copyright (c) 2011-2012 Johan Ceuppens ;;; @@ -26,4 +26,28 @@ ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +(define SPAN-shell-droptext-1 +"The following questions are intended to help you with the +configuration. The CPAN module needs a directory of its own to cache +important index files and maybe keep a temporary mirror of CPAN files. +This may be a site-wide or a personal directory." + +(define (SPAN-question~ droptext question answer defaultchoice) + (let ((s "")) + (display droptext) + (newline) + (display question)(display " ") + (display "[")(display defaultchoice)(display "] ") + (set! s (read)) + (cond ((and (symbol? s) + (string=? (symbol->string s) defaultchoice)) + (set! answer defaultchoice)) + ((and (number? s) + (string=? (symbol->number s) defaultchoice)) + (set! answer defaultchoice)) + ((string=? (symbol->string s)(string #\return)) + (set! answer defaultchoice)) + ((string? (symbol->string s)) + (set! answer (symbol->string s))) + (else (SPAN-question~ droptext question answer defaultchoice))))) diff --git a/scsh/SPAN/load.scm b/scsh/SPAN/load.scm index 1bdb0c2..bc687a3 100644 --- a/scsh/SPAN/load.scm +++ b/scsh/SPAN/load.scm @@ -26,3 +26,9 @@ ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +(load "SPAN.scm") +;;prototype (define (SPAN-question~ droptext question answer defaultchoice) +(SPAN-question~ SPAN-shell-droptext-1 + "SPAN build and cache directory" + "" + (string-append (getenv "HOME") "/.span"))