AminetAminet
Search:
84481 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/blitz/cli_args.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:read thousands of CLI args from Blitz
Author:lombi at iprimus.com.au (Lorence Lombardo)
Uploader:lombi iprimus com au (Lorence Lombardo)
Type:dev/blitz
Version:4-Nov-10
Architecture:m68k-amigaos
Date:2010-11-04
Download:http://aminet.net/dev/blitz/cli_args.lha - View contents
Readme:http://aminet.net/dev/blitz/cli_args.readme
Downloads:1237

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



Contents of dev/blitz/cli_args.lha
PERMISSION  UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP     NAME
---------- ----------- ------- ------- ------ ---------- ------------ ----------
[generic]                  374     723  51.7% -lh5- 11e1 Jun 20  2007 cli_args/cli_args.ab2
[generic]                  169    1286  13.1% -lh5- b17d Jun 20  2007 cli_args/cli_args.ab2.xtra
[generic]                  940    1941  48.4% -lh5- 3722 Nov  4  2010 cli_args/cli_args.readme
[generic]                  624    1182  52.8% -lh5- 0478 Nov  4  2010 cli_args/cli_args13.ab2
[generic]                  186    1218  15.3% -lh5- 82a6 Nov  4  2010 cli_args/cli_args13.ab2.xtra
[generic]                 5038    5132  98.2% -lh5- 91c3 Nov  4  2010 cli_args/cli_args13.exe
[generic]                  620    1299  47.7% -lh5- 4e88 Jun 20  2007 cli_args/cli_args_3.ab2
[generic]                  173    1286  13.5% -lh5- d3d8 Jun 20  2007 cli_args/cli_args_3.ab2.xtra
[generic]                  544    1034  52.6% -lh5- d115 Jun 20  2007 cli_args/cli_args_d.ab2
[generic]                  171    1286  13.3% -lh5- 40b0 Jun 20  2007 cli_args/cli_args_d.ab2.xtra
[generic]                 7097    7220  98.3% -lh5- 2f82 Jun 20  2007 cli_args/cli_args_d.exe
---------- ----------- ------- ------- ------ ---------- ------------ ----------
 Total        11 files   15936   23607  67.5%            Nov  5  2010

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>