Tou
Tou header library
Loading...
Searching...
No Matches
Parsers & Converters

Functions

tou_llist_ttou_paramparse (char *str, const char *param_sep, const char *keyval_sep)
 Parses "parameter string" and returns a llist of key-value pairs, looking at the whole string (strlen will be used)
 
tou_llist_ttou_paramparse_n (char *str, const char *param_sep, const char *keyval_sep, size_t maxlen)
 Parses "parameter string" and returns a llist of key-value pairs.
 
void tou_paramprint (tou_llist_t *params)
 Attempts to print "params" parsed by tou_paramparse or tou_paramparse_n.
 

Detailed Description

Function Documentation

◆ tou_paramparse()

tou_llist_t * tou_paramparse ( char * str,
const char * param_sep,
const char * keyval_sep )

Parses "parameter string" and returns a llist of key-value pairs, looking at the whole string (strlen will be used)

Extra whitespaces are ignored and pairs may be key-only (values may be empty).

Example: 5 adjust abc= def 123=456 Is returned as llist where elements are: {{"5", NULL}, {"adjust", NULL}, {"abc", "def"}, {"123", "456"}}

Parameters
[in]strPointer to parse
[in]param_sepString used to split pairs
[in]keyval_sepString used to split key-value pairs
Returns
Pairs in llist

◆ tou_paramparse_n()

tou_llist_t * tou_paramparse_n ( char * str,
const char * param_sep,
const char * keyval_sep,
size_t maxlen )

Parses "parameter string" and returns a llist of key-value pairs.

Extra whitespaces are ignored and pairs may be key-only (values may be empty).

Example: 5 adjust abc= def 123=456 Is returned as llist where elements are: {{"5", NULL}, {"adjust", NULL}, {"abc", "def"}, {"123", "456"}}

Parameters
[in]strPointer to parse
[in]param_sepString used to split pairs
[in]keyval_sepString used to split key-value pairs
[in]maxlenLooks only at the first maxlen characters in str
Returns
Pairs in llist

◆ tou_paramprint()

void tou_paramprint ( tou_llist_t * params)

Attempts to print "params" parsed by tou_paramparse or tou_paramparse_n.

Parameters
[in]paramsList containing params