|
From: Duncan B. <dhg...@gm...> - 2011-02-15 23:13:42
|
Hi All,
I'm teaching myself Lisp using SBCL (1.0.40.0.debian). I have an
application (myfitnessdata), which uses the following code to process
command line arguments:
(:use :common-lisp)
(:export #:main))
(in-package :myfitnessdata)
(require :sb-posix)
;; snip
(defun main ()
(if (= (length sb-ext:*posix-argv*) 3)
(let ((username (nth 0 sb-ext:*posix-argv*))
(password (nth 1 sb-ext:*posix-argv*))
(path (nth 2 sb-ext:*posix-argv*)))
(scrape (username password path)))
(show-usage)))
I am compiling this application using the following Lisp code:
(load "myfitnessdata.lisp")
(save-lisp-and-die "myfitnessdata.bin" :executable t :toplevel
'myfitnessdata:main)
This produces an executable that I can run. However, the
sb-ext:*posix-argv* list is always empty. If I run the following:
./myfitnessdata.bin myusername mypassword /home/me/data
... then all I get is the usage instructions produced by (show-usage).
I think I must be missing something simple - could someone please let
me know how to (save-lisp-and-die) such that the resultant executable
takes command line arguments? I suspect that the saved core contains
the empty command line argument list, but I'm not sure how to instruct
save-lisp-or-die to produce a core that replaces that empty list with
whatever is passed from the CLI.
TIA for any help :-)
--
{ :phone => '(+61) 420 817 082', :skype => 'duncan_bayne',
:email => 'dhg...@gm...', :web => 'http://www.fluidscape.com/' }
"If you're in a fair fight, you didn't plan it properly."
- Nick Lappos, Chief R&D Pilot, Sikorsky Aircraft
|