This is a not an Amiga-specific question, but one aimed at a C program which would compile with GCC equally well on Windows or Amiga or whatever:
If I use main(int argc, char *argv[]) to get the Shell parameters supplied to a program, then they come pre-parsed... WHICH I DO NOT WANT. Is there a portable-C way of getting the original unparsed parameters?
Uhm, I dont think so... there is even no "portable" way to get parameters at all. Its all up to the (machine/system specific) startup code. The standard even demands pre-parsed parameters, given to the main function by the startup code.
So you would have to develop a corresponding non-parsing startup code yourself, for all platforms/compilers you wish to support.
It should be quite clear why this is. Its because the different systems transmit command line or "desktop" parameters in a very different way, using different data types and even different ways of transmitting data at all (stack based, register based, fixed addresses in main memory and so on). For Amiga there are even two different ways how parameters are transmitted to a C program, requiring a specialized startup code. CLI standard C parameters and WBMsg-type.
Why you would like to have them "unparsed", btw.?
Coder Insane-Software
www.insane-software.de
@ChrisH
As I wrote in your thread on amigans.net you can use GetArgStr() from dos.library to do this.
@whose
I think he means just portable between AmigaOS (m68k and PPC) and Amiga-like OSes like AROS and MorphOS.
@salass00:
No, I dont think so, as he wrote about "Windows or whatever".
There is even no POSIX way to get the unparsed parameters, seems that Amiga (and maybe another niche OS, I dont know) is the only one which present the full command line without pre-parsing, if the developer wants to see it.
Coder Insane-Software
www.insane-software.de