+ (print* "i")
+ (for-each (lambda (char)
+ (print* (if (eq? char #\tab)
+ " "
+ char)))
+ (string->list info-string))
+ (print "\tfake\tfake\t1\r"))
+
+(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)
+ (serve-record (list type display-string selector host 70)
+ path config))
+ ((type display-string selector)
+ (serve-record (list type display-string selector
+ (server-host config) (server-port config))
+ path config))
+ ((display-string selector)
+ (serve-record (list (infer-selector-type selector) display-string selector)
+ path config))
+ ((selector)
+ (serve-record (list (infer-selecto-type selector) selector)
+ path config))
+ (else (error "Unknown record type."))))
+
+(define (serve-shell-command command)
+ (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")))