This patch helps to compile larbin-cvs-20031230 (ca. Version 2.6.4) to compile on Mac OS X.3 "Panther". Since 10.3 comes with poll the patch is much more simple as the patch to port larbin 2.6.3 to OSX 10.2. The only thing needed fixing where some name clashes, a C macro hack not working on the mac and a missing include. --md@hudora.de diff -rubB larbin-orig/Makefile larbin/Makefile --- larbin-orig/Makefile Tue Dec 30 10:10:01 2003 +++ larbin/Makefile Wed Dec 31 13:48:31 2003 @@ -6,10 +6,13 @@ dep: (cd src; $(MAKE) dep) -all debug prof: - (cd adns; $(MAKE)) +all debug prof: libadns (cd src; $(MAKE) $@) cp src/larbin . + +libadns: + (cd adns; $(MAKE); ranlib libadns.a ) + clean: cleanhere (cd src; $(MAKE) clean) diff -rubB larbin-orig/adns/dlist.h larbin/adns/dlist.h --- larbin-orig/adns/dlist.h Tue Dec 30 10:10:01 2003 +++ larbin/adns/dlist.h Wed Dec 31 14:27:16 2003 @@ -28,10 +28,10 @@ #ifndef ADNS_DLIST_H_INCLUDED #define ADNS_DLIST_H_INCLUDED -#define LIST_INIT(list) ((list).head= (list).tail= 0) -#define LINK_INIT(link) ((link).next= (link).back= 0) +#define ADNS_DLIST_INIT(list) ((list).head= (list).tail= 0) +#define ADNS_DLIST_LINK_INIT(link) ((link).next= (link).back= 0) -#define LIST_UNLINK_PART(list,node,part) \ +#define ADNS_DLIST_UNLINK_PART(list,node,part) \ do { \ if ((node)->part back) (node)->part back->part next= (node)->part next; \ else (list).head= (node)->part next; \ @@ -39,7 +39,7 @@ else (list).tail= (node)->part back; \ } while(0) -#define LIST_LINK_TAIL_PART(list,node,part) \ +#define ADNS_DLIST_LINK_TAIL_PART(list,node,part) \ do { \ (node)->part next= 0; \ (node)->part back= (list).tail; \ @@ -47,7 +47,21 @@ (list).tail= (node); \ } while(0) -#define LIST_UNLINK(list,node) LIST_UNLINK_PART(list,node,) -#define LIST_LINK_TAIL(list,node) LIST_LINK_TAIL_PART(list,node,) +#define ADNS_DLIST_UNLINK(list,node) \ + do { \ + if ((node)-> back) (node)-> back-> next= (node)-> next; \ + else (list).head= (node)-> next; \ + if ((node)-> next) (node)-> next-> back= (node)-> back; \ + else (list).tail= (node)-> back; \ + } while(0) + + +#define ADNS_DLIST_LINK_TAIL(list,node) \ + do { \ + (node)-> next= 0; \ + (node)-> back= (list).tail; \ + if ((list).tail) (list).tail-> next= (node); else (list).head= (node); \ + (list).tail= (node); \ + } while(0) #endif diff -rubB larbin-orig/adns/event.c larbin/adns/event.c --- larbin-orig/adns/event.c Tue Dec 30 10:10:01 2003 +++ larbin/adns/event.c Wed Dec 31 14:25:51 2003 @@ -204,7 +204,7 @@ inter_maxtoabs(tv_io,tvbuf,now,qu->timeout); } else { if (!act) { inter_immed(tv_io,tvbuf); return; } - LIST_UNLINK(*queue,qu); + ADNS_DLIST_UNLINK(*queue,qu); if (qu->state != query_tosend) { adns__query_fail(qu,adns_s_timeout); } else { @@ -228,7 +228,7 @@ nqu= qu->next; assert(qu->state == query_tcpw); if (qu->retries > ads->nservers) { - LIST_UNLINK(ads->tcpw,qu); + ADNS_DLIST_UNLINK(ads->tcpw,qu); adns__query_fail(qu,adns_s_allservfail); } } @@ -666,7 +666,7 @@ } else { if (qu->id>=0) return EAGAIN; } - LIST_UNLINK(ads->output,qu); + ADNS_DLIST_UNLINK(ads->output,qu); *answer= qu->answer; if (context_r) *context_r= qu->ctx.ext; *query_io= qu; diff -rubB larbin-orig/adns/query.c larbin/adns/query.c --- larbin-orig/adns/query.c Tue Dec 30 10:10:01 2003 +++ larbin/adns/query.c Wed Dec 31 14:25:51 2003 @@ -48,9 +48,9 @@ qu->ads= ads; qu->state= query_tosend; qu->back= qu->next= qu->parent= 0; - LIST_INIT(qu->children); - LINK_INIT(qu->siblings); - LIST_INIT(qu->allocations); + ADNS_DLIST_INIT(qu->children); + ADNS_DLIST_LINK_INIT(qu->siblings); + ADNS_DLIST_INIT(qu->allocations); qu->interim_allocd= 0; qu->preserved_allocd= 0; qu->final_allocspace= 0; @@ -334,7 +334,7 @@ assert(!qu->final_allocspace); an= malloc(MEM_ROUND(MEM_ROUND(sizeof(*an)) + sz)); if (!an) return 0; - LIST_LINK_TAIL(qu->allocations,an); + ADNS_DLIST_LINK_TAIL(qu->allocations,an); return (byte*)an + MEM_ROUND(sizeof(*an)); } @@ -371,8 +371,8 @@ assert(!to->final_allocspace); assert(!from->final_allocspace); - LIST_UNLINK(from->allocations,an); - LIST_LINK_TAIL(to->allocations,an); + ADNS_DLIST_UNLINK(from->allocations,an); + ADNS_DLIST_LINK_TAIL(to->allocations,an); sz= MEM_ROUND(sz); from->interim_allocd -= sz; @@ -419,7 +419,7 @@ cancel_children(qu); for (an= qu->allocations.head; an; an= ann) { ann= an->next; free(an); } - LIST_INIT(qu->allocations); + ADNS_DLIST_INIT(qu->allocations); adns__vbuf_free(&qu->vb); adns__vbuf_free(&qu->search_vb); free(qu->query_dgram); @@ -431,19 +431,19 @@ ads= qu->ads; adns__consistency(ads,qu,cc_entex); - if (qu->parent) LIST_UNLINK_PART(qu->parent->children,qu,siblings.); + if (qu->parent) ADNS_DLIST_UNLINK_PART(qu->parent->children,qu,siblings.); switch (qu->state) { case query_tosend: - LIST_UNLINK(ads->udpw,qu); + ADNS_DLIST_UNLINK(ads->udpw,qu); break; case query_tcpw: - LIST_UNLINK(ads->tcpw,qu); + ADNS_DLIST_UNLINK(ads->tcpw,qu); break; case query_childw: - LIST_UNLINK(ads->childw,qu); + ADNS_DLIST_UNLINK(ads->childw,qu); break; case query_done: - LIST_UNLINK(ads->output,qu); + ADNS_DLIST_UNLINK(ads->output,qu); break; default: abort(); @@ -530,15 +530,15 @@ ans->expires= qu->expires; parent= qu->parent; if (parent) { - LIST_UNLINK_PART(parent->children,qu,siblings.); - LIST_UNLINK(qu->ads->childw,parent); + ADNS_DLIST_UNLINK_PART(parent->children,qu,siblings.); + ADNS_DLIST_UNLINK(qu->ads->childw,parent); qu->ctx.callback(parent,qu); free_query_allocs(qu); free(qu->answer); free(qu); } else { makefinal_query(qu); - LIST_LINK_TAIL(qu->ads->output,qu); + ADNS_DLIST_LINK_TAIL(qu->ads->output,qu); qu->state= query_done; } } diff -rubB larbin-orig/adns/reply.c larbin/adns/reply.c --- larbin-orig/adns/reply.c Tue Dec 30 10:10:01 2003 +++ larbin/adns/reply.c Wed Dec 31 14:25:51 2003 @@ -100,8 +100,8 @@ } if (qu) { /* We're definitely going to do something with this query now */ - if (viatcp) LIST_UNLINK(ads->tcpw,qu); - else LIST_UNLINK(ads->udpw,qu); + if (viatcp) ADNS_DLIST_UNLINK(ads->tcpw,qu); + else ADNS_DLIST_UNLINK(ads->udpw,qu); } } @@ -333,7 +333,7 @@ /* This may have generated some child queries ... */ if (qu->children.head) { qu->state= query_childw; - LIST_LINK_TAIL(ads->childw,qu); + ADNS_DLIST_LINK_TAIL(ads->childw,qu); return; } adns__query_done(qu); diff -rubB larbin-orig/adns/setup.c larbin/adns/setup.c --- larbin-orig/adns/setup.c Tue Dec 30 10:10:01 2003 +++ larbin/adns/setup.c Wed Dec 31 14:25:51 2003 @@ -467,10 +467,10 @@ ads->iflags= flags; ads->diagfile= diagfile; ads->configerrno= 0; - LIST_INIT(ads->udpw); - LIST_INIT(ads->tcpw); - LIST_INIT(ads->childw); - LIST_INIT(ads->output); + ADNS_DLIST_INIT(ads->udpw); + ADNS_DLIST_INIT(ads->tcpw); + ADNS_DLIST_INIT(ads->childw); + ADNS_DLIST_INIT(ads->output); ads->forallnext= 0; ads->nextid= 0x311f; ads->udpsocket= ads->tcpsocket= -1; diff -rubB larbin-orig/adns/transmit.c larbin/adns/transmit.c --- larbin-orig/adns/transmit.c Tue Dec 30 10:10:01 2003 +++ larbin/adns/transmit.c Wed Dec 31 14:25:51 2003 @@ -216,7 +216,7 @@ qu->state= query_tcpw; qu->timeout= now; timevaladd(&qu->timeout,TCPWAITMS); - LIST_LINK_TAIL(qu->ads->tcpw,qu); + ADNS_DLIST_LINK_TAIL(qu->ads->tcpw,qu); adns__querysend_tcp(qu,now); adns__tcp_tryconnect(qu->ads,now); } @@ -255,5 +255,5 @@ qu->udpsent |= (1<udpnextserver= (serv+1)%ads->nservers; qu->retries++; - LIST_LINK_TAIL(ads->udpw,qu); + ADNS_DLIST_LINK_TAIL(ads->udpw,qu); } diff -rubB larbin-orig/adns/types.c larbin/adns/types.c --- larbin-orig/adns/types.c Tue Dec 30 10:10:01 2003 +++ larbin/adns/types.c Wed Dec 31 14:25:51 2003 @@ -449,7 +449,7 @@ adns__transfer_interim(child, parent, rrp->addrs, rrp->naddrs*sizeof(adns_rr_addr)); if (parent->children.head) { - LIST_LINK_TAIL(ads->childw,parent); + ADNS_DLIST_LINK_TAIL(ads->childw,parent); } else { adns__query_done(parent); } @@ -501,7 +501,7 @@ if (st) return st; nqu->parent= pai->qu; - LIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.); + ADNS_DLIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.); return adns_s_ok; } @@ -704,7 +704,7 @@ adns__query_done(parent); return; } else { - LIST_LINK_TAIL(ads->childw,parent); + ADNS_DLIST_LINK_TAIL(ads->childw,parent); return; } } @@ -776,7 +776,7 @@ if (st) return st; nqu->parent= pai->qu; - LIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.); + ADNS_DLIST_LINK_TAIL_PART(pai->qu->children,nqu,siblings.); return adns_s_ok; } diff -rubB larbin-orig/src/utils/url.h larbin/src/utils/url.h --- larbin-orig/src/utils/url.h Tue Dec 30 10:10:01 2003 +++ larbin/src/utils/url.h Tue Dec 30 22:51:05 2003 @@ -11,6 +11,7 @@ #include #include #include +#include #include "types.h"