spider load file
This commit is contained in:
		
							parent
							
								
									45d4a8178f
								
							
						
					
					
						commit
						c2128a40cf
					
				| 
						 | 
					@ -27,7 +27,7 @@
 | 
				
			||||||
;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(load "util.scm")
 | 
					(load "util.scm")
 | 
				
			||||||
(load "html.scm")
 | 
					
 | 
				
			||||||
;;,open posix posix-files
 | 
					;;,open posix posix-files
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define server-data
 | 
					(define server-data
 | 
				
			||||||
| 
						 | 
					@ -66,7 +66,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (ask-server request filename hostname port)
 | 
					(define (ask-server request filename hostname port)
 | 
				
			||||||
  (let* ((dir-filename (do ((i 0 (+ i 1)))
 | 
					  (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
 | 
					                            (string-append "./" hostname (number->string i))) ;; return val
 | 
				
			||||||
                         ))
 | 
					                         ))
 | 
				
			||||||
         (out-file-port (open-output-file (string-append dir-filename "/" filename)))
 | 
					         (out-file-port (open-output-file (string-append dir-filename "/" filename)))
 | 
				
			||||||
| 
						 | 
					@ -91,5 +91,5 @@
 | 
				
			||||||
;      (display contents)
 | 
					;      (display contents)
 | 
				
			||||||
;      (file-contents->url contents)
 | 
					;      (file-contents->url contents)
 | 
				
			||||||
;      )))
 | 
					;      )))
 | 
				
			||||||
 | 
					;;test
 | 
				
			||||||
(ask-server (string-append "GET / HTTP/1.0" (string #\return #\newline #\return #\newline) "index.html" "www.gnu.org" 80))
 | 
					;;(ask-server (string-append "GET / HTTP/1.0" (string #\return #\newline #\return #\newline) "index.html" "www.gnu.org") 80)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,10 +37,10 @@
 | 
				
			||||||
(display "give port : ")
 | 
					(display "give port : ")
 | 
				
			||||||
(define port (number->string (read)))
 | 
					(define port (number->string (read)))
 | 
				
			||||||
(newline)
 | 
					(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): ")
 | 
					(display "give string to search for (no spaces): ")
 | 
				
			||||||
(define keyword (symbol->string (read))
 | 
					(define keyword (symbol->string (read)))
 | 
				
			||||||
(newline)
 | 
					(newline)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(let ((file-contents (file->string (string-append dir-filename "/" "index.html"))));;FIXME dir
 | 
					(let ((file-contents (file->string (string-append dir-filename "/" "index.html"))));;FIXME dir
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,12 +28,13 @@
 | 
				
			||||||
(load "file-util.scm")
 | 
					(load "file-util.scm")
 | 
				
			||||||
(load "search-util.scm")
 | 
					(load "search-util.scm")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(display "Do you want to use hash tables (y/n)?")
 | 
					;(display "Do you want to use hash tables (y/n)?")
 | 
				
			||||||
(let ((c (read-char)))
 | 
					;(let ((c (read-char)))
 | 
				
			||||||
  (if (eq? c #\y)
 | 
					;  (if (eq? c #\y)
 | 
				
			||||||
      (load "string-util-alt.scm")
 | 
					;      (load "string-util-alt.scm")
 | 
				
			||||||
      (begin
 | 
					;      (begin
 | 
				
			||||||
        (load "hash-util.scm")
 | 
					;        (load "hash-util.scm")
 | 
				
			||||||
        (load "string-util.scm"))))
 | 
					        (load "string-util.scm")
 | 
				
			||||||
 | 
					;)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(load "html-util.scm")
 | 
					(load "html-util.scm")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue