SPAN - question 1

This commit is contained in:
erana 2012-01-18 00:42:36 +09:00
parent 902b798979
commit e9f2877acb
4 changed files with 33 additions and 3 deletions

View File

@ -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))

View File

@ -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))

View File

@ -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)))))

View File

@ -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"))