Lisp HUG Maillist Archive

Command Line Arguments in Delivered Applications

Hello,

I'm trying to build a command line program with lispworks that takes
arguments.  I am attempting to get them from
system:*line-argument-list*, but in the delivered application they are
the values given at delivery rather than when I run the program:

(defparameter *command-line-arguments*
  system:*line-arguments-list*)

(defun main ()
  (dolist (sound-file (cdr *command-line-arguments*))
    (format *error-output* "Playing: ~S~%" sound-file)
    (capi:play-sound
     (capi:load-sound
      sound-file))))

using this as the delivery file:

(in-package "CL-USER")
(load-all-patches)
(load "~/lispworks/play-sound.lisp")
(deliver #'main
	"play-sound"
         0
         :interface :capi
         :startup-bitmap-file nil)

Built using "-build play-sound.deliver".

When I run the program, I get:

:~/lispworks# ./play-sound ~/audio/Utility\ Sub.wav
Playing: "-build"
Playing: "play-sound.deliver"

How does one get the correct command line arguments from a delivered
application?

--
Burton Samograd

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: Command Line Arguments in Delivered Applications

You're setting up *command-line-arguments* with the value of system:*line-arguments-list* at delivery time, and then you use that value when you run your application.

You need to either use system:*line-arguments-list* directly in #'main, or give *command-line-arguments* its value in #'main.

> On 4 Feb 2017, at 04:16 , Burton Samograd <busfactor1@gmail.com> wrote:
> 
> Hello,
> 
> I'm trying to build a command line program with lispworks that takes
> arguments.  I am attempting to get them from
> system:*line-argument-list*, but in the delivered application they are
> the values given at delivery rather than when I run the program:
> 
> (defparameter *command-line-arguments*
>  system:*line-arguments-list*)
> 
> (defun main ()
>  (dolist (sound-file (cdr *command-line-arguments*))
>    (format *error-output* "Playing: ~S~%" sound-file)
>    (capi:play-sound
>     (capi:load-sound
>      sound-file))))
> 
> using this as the delivery file:
> 
> (in-package "CL-USER")
> (load-all-patches)
> (load "~/lispworks/play-sound.lisp")
> (deliver #'main
> 	"play-sound"
>         0
>         :interface :capi
>         :startup-bitmap-file nil)
> 
> Built using "-build play-sound.deliver".
> 
> When I run the program, I get:
> 
> :~/lispworks# ./play-sound ~/audio/Utility\ Sub.wav
> Playing: "-build"
> Playing: "play-sound.deliver"
> 
> How does one get the correct command line arguments from a delivered
> application?
> 
> --
> Burton Samograd
> 
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html


_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Updated at: 2020-12-10 08:31 UTC