Add expression evaluation.
authorTim Vaughan <tgvaughan@gmail.com>
Fri, 3 May 2019 10:34:56 +0000 (12:34 +0200)
committerTim Vaughan <tgvaughan@gmail.com>
Fri, 3 May 2019 10:34:56 +0000 (12:34 +0200)
burrow.scm

index c258311..afdee12 100644 (file)
 (define (serve-record record path config)
   (match record
     (('shell command) (serve-shell-command command))
 (define (serve-record record path config)
   (match record
     (('shell command) (serve-shell-command command))
+    (('eval expression) (serve-expression expression))
     ((type display-string selector host port)
      (print type display-string "\t" selector "\t" host "\t" port "\r"))
     ((type display-string selector host)
     ((type display-string selector host port)
      (print type display-string "\t" selector "\t" host "\t" port "\r"))
     ((type display-string selector host)
   (let-values (((in-port out-port id) (process command)))
     (for-each serve-info-record (read-lines in-port))))
 
   (let-values (((in-port out-port id) (process command)))
     (for-each serve-info-record (read-lines in-port))))
 
+(define (serve-expression expression)
+  (for-each serve-info-record
+            (string-split (conc (eval expression)) "\n")))
+
 ;;; main
 
 (define (main)
 ;;; main
 
 (define (main)
               (run-server (make-server-config root hostname port))
               (error "Invalid port argument." port))))))
 
               (run-server (make-server-config root hostname port))
               (error "Invalid port argument." port))))))
 
-(main)
+;; (main)
 
 
-;; (define (test)
-;;   (run-server (make-server-config "gopher-root" "localhost" 70)))
+(define (test)
+  (run-server (make-server-config "gopher-root" "localhost" 70)))
 
 ;; (test)
 
 ;; (test)