35 ldns_fget_token_l_st_file_type(FILE *f,
char **token,
size_t *limit,
36 bool fixed,
const char *delim,
int *line_nr,
58 if (*token == NULL || *limit == 0)
61 }
else if (*token == NULL) {
66 }
else if (*limit == 0)
77 while ((c = getc(f)) != EOF) {
80 if (c ==
'(' && prev_c !=
'\\' && !quoted) {
89 if (c ==
')' && prev_c !=
'\\' && !quoted) {
109 if (prev_c !=
'\\') {
113 if (c ==
'\"' && com == 0 && prev_c !=
'\\') {
117 if (c ==
'\n' && com != 0) {
122 *line_nr = *line_nr + 1;
124 if (p == 0 && i > 0) {
138 if (c ==
'\n' && p != 0 && t > *token) {
141 *line_nr = *line_nr + 1;
144 && (i >= *limit || (
size_t)(t - *token) >= *limit)) {
152 if (*token == NULL) {
157 if (*token != old_token)
158 t = *token + (t - old_token);
166 for (d = del; *d; d++) {
167 if (c == *d && i > 0 && prev_c !=
'\\' && p == 0) {
168 if (c ==
'\n' && line_nr) {
169 *line_nr = *line_nr + 1;
174 if (c !=
'\0' && c !=
'\n') {
178 && (i >= *limit || (
size_t)(t - *token) >= *limit)) {
186 if (*token == NULL) {
191 if (*token != old_token)
192 t = *token + (t - old_token);
194 if (c !=
'\0' && c !=
'\n') {
197 if (c ==
'\n' && line_nr) {
198 *line_nr = *line_nr + 1;
200 if (c ==
'\\' && prev_c ==
'\\')
227 ,
const char *delim,
int *line_nr)
229 return ldns_fget_token_l_st_file_type(
235 size_t limit,
int *line_nr)
239 if (ldns_fget_token_l_st_file_type(f, &token, &limit,
true, delim,
243 return (ssize_t)strlen(token);
254 return (ssize_t)strlen(token);
259 const char *d_del,
size_t data_limit)
267 const char *d_del,
size_t data_limit,
int *line_nr)
332 if (c ==
'(' && lc !=
'\\' && !quoted) {
341 if (c ==
')' && lc !=
'\\' && !quoted) {
357 if (c ==
';' && quoted == 0) {
362 if (c ==
'"' && com == 0 && lc !=
'\\') {
366 if (c ==
'\n' && com != 0) {
380 if (c ==
'\n' && p != 0) {
388 for (d = del; *d; d++) {
389 if (c == *d && lc !=
'\\' && p == 0) {
395 if (limit > 0 && (i >= limit || (
size_t)(t-token) >= limit)) {
401 if (c ==
'\\' && lc ==
'\\') {
437 while(ldns_buffer_available_at(buffer, buffer->
_position,
sizeof(
char))) {
438 c = (char) ldns_buffer_read_u8_at(buffer, buffer->
_position);
440 for (d = s; *d; d++) {
466 while ((c = fgetc(fp)) != EOF) {
467 if (line_nr && c ==
'\n') {
468 *line_nr = *line_nr + 1;
471 for (d = s; *d; d++) {
486 *data,
const char *d_del,
size_t data_limit)
505 if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) {
@ 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.
ssize_t ldns_fget_token_l_resolv_conf(FILE *f, char *token, const char *delim, size_t limit, int *line_nr)
returns a token/char from the stream F.
ldns_status ldns_fget_token_l_st(FILE *f, char **token, size_t *limit, signed char fixed, const char *delim, 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.
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
int ldns_bgetc(ldns_buffer *buffer)
returns the next character from a buffer.
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)