spider load file

This commit is contained in:
erana 2012-02-01 13:05:49 +09:00
parent 45d4a8178f
commit c2128a40cf
3 changed files with 14 additions and 13 deletions

View File

@ -27,7 +27,7 @@
;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(load "util.scm")
(load "html.scm")
;;,open posix posix-files
(define server-data
@ -66,7 +66,7 @@
(define (ask-server request filename hostname port)
(let* ((dir-filename (do ((i 0 (+ i 1)))
((make-directory (string-append "./" hostname (number->string i)) (file-mode read write exec))
((make-directory (string-append "./" hostname (number->string i)))
(string-append "./" hostname (number->string i))) ;; return val
))
(out-file-port (open-output-file (string-append dir-filename "/" filename)))
@ -91,5 +91,5 @@
; (display contents)
; (file-contents->url contents)
; )))
(ask-server (string-append "GET / HTTP/1.0" (string #\return #\newline #\return #\newline) "index.html" "www.gnu.org" 80))
;;test
;;(ask-server (string-append "GET / HTTP/1.0" (string #\return #\newline #\return #\newline) "index.html" "www.gnu.org") 80)

View File

@ -37,10 +37,10 @@
(display "give port : ")
(define port (number->string (read)))
(newline)
(define dir-filename (display (ask-server (string-append "GET / HTTP/1.0" (string #\return #\newline #\return #\newline) "index.html" hostname port))))
(define dir-filename (ask-server (string-append "GET / HTTP/1.0" (string #\return #\newline #\return #\newline)) "index.html" hostname port))
(display "give string to search for (no spaces): ")
(define keyword (symbol->string (read))
(define keyword (symbol->string (read)))
(newline)
(let ((file-contents (file->string (string-append dir-filename "/" "index.html"))));;FIXME dir

View File

@ -28,12 +28,13 @@
(load "file-util.scm")
(load "search-util.scm")
(display "Do you want to use hash tables (y/n)?")
(let ((c (read-char)))
(if (eq? c #\y)
(load "string-util-alt.scm")
(begin
(load "hash-util.scm")
(load "string-util.scm"))))
;(display "Do you want to use hash tables (y/n)?")
;(let ((c (read-char)))
; (if (eq? c #\y)
; (load "string-util-alt.scm")
; (begin
; (load "hash-util.scm")
(load "string-util.scm")
;)))
(load "html-util.scm")