| T X T _ I N I P A R S E ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English INDEP - TXT_#?
----------------------------------------------------------------------------
NAME
txt_iniparse() - Tries to parse an INI-style line.
SYNOPSIS
success = txt_iniparse(string, sepchr, ini, flags);
BOOL txt_iniparse(
UBYTE *, LONG, struct txt_ipe_form *, LONG);
FUNCTION
This function parses given string in such a way that the
"key" and "data" get separated and can be then inspected.
INPUTS
string - NULL terminated string of "key = data" form.
sepchr - Separator character, '=' for INI style line.
ini - Parser structre from which "key" and "data" can
be read.
flags - Parser ctrl flags. These are QDEV_TXT_NC_F_#?.
RETURNS
Function returns TRUE if parser was successful and FALSE
if it wasnt.
BASES
None.
NOTES
Function structure is described in the header file.
Function uses 'txt_nocomment()' as its engine and thus
its flagset is accepted. Parser direction flags have no
impact on this routine!
Please note, this function does not allocate any memory
for "key" and "data", so if you process public data then
always remeber to terminate it after you are done. It is
not necessary to terminate the data if next buffer fill
will wipe the data anyway.
Macro that wraps this function accepts flags as varargs,
so effectively you need not to pass them when no special
requirements.
SEE ALSO
EXAMPLE
...
UBYTE *data = "\tTypeOfLaugh = lol # Can be one of these:"
" haha, lol, lmao or rotfl";
QDEV_TXT_INIPARSETYPE(ini);
if ((QDEV_TXT_INIPARSEINIT(data, '=', ini)))
{
FPrintf(Output(), "Key: %s\nData: %s\n",
(LONG)ini.ini_key,
(LONG)ini.ini_data);
QDEV_TXT_INIPARSETERM(ini);
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |