newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: kanen on May 03, 2011, 12:36:16 PM

Title: Bug in command-line option (-w)
Post by: kanen on May 03, 2011, 12:36:16 PM
I should be able to specify command-line options to be used with (main-args)
$ newlisp -word hi

ERR: no working directory found


This is a problem, because I did not specify "-w <working directory>" -- even though newLisp believes I did.



Maybe check for a space after -w?
Title: Re: Bug in command-line option (-w)
Post by: Lutz on May 04, 2011, 03:18:39 AM
You can specify your own options after the script name and they will not be confused with newLISP options:



[newlisp /home/public]$ newlisp test -word -lol
=>("newlisp" "test" "-word" "-lol")
[newlisp /home/public]$


or as a shell script:



[newlisp /home/public]$ ./test -word -lol
=>("/home/public/cgi-bin/newlisp" "./test" "-word" "-lol")
[newlisp /home/public]$


don't forget an (exit) statement at the end of your script, or newLISP will try to process the options meant to be for the script:



#!/home/public/cgi-bin/newlisp

(println "=>" (main-args))

(exit)    ; important




ps: when using the -w option for newLISP, it should not be followed by a script, except when you adjust the path to the script accordingly