[NTLK] Shell arguments in NEWT/0?
Matthias Melcher
mm at matthiasm.com
Wed Jan 11 08:41:30 EST 2012
On 11.01.2012, at 04:36, Morgan Aldridge wrote:
> Quick question for the few of you out there that have used NEWT/0--is
> that anyone other than Matthias, Eckhart, and Paul?--when calling it
> from the command line, do you have any access to the command line
> arguments (argv & argc; $0, $1, $2... & $#; or whatever) from the
> NewtonScript side? If so, how, if not, any idea how hard it'd be to
> add?
Ah, what a nice idea! I don;t think this exists, but it should be fairly easy to implement.
Solution 1:
Use DefGlobalFunction to define an access function the the arguments:
NewtDefGlobalFunc(
NSSYM(GetVArgs),
GetVArgs,
0,
"GetVArgs()");
Then if the user calls this function, use the NewtCreate... functions to create an array of strings that you can return.
Solution 2:
Use NcSetGlobalVar(NSSYM(VArgs), NewtMakeArray(...)); to generate a globally accesible array of the command line parameters.
- Matthias
More information about the NewtonTalk
mailing list