1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix --listen option to allow other ports

* module/ice-9/command-line.scm (compile-shell-switches): Fix
  off-by-one error in 'substring', and swap branches of conditional.
This commit is contained in:
Ian Price 2011-09-10 03:02:32 +01:00 committed by Andy Wingo
parent a8d7fba8d4
commit 86b4309b71

View file

@ -331,15 +331,15 @@ If FILE begins with `-' the -s switch is mandatory.
(parse (parse
args args
(cons (cons
(let ((where (substring arg 8))) (let ((where (substring arg 9)))
(cond (cond
((string->number where) ; --listen=PORT ((string->number where) ; --listen=PORT
=> (lambda (port) => (lambda (port)
(if (and (integer? port) (exact? port) (>= port 0)) (if (and (integer? port) (exact? port) (>= port 0))
(error "invalid port for --listen")
`(@@ (system repl server) `(@@ (system repl server)
(spawn-server (spawn-server
(make-tcp-server-socket #:port ,port)))))) (make-tcp-server-socket #:port ,port)))
(error "invalid port for --listen"))))
((string-prefix? "/" where) ; --listen=/PATH/TO/SOCKET ((string-prefix? "/" where) ; --listen=/PATH/TO/SOCKET
`(@@ (system repl server) `(@@ (system repl server)
(spawn-server (spawn-server