Page 1 of 1

Bug in command-line option (-w)

Posted: Tue May 03, 2011 7:36 pm
by kanen
I should be able to specify command-line options to be used with (main-args)

Code: Select all

$ 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?

Re: Bug in command-line option (-w)

Posted: Wed May 04, 2011 10:18 am
by Lutz
You can specify your own options after the script name and they will not be confused with newLISP options:

Code: Select all

[newlisp /home/public]$ newlisp test -word -lol
=>("newlisp" "test" "-word" "-lol")
[newlisp /home/public]$
or as a shell script:

Code: Select all

[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:

Code: Select all

#!/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