39 #include <ldns/ldns.h>
41 static const char* adapter_str =
"adapter";
51 ldns_rr *cur_rr = NULL;
53 ldns_status status = LDNS_STATUS_OK;
57 while (line_len >= 0) {
63 status = ldns_rr_new_frm_str(&cur_rr, line, 0, NULL, NULL);
64 if (status == LDNS_STATUS_OK) {
65 if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) {
98 while (c != EOF && c !=
'\n') {
105 ods_log_error(
"[%s] read line: bracket mismatch discovered at "
106 "line %i, missing ')'", adapter_str, l&&*l?*l:0);
114 }
else if (c ==
'"' && lc !=
'\\') {
115 in_string = 1 - in_string;
118 }
else if (c ==
'(') {
122 }
else if (lc !=
'\\') {
130 }
else if (c ==
')') {
134 }
else if (lc !=
'\\') {
137 "discovered at line %i, missing '('", adapter_str,
149 }
else if (c ==
';') {
153 }
else if (lc !=
'\\' && !keep_comments) {
159 }
else if (c ==
'\n' && lc !=
'\\') {
167 }
else if (c ==
'\t' && lc !=
'\\') {
180 ods_log_error(
"[%s] read line: bracket mismatch discovered at line %i,"
181 " missing ')'", adapter_str, l&&*l?*l:0);
196 int i = strlen(line), nl = 0;
201 if (line[i] ==
'\n') {
204 if (line[i] ==
' ' || line[i] ==
'\t' || line[i] ==
'\n') {
214 *line_len -= trimmed;
227 for (i = 0; i < line_len; i++) {
228 if (!isspace((
int)line[i])) {
ldns_rr * adutil_lookup_soa_rr(FILE *fd)
void ods_log_error(const char *format,...)
int ods_fgetc(FILE *fd, unsigned int *line_nr)
int adutil_whitespace_line(char *line, int line_len)
void adutil_rtrim_line(char *line, int *line_len)
#define SE_ADFILE_MAXLINE
int adutil_readline_frm_file(FILE *fd, char *line, unsigned int *l, int keep_comments)