Hangar.La tienda de software del Amiga

cli_args 4-Nov-10

read thousands of CLI args from Blitz

Short:        read thousands of CLI args from Blitz
Author:       lombi@iprimus.com.au (Lorence Lombardo)
Uploader:     lombi iprimus com au (Lorence Lombardo)
Type:         dev/blitz
Version:      4-Nov-10
Architecture: m68k-amigaos


Unlike other CLI parameter/argument routines this one is able to read
thousands without crashing.

I think the reason why other parameter/argument routines crash is because
they are reading the entire argument string into a single string which
exceeds the allocated string buffer.

This parameter routine is different. It does not store the entire argument
string. It only stores the individual parameters. The entire argument
string is read at 1 byte at time from a pointer provided by the OS.

"cli_args.exe" is able to read thousands of CLI parameters even tho it has
only been compiled with a humble "String Buffer Size" of 2048 bytes.

 
I conducted the following experiment with "cli_args.exe" and a program
called "f-req.lha" from the aminet:-

I ran "cli_args.exe" from CLI as follows:-

cli_args.exe >ram:test.txt `f-req multiselect`

I then selected all of the 3019 files in my YAM/incoming directory.

The file "ram:test.txt" was 137772 bytes. 
As you can see this by far exceeds my "String Buffer Size" of 2048 bytes.

Had I have stored the entire argument string into a single string
"cli_args.exe" would have crashed, but instead it worked like a charm. :)


Within this archive I have provided 3 main different argument routines so
you can select the routine which is most suitable for your particular 
program if you choose to use any one of these routines.


If you wish to use these CLI arg routines with a WB program then you should
use an alternative to "WBStartup" such as "wbmessage".
 

These CLI arg routines were influenced by "Args.bas" from here:-

http://aminet.net/package/dev/basic/Basic_Utils


Feeling bored ?  :)
Why not check out this URL ?

http://home.iprimus.com.au/lombi/1/homepage.htm

Gratis

Web del proyecto ↗

Descargar 16 KB

Desde el Amiga: abre Hangar y busca cli_args.

Autorlombi@iprimus.com.au (Lorence Lombardo)
Categoríadev/blitz
Tamaño16 KB
Fecha2024-07-27
Param68k-amigaos
OrigenAminet