[cmucl-help] Command Line options in standalone executables

Didier Verna didier at lrde.epita.fr
Tue Nov 2 16:05:02 CET 2010


  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



So, I tried ":process-command-line nil" in the call to save-lisp
instead, and it seems to be closer to what I actually want, except that
I don't see how to get my options:

./cmu --foobar
("lisp" "-batch" "-quiet" "-noinit" "-nositeinit" "-load" "cmu.lisp" "--")
"lisp"
NIL
NIL



Any help appreciated !


Footnotes: 
[1]  my recent command-line options management library; see
     http://www.lrde.epita.fr/~didier/software/lisp/clon.php

-- 
Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com


More information about the cmucl-help mailing list