#ReadArgs() Problems
3 messages in this thread
I am having a heck of a time getting the ReadArgs() function to
work for me in assembler.
What I want to do is get the parameters of a command from the
CLI, and along with the template, give me some sort of rdargs
or something. But after I call ReadArgs(), I keep on getting
a NULL in d0.
I try something like this:
readargs:
move.l #template,d1
move.l #array,d2
move.l #0,d3
move.l _DOSBase,a6
jsr _LVOReadArgs(a6)
tst.l d0 ; I get a zero here (??)
rts
template:
dc.b 'Filename/A,HI/S,BYE/S',0
cnop 0,2
array:
dc.l 0,0,0
I am using the c.o startup code from SAS/C 6.2. So I am basically
getting a main(argc,argv), which I already have an array from this.
But I am more interested in the RDArgs I want to get in d0. Another
thing that I am wondering is how is the ReadArgs supposed to get
the CLI command line from SAS/C c.o startup code if there are no
CLI command line pointers being passed to the ReadArgs() function?
All I have are C examples in The AmigaDOS Manual (3rd edition). But
the examples are confusing me.
Can somebody explain what I am doing wrong? And I would love some
code that can work (with what I want to do….) Thanks….
Luciano 73246,1744
Luciano,
When you test your code, are you supplying valid CLI arguments?
Your code works fine when called as an assembly language routine.
>How is the ReadArgs supposed to get the CLI command line … ?
From what I've discovered from peeking at the ReadArgs code, the CLI text
is apparently stored immediately after the current task control block,
which means that ReadArgs knows where to find it. Also, it seems that
ReadArgs remembers how much of this text it has read. And if you call
your routine twice, it freezes the second time round.
I would advise you to not rely on anything I said in the previous
paragraph, unless the same information is documented somewhere.
Also, I know nothing about C
Regards,
Shraddhan (via AP from Hertfordshire, England)
Luciano,
It seems likely to me that ReadArgs() has already been called in the c.o
routines. And you can't call it twice. If so, your best bet is to go with the
usual (argc, argv) C variables.
–Jim