Debug send
command parser utilities.
More...
|
#define | IFS " \t\n" |
| Internal field separator (i.e. whitespace delimiter)
|
|
#define | SET_OCT "01234567" |
| Octal digit character set.
|
|
#define | SET_DEC "0123456789" |
| Decimal digit character set.
|
|
#define | SET_HEX SET_DEC "abcdefABCDEF" |
| Hexadecimal digit character set.
|
|
#define | SET_HEX_STR SET_HEX ":" |
| (Hexadecimal) byte string character set
|
|
|
char * | consume_token (char *token, const char *ifs) |
| modify token to point to the first token when broken up on ifs and return the remaining data
|
|
int | strtodata (const char *str, char **data, size_t *size) |
| convert string with literals into raw data
|
|
◆ consume_token()
char * consume_token |
( |
char * | token, |
|
|
const char * | ifs ) |
token
will be null-terminated to indicate the end of the first token. A pointer to the remaining line after the NULL byte is returned, or NULL when the end of the string has been reached.
- Parameters
-
token | input string |
ifs | string containing field separators |
- Returns
- the remaining data after
token
and the first ifs
◆ strtodata()
int strtodata |
( |
const char * | str, |
|
|
char ** | data, |
|
|
size_t * | size ) |
- Parameters
-
str | input string containing literals |
data | pointer to char* that will store the resulting data |
size | size of data |
- Returns
- 0 or a negative integer representing the index where there is a syntax error if there was an error, or a positive integer representing the amount of bytes parsed from
str
- Note
- The pointer that
data
refers to will not be initialized by this function if parsing fails