mes: Support -C and -L for Guile compatibility.

* module/mes/boot-0.scm): Support -C and -L for Guile compatibility.

Signed-off-by: Jan Nieuwenhuizen <janneke@gnu.org>
This commit is contained in:
Jan Nieuwenhuizen 2018-04-29 19:06:11 +02:00
parent 4ca4e9a6ff
commit 1b0089111f
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -238,9 +238,11 @@
(let ((tty? (isatty? 0))) (let ((tty? (isatty? 0)))
(define (parse-opts args) (define (parse-opts args)
(let* ((option-spec (let* ((option-spec
'((dump) '((compiled-path (single-char #\C) (value #t))
(dump)
(help (single-char #\h)) (help (single-char #\h))
(load) (load)
(load-path (single-char #\L) (value #t))
(main (single-char #\e) (value #t)) (main (single-char #\e) (value #t))
(source (single-char #\s) (value #t)) (source (single-char #\s) (value #t))
(version (single-char #\V))))) (version (single-char #\V)))))
@ -265,21 +267,27 @@
(display "Usage: mes [OPTION]... [FILE]... (display "Usage: mes [OPTION]... [FILE]...
Evaluate code with Mes, interactively or from a script. Evaluate code with Mes, interactively or from a script.
[-s] FILE load source code from FILE, and exit [-s] FILE load source code from FILE, and exit
-- stop scanning arguments; run interactively -- stop scanning arguments; run interactively
The above switches stop argument processing, and pass all The above switches stop argument processing, and pass all
remaining arguments as the value of (command-line). remaining arguments as the value of (command-line).
--dump dump binary program to stdout -C,--compiled-path=DIR
-e,--main=MAIN after reading script, apply MAIN to command-line arguments ignored for Guile compatibility
-h, --help display this help and exit --dump dump binary program to stdout
--load load binary program [module/mes/boot-0.32-mo] -e,--main=MAIN after reading script, apply MAIN to command-line arguments
-v, --version display version information and exit -h, --help display this help and exit
--load load binary program [module/mes/boot-0.32-mo]
-L,--load-path=DIR add DIR to the front of the module load path
-v, --version display version information and exit
" (or (and usage? (current-error-port)) (current-output-port))) " (or (and usage? (current-error-port)) (current-output-port)))
(exit (or (and usage? 2) 0))) (exit (or (and usage? 2) 0)))
options) options)
(if main (set! %main main)) (if main (set! %main main))
(and=> (option-ref options 'load-path #f)
(lambda (dir)
(setenv "GUILE_LOAD_PATH" (string-append dir ":" (getenv "GUILE_LOAD_PATH")))))
(cond ((pair? files) (cond ((pair? files)
(let* ((file (car files)) (let* ((file (car files))
(port (if (equal? file "-") 0 (port (if (equal? file "-") 0