58 while ((c = getc(f)) != EOF) {
61 if (c ==
'(' && prev_c !=
'\\' && !quoted) {
70 if (c ==
')' && prev_c !=
'\\' && !quoted) {
86 if (c ==
';' && quoted == 0) {
91 if (c ==
'\"' && com == 0 && prev_c !=
'\\') {
95 if (c ==
'\n' && com != 0) {
100 *line_nr = *line_nr + 1;
102 if (p == 0 && i > 0) {
116 if (c ==
'\n' && p != 0 && t > token) {
119 *line_nr = *line_nr + 1;
127 for (d = del; *d; d++) {
128 if (c == *d && i > 0 && prev_c !=
'\\' && p == 0) {
129 if (c ==
'\n' && line_nr) {
130 *line_nr = *line_nr + 1;
135 if (c !=
'\0' && c !=
'\n') {
138 if (limit > 0 && (i >= limit || (
size_t)(t-token) >= limit)) {
142 if (c !=
'\0' && c !=
'\n') {
145 if (c ==
'\\' && prev_c ==
'\\')
177 const char *d_del,
size_t data_limit)
185 const char *d_del,
size_t data_limit,
int *line_nr)
250 if (c ==
'(' && lc !=
'\\' && !quoted) {
259 if (c ==
')' && lc !=
'\\' && !quoted) {
275 if (c ==
';' && quoted == 0) {
280 if (c ==
'"' && com == 0 && lc !=
'\\') {
284 if (c ==
'\n' && com != 0) {
298 if (c ==
'\n' && p != 0) {
306 for (d = del; *d; d++) {
307 if (c == *d && lc !=
'\\' && p == 0) {
313 if (limit > 0 && (i >= limit || (
size_t)(t-token) >= limit)) {
319 if (c ==
'\\' && lc ==
'\\') {
355 while(ldns_buffer_available_at(buffer, buffer->
_position,
sizeof(
char))) {
356 c = (char) ldns_buffer_read_u8_at(buffer, buffer->
_position);
358 for (d = s; *d; d++) {
384 while ((c = fgetc(fp)) != EOF) {
385 if (line_nr && c ==
'\n') {
386 *line_nr = *line_nr + 1;
389 for (d = s; *d; d++) {
404 *data,
const char *d_del,
size_t data_limit)
423 if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) {
implementation of buffers to ease operations
#define LDNS_PARSE_NORMAL
#define LDNS_XMALLOC(type, count)
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)
size_t _limit
The read/write limit.
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...
ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit)
returns a token/char from the buffer b.
int ldns_bgetc(ldns_buffer *buffer)
returns the next character from a buffer.
ldns_lookup_table ldns_directive_types[]
Including this file will include all ldns files, and define some lookup tables.
#define LDNS_MAX_KEYWORDLEN
ssize_t ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit)
returns a token/char from the stream F.
size_t _position
The current position used for reading/writing.
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)
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...
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.
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)
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...
A general purpose lookup table.