1(import (cock)
2 (chicken process-context))
3
4(define (main args)
5 (define root (current-directory))
6 (define port 8000)
7 (let loop ((args args))
8 (cond
9 ((null? args) (serve root port))
10 ((equal? (car args) "-p")
11 (set! port (cadr args))
12 (loop (cddr args)))
13 (else
14 (set! root (car args))
15 ;; Stop processing arguments
16 (loop '())))))
17
18(cond-expand
19 ((or chicken-script compiling)
20 (main (command-line-arguments)))
21 (else))