command-line options

original commit: 7529b0dc712453c2c814ccd66a8a285d93e1b5d0
This commit is contained in:
Paul Steckler 2002-07-11 19:20:14 +00:00
parent af6b63da9a
commit 304cfbf60c

View File

@ -1,6 +1,7 @@
(module help mzscheme (module help mzscheme
(require (lib "web-server.ss" "web-server") (require (lib "web-server.ss" "web-server")
(lib "util.ss" "web-server") (lib "util.ss" "web-server")
(lib "cmdline.ss")
(lib "configuration.ss" "web-server") (lib "configuration.ss" "web-server")
(lib "configuration-structures.ss" "web-server") (lib "configuration-structures.ss" "web-server")
"private/server.ss" "private/server.ss"
@ -8,7 +9,19 @@
(require (lib "exit.ss" "help" "servlets" "private")) (require (lib "exit.ss" "help" "servlets" "private"))
(define hd-cookie (start-help-server)) (define launch-browser? #t)
(define external-connections? #f)
(command-line
"help-desk"
(current-command-line-arguments)
(once-each
[("-n" "--no-browser") "Do not launch browser"
(set! launch-browser? #f)]
[("-x" "--external-connections") "Allow external connections"
(set! external-connections? #t)]))
(define hd-cookie (start-help-server external-connections?))
(define help-desk-port (hd-cookie->port hd-cookie)) (define help-desk-port (hd-cookie->port hd-cookie))
(define exit-sem (make-semaphore 0)) (define exit-sem (make-semaphore 0))
@ -24,6 +37,8 @@
(close-output-port oport) (close-output-port oport)
(close-input-port iport)))) (close-input-port iport))))
(help-desk-browser hd-cookie) (when launch-browser?
(help-desk-browser hd-cookie))
; wait until shutdown ; wait until shutdown
(semaphore-wait/enable-break exit-sem)) (semaphore-wait/enable-break exit-sem))