32 ,
const char *delim,
int *line_nr)
53 if (*token == NULL || *limit == 0)
56 }
else if (*token == NULL) {
61 }
else if (*limit == 0)
72 while ((c = getc(f)) != EOF) {
75 if (c ==
'(' && prev_c !=
'\\' && !quoted) {
84 if (c ==
')' && prev_c !=
'\\' && !quoted) {
101 if (c ==
';' && quoted == 0) {
102 if (prev_c !=
'\\') {
106 if (c ==
'\"' && com == 0 && prev_c !=
'\\') {
110 if (c ==
'\n' && com != 0) {
115 *line_nr = *line_nr + 1;
117 if (p == 0 && i > 0) {
131 if (c ==
'\n' && p != 0 && t > *token) {
134 *line_nr = *line_nr + 1;
137 && (i >= *limit || (
size_t)(t - *token) >= *limit)) {
145 if (*token == NULL) {
150 if (*token != old_token)
151 t = *token + (t - old_token);
159 for (d = del; *d; d++) {
160 if (c == *d && i > 0 && prev_c !=
'\\' && p == 0) {
161 if (c ==
'\n' && line_nr) {
162 *line_nr = *line_nr + 1;
167 if (c !=
'\0' && c !=
'\n') {
171 && (i >= *limit || (
size_t)(t - *token) >= *limit)) {
179 if (*token == NULL) {
184 if (*token != old_token)
185 t = *token + (t - old_token);
187 if (c !=
'\0' && c !=
'\n') {
190 if (c ==
'\n' && line_nr) {
191 *line_nr = *line_nr + 1;
193 if (c ==
'\\' && prev_c ==
'\\')
227 return (ssize_t)strlen(token);
232 const char *d_del,
size_t data_limit)
240 const char *d_del,
size_t data_limit,
int *line_nr)
305 if (c ==
'(' && lc !=
'\\' && !quoted) {
314 if (c ==
')' && lc !=
'\\' && !quoted) {
330 if (c ==
';' && quoted == 0) {
335 if (c ==
'"' && com == 0 && lc !=
'\\') {
339 if (c ==
'\n' && com != 0) {
353 if (c ==
'\n' && p != 0) {
361 for (d = del; *d; d++) {
362 if (c == *d && lc !=
'\\' && p == 0) {
368 if (limit > 0 && (i >= limit || (
size_t)(t-token) >= limit)) {
374 if (c ==
'\\' && lc ==
'\\') {
410 while(ldns_buffer_available_at(buffer, buffer->
_position,
sizeof(
char))) {
411 c = (char) ldns_buffer_read_u8_at(buffer, buffer->
_position);
413 for (d = s; *d; d++) {
439 while ((c = fgetc(fp)) != EOF) {
440 if (line_nr && c ==
'\n') {
441 *line_nr = *line_nr + 1;
444 for (d = s; *d; d++) {
459 *data,
const char *d_del,
size_t data_limit)
478 if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) {
int ldns_bgetc(ldns_buffer *buffer)
returns the next character from a buffer.
@ LDNS_STATUS_SYNTAX_EMPTY
enum ldns_enum_status ldns_status
Including this file will include all ldns files, and define some lookup tables.
ssize_t ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr)
returns a token/char from the stream F.
ldns_lookup_table ldns_directive_types[]
ssize_t ldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit)
ssize_t ldns_bget_keyword_data(ldns_buffer *b, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit)
ssize_t ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit)
returns a token/char from the stream F.
ldns_status ldns_fget_token_l_st(FILE *f, char **token, size_t *limit, bool fixed, const char *delim, int *line_nr)
returns a token/char from the stream f.
void ldns_fskipcs(FILE *fp, const char *s)
skips all of the characters in the given string in the fp, moving the position to the first character...
void ldns_bskipcs(ldns_buffer *buffer, const char *s)
skips all of the characters in the given string in the buffer, moving the position to the first chara...
void ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr)
skips all of the characters in the given string in the fp, moving the position to the first character...
ssize_t ldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit, int *line_nr)
ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit)
returns a token/char from the buffer b.
#define LDNS_MAX_KEYWORDLEN
#define LDNS_PARSE_NORMAL
implementation of buffers to ease operations
size_t _position
The current position used for reading/writing.
size_t _limit
The read/write limit.
A general purpose lookup table.
#define LDNS_XMALLOC(type, count)
#define LDNS_XREALLOC(ptr, type, count)