#include "xdas_util.h"
#include <malloc.h>
#include <string.h>
Go to the source code of this file.
Defines | |
#define | FLD_DELIMS ":" |
#define | ESC_CHAR '%' |
Functions | |
static char * | xdas_strdup (const char *sp, const char *limit) |
Similar to the C standard library function strdup, except with a limit. | |
static char * | xdas_tokenize (char *str, const char *delims, char esc, char **nextok) |
Similar to the C standard library function strtok. | |
int | xdas_parse_info (const char *info, const char *limit, char **fields, unsigned maxflds) |
Parse colon separated fields into supplied field buffers. |
Definition in file xdas_util.c.
#define ESC_CHAR '%' |
Referenced by xdas_parse_info().
#define FLD_DELIMS ":" |
Referenced by xdas_parse_info().
static char* xdas_strdup | ( | const char * | sp, | |
const char * | limit | |||
) | [static] |
Similar to the C standard library function strdup, except with a limit.
This version of strdup allows for a limit on the input buffer in case the buffer isn't null-terminated. Pass zero for limit
if sp
is null terminated.
[in] | str | - the string to be parsed - should be NULL each time after the first. |
[in] | delims | - the set of token delimiters to be used. |
[in] | esc | - the escape character for delimiters. |
[in,out] | nextok | - context for the search - used internally. |
For internal use only.
Definition at line 63 of file xdas_util.c.
References malloc.
Referenced by xdas_parse_info().
static char* xdas_tokenize | ( | char * | str, | |
const char * | delims, | |||
char | esc, | |||
char ** | nextok | |||
) | [static] |
Similar to the C standard library function strtok.
This version of strtok is recursive, accepts an escape character for delimiters (skipping any escaped delimiters) and returns empty fields as zero-length strings when present.
[in] | str | - the string to be parsed - should be NULL each time after the first. |
[in] | delims | - the set of token delimiters to be used. |
[in] | esc | - the escape character for delimiters. |
[in,out] | nextok | - context for the search - used internally. |
For internal use only.
Definition at line 91 of file xdas_util.c.
Referenced by xdas_parse_info().