[cmucl-help] Command Line options in standalone executables

Raymond Toy toy.raymond at gmail.com
Tue Nov 2 17:14:07 CET 2010


On 11/2/10 11:05 AM, Didier Verna wrote:
>   Hello,
>
> I'm trying to port Clon[1] to CMUCL, but I can't seem to figure out how
> to create standalone executables and retrieve user (non-lisp) options
> from the command-line.
>
> Consider the following source file:
>
> | (in-package :cl-user)
> | 
> | (defun main ()
> |   (format t "~S~%" ext:*command-line-strings*)
> |   (format t "~S~%" ext:*command-line-utility-name*)
> |   (format t "~S~%" ext:*command-line-words*)
> |   (format t "~S~%" ext:*command-line-application-arguments*)
> |   (unix:unix-exit 0))
> | 
> | (ext:save-lisp "cmu"
> | 	       :init-function #'main :load-init-file nil :site-init nil
> | 	       :print-herald nil :batch-mode t :process-command-line t
> | 	       :executable t)
>
>
> I create a standalone executable like this:
>
> lisp -batch -quiet -noinit -nositeinit -load cmu.lisp --
>
> Now, this executable seems to understand CMUCL's options, but the --
> syntax doesn't work as documented:
>
> ./cmu -- --foobar
> Warning:  #<Command Line Switch "-"> is an illegal switch
> Warning:  #<Command Line Switch "-foobar"> is an illegal switch
> ("./cmu" "--" "--foobar")
> "./cmu"
> NIL
> NIL
Ah, this looks like a bug in the command parser. If I do

./cmu -eval t -- --foobar

there are no warnings:

("./cmu" "-eval" "t" "--" "--foobar")
"./cmu"
NIL
("--foobar")


I'll see what the issue is.

Ray



More information about the cmucl-help mailing list