| N F O _ G E T A R G S O U R C E ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
AMIGA - NFO_#?
----------------------------------------------------------------------------
NAME
nfo_getargsource() - Provides with alternative arg.
source(s).
SYNOPSIS
rdi = nfo_getargsource(loops, ttname, envname);
struct RDArgs *nfo_getargsource(
LONG *, UBYTE *, UBYTE *):
FUNCTION
This func. was written in such a way that the command
line interface can also be used as a prefs parser.
INPUTS
loops - Pointer to a datatype that will hold number
of possible 'ReadArgs()' loops needed(2 max).
This argument can be NULL.
ttname - Filename of object from which comment or
tooltypes will be read. If this arg. is NULL
then -this- binary will be the source.
envname - Filename of the file that holds arguments. If
this argument is NULL or file referenced cant
be opened then 'ttname' will be utilised.
RETURNS
Function returns pointer to a cooked 'RDArgs' or NULL
on error.
BASES
SysBase, DOSBase, IconBase
NOTES
This func. offers a way of creating preferences based
on existing argument set. Main advantage is however
possiblity to self-contain prefs in binary file by
using its tooltypes(if an icon is available) or
comment field. Aside from that external configuration
file can be used.
Please note that 'envname' has priority over the
tooltypes/comment field(if it does exist)!
Standard AmigaDOS comments are supported both in the
comment and in file. In case of file you can organise
arguments line by line.
Remember that file comments can be max 80 bytes long!
SEE ALSO
nfo_freeargsource()
EXAMPLE
...
struct RDArgs *rda[2] = {0, 0};
struct RDArgs *rdi;
void *rdiptr;
LONG loops;
LONG argv[1];
rdi = nfo_getargsource(&loops, NULL, NULL);
rdiptr = rdi;
argv[0] = 0;
while(loops--)
{
rda[loops] = ReadArgs("MYARG", argv, rdiptr);
rdiptr = NULL;
}
Flush(Input());
if ((rda[0]) || (rda[1]))
{
...
if (rda[0])
{
FreeArgs(rda[0]);
}
if (rda[1])
{
FreeArgs(rda[1]);
}
}
if (rdi)
{
nfo_freeargsource(rdi);
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |