From c2d5e01042267b6f4c4a98aa0a6db857fec0fc2a Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 6 Jun 2012 02:17:48 +0200 Subject: [PATCH] endianness compile fixes --- commands/ftp101/net.c | 8 +++----- commands/nonamed/nonamed.c | 13 ++++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/commands/ftp101/net.c b/commands/ftp101/net.c index e3f2f5713..9e6cab7b4 100644 --- a/commands/ftp101/net.c +++ b/commands/ftp101/net.c @@ -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 diff --git a/commands/nonamed/nonamed.c b/commands/nonamed/nonamed.c index 39feae121..5448d1562 100644 --- a/commands/nonamed/nonamed.c +++ b/commands/nonamed/nonamed.c @@ -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", -- 2.44.0