endianness compile fixes

This commit is contained in:
Ben Gras 2012-06-06 02:17:48 +02:00
parent 910a0e1093
commit c2d5e01042
2 changed files with 11 additions and 10 deletions

View file

@ -210,11 +210,7 @@ static int ftpdata_fd = -1;
char *buff;
ipaddr_t ripaddr;
tcpport_t rport;
#ifdef __NBSD_LIBC
static tcpport_t lport = htons(0xF000);
#else
static tcpport_t lport = HTONS(0xF000);
#endif
static tcpport_t lport;
int s;
int i;
int wpid;
@ -224,6 +220,8 @@ char dummy;
char port[32];
int wasopen;
lport = htons(0xF000);
#ifdef DEBUG
printf("DOdata %s %s %d %d\n", datacom, file, direction, fd);
#endif

View file

@ -921,9 +921,11 @@ static int query_hosts(u8_t *qname, unsigned type, dns_t *dp, size_t *pdlen)
unsigned ancount;
struct hostent localhost;
static char *noaliases[]= { nil };
static ipaddr_t localaddr= HTONL(LOCALHOST);
static ipaddr_t localaddr;
static char *localaddrlist[]= { (char *) &localaddr, nil };
localaddr = HTONL(LOCALHOST);
if (single) return 0;
/* Assume we can answer. */
@ -967,8 +969,9 @@ static int query_hosts(u8_t *qname, unsigned type, dns_t *dp, size_t *pdlen)
sethostent(0);
do {
switch (type) {
case HTONS(T_A):
int type_host = NTOHS(type);
switch (type_host) {
case T_A:
if (namecmp(qname, he->h_name) == 0) {
addA:
r= dn_comp((u8_t *) he->h_name, cp, arraylimit(dns.data) - cp,
@ -991,7 +994,7 @@ static int query_hosts(u8_t *qname, unsigned type, dns_t *dp, size_t *pdlen)
break;
}
/*FALL THROUGH*/
case HTONS(T_CNAME):
case T_CNAME:
domain= namechr(he->h_name, '.');
for (i= 0; he->h_aliases[i] != nil; i++) {
namecpy(name, he->h_aliases[i]);
@ -1025,7 +1028,7 @@ static int query_hosts(u8_t *qname, unsigned type, dns_t *dp, size_t *pdlen)
}
}
break;
case HTONS(T_PTR):
case T_PTR:
if (ancount > 0) break;
if (he->h_name[0] == '%') break;
sprintf((char *) name, "%d.%d.%d.%d.in-addr.arpa",