#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
#include <netdb.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
#include "internal.h"
free(ads->searchlist);
ads->nsearchlist= count;
ads->searchlist= newptrs;
- /* fixme: actually pay attention */
}
static void ccf_sortlist(adns_state ads, const char *fn, int lno, const char *buf) {
continue;
}
- memcpy(tbuf,word,l);
+ memcpy(tbuf,word,l); tbuf[l]= 0;
slash= strchr(tbuf,'/');
if (slash) *slash++= 0;
}
static void ccf_options(adns_state ads, const char *fn, int lno, const char *buf) {
+ const char *word;
+ char *ep;
+ unsigned long v;
+ int l;
+
if (!buf) return;
- adns__diag(ads,-1,0,"warning - `options' ignored fixme");
+
+ while (nextword(&buf,&word,&l)) {
+ if (l==5 && !memcmp(word,"debug",5)) {
+ ads->iflags |= adns_if_debug;
+ continue;
+ }
+ if (l>=6 && !memcmp(word,"ndots:",6)) {
+ v= strtoul(word+6,&ep,10);
+ if (l==6 || ep != word+l || v > INT_MAX) {
+ configparseerr(ads,fn,lno,"option `%.*s' malformed or has bad value",l,word);
+ continue;
+ }
+ ads->searchndots= v;
+ continue;
+ }
+ adns__diag(ads,-1,0,"%s:%d: unknown option `%.*s'", fn,lno, l,word);
+ }
}
static void ccf_clearnss(adns_state ads, const char *fn, int lno, const char *buf) {
ads->nservers= ads->nsortlist= ads->nsearchlist= ads->tcpserver= 0;
ads->tcpstate= server_disconnected;
ads->searchlist= 0;
+ ads->searchndots= 1;
timerclear(&ads->tcptimeout);
*ads_r= ads;