#!/usr/bin/guile -s !# (display "Content-type: text/html\n") ; Header: Output is HTML. (newline) ; End of headers. (define (repeatl f k) (if (<= k 0) '() ;; make sure (f) gets called before making tail of list. (let ((x (f))) (cons x (repeatl f (- k 1))) ) ) ) (define (read-cgi-input) (if (string-ci=? "POST" (getenv "REQUEST_METHOD")) ;; handle a POST method. (list->string (repeatl read-char (string->number (getenv "CONTENT_LENGTH" )))) ;; handle a GET method. (getenv "QUERY_STRING") ) ) (display "

CGI Input:

") (display "
\n")
(display (read-cgi-input))
(display "
\n")