37 #include <ldns/ldns.h>
39 static const char* adapter_str =
"adapter";
49 ldns_rr *cur_rr = NULL;
51 ldns_status status = LDNS_STATUS_OK;
55 while (line_len >= 0) {
61 status = ldns_rr_new_frm_str(&cur_rr, line, 0, NULL, NULL);
62 if (status == LDNS_STATUS_OK) {
63 if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) {
96 while (c != EOF && c !=
'\n') {
103 ods_log_error(
"[%s] read line: bracket mismatch discovered at "
104 "line %i, missing ')'", adapter_str, l&&*l?*l:0);
112 }
else if (c ==
'"' && lc !=
'\\') {
113 in_string = 1 - in_string;
116 }
else if (c ==
'(') {
120 }
else if (lc !=
'\\') {
128 }
else if (c ==
')') {
132 }
else if (lc !=
'\\') {
135 "discovered at line %i, missing '('", adapter_str,
147 }
else if (c ==
';') {
151 }
else if (lc !=
'\\' && !keep_comments) {
157 }
else if (c ==
'\n' && lc !=
'\\') {
175 ods_log_error(
"[%s] read line: bracket mismatch discovered at line %i,"
176 " missing ')'", adapter_str, l&&*l?*l:0);
191 int i = strlen(line), nl = 0;
196 if (line[i] ==
'\n') {
199 if (line[i] ==
' ' || line[i] ==
'\t' || line[i] ==
'\n') {
209 *line_len -= trimmed;
222 for (i = 0; i < line_len; i++) {
223 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)