Skip to content

Commit

Permalink
Removing obsolete _NBSD_LIBC define
Browse files Browse the repository at this point in the history
Change-Id: Ia6ce84ccdf36cf6f64540b990baaa7d85c53533d
  • Loading branch information
sambuc committed Feb 26, 2013
1 parent afa4fd5 commit f640210
Show file tree
Hide file tree
Showing 64 changed files with 15 additions and 605 deletions.
21 changes: 0 additions & 21 deletions commands/add_route/add_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,49 +179,28 @@ int main(int argc, char *argv[])
if (!(high_byte & 0x80)) /* class A or 0 */
{
if (destination)
#ifdef __NBSD_LIBC
defaultmask= htonl(0xff000000);
#else
defaultmask= HTONL(0xff000000);
#endif

}
else if (!(high_byte & 0x40)) /* class B */
{
#ifdef __NBSD_LIBC
defaultmask= htonl(0xffff0000);
#else
defaultmask= HTONL(0xffff0000);
#endif

}
else if (!(high_byte & 0x20)) /* class C */
{
#ifdef __NBSD_LIBC
defaultmask= htonl(0xffffff00);
#else
defaultmask= HTONL(0xffffff00);

#endif
}
else /* class D is multicast ... */
{
fprintf(stderr, "%s: Warning: Martian address '%s'\n",
prog_name, inet_ntoa(destination));
#ifdef __NBSD_LIBC
defaultmask= htonl(0xffffffff);
#else
defaultmask= HTONL(0xffffffff);
#endif
}
if (destination & ~defaultmask)
{
/* host route */
#ifdef __NBSD_LIBC
defaultmask= htonl(0xffffffff);
#else
defaultmask= HTONL(0xffffffff);
#endif
}
if (!cidr)
netmask= defaultmask;
Expand Down
2 changes: 1 addition & 1 deletion commands/ash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ CLEANFILES+=${GENSRCS} ${GENHDRS}
DPADD+= ${LIBL} ${LIBEDIT}
LDADD+= -ll -ledit

CPPFLAGS+= -DSHELL -D__NBSD_LIBC
CPPFLAGS+= -DSHELL
CPPFLAGS+=${EDIT} ${NO_PATHS_H} ${NO_JOBS}

CPPFLAGS+= -I. -I${.CURDIR}
Expand Down
15 changes: 0 additions & 15 deletions commands/dhcpd/dhcpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ static char *cachefile= PATH_DHCPCACHE;
static int qflag; /* True if printing cached DHCP data. */
static int aflag, rflag; /* True if adding or deleting pool addresses. */

#ifdef __NBSD_LIBC
#define BCAST_IP htonl(0xFFFFFFFFUL)
#else
#define BCAST_IP HTONL(0xFFFFFFFFUL)
#endif

/* We try to play with up to this many networks. */
#define N_NETS 32
Expand Down Expand Up @@ -108,24 +104,13 @@ network_t *if2net(int n)
static ipaddr_t defaultmask(ipaddr_t ip)
{
/* Compute netmask by the oldfashioned Class rules. */
#ifdef __NBSD_LIBC
if (B(&ip)[0] < 0x80) return htonl(0xFF000000UL); /* Class A. */
if (B(&ip)[0] < 0xC0) return htonl(0xFFFF0000UL); /* Class B. */
if (B(&ip)[0] < 0xE0) return htonl(0xFFFFFF00UL); /* Class C. */
return htonl(0xFFFFFFFFUL); /* Multicast? Shouldn't happen... */
#else
if (B(&ip)[0] < 0x80) return HTONL(0xFF000000UL); /* Class A. */
if (B(&ip)[0] < 0xC0) return HTONL(0xFFFF0000UL); /* Class B. */
if (B(&ip)[0] < 0xE0) return HTONL(0xFFFFFF00UL); /* Class C. */
return HTONL(0xFFFFFFFFUL); /* Multicast? Shouldn't happen... */
#endif
}

#ifdef __NBSD_LIBC
#define POOL_MAGIC htonl(0x81F85D00UL)
#else
#define POOL_MAGIC HTONL(0x81F85D00UL)
#endif

typedef struct pool { /* Dynamic pool entry. */
u32_t magic; /* Pool file magic number. */
Expand Down
38 changes: 1 addition & 37 deletions commands/dhcpd/ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@
#include "dhcpd.h"

static ether_addr_t BCAST_ETH = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }};
#ifdef __NBSD_LIBC
#define BCAST_IP htonl(0xFFFFFFFFUL)
#define LOCALHOST htonl(0x7F000001UL)
#else
#define BCAST_IP HTONL(0xFFFFFFFFUL)
#define LOCALHOST HTONL(0x7F000001UL)
#endif

static u16_t udp_cksum(ipaddr_t src, ipaddr_t dst, udp_hdr_t *udp)
{
Expand Down Expand Up @@ -69,21 +64,13 @@ void udp2ether(buf_t *bp, network_t *np)
/* Fill in the Ethernet, IP and UDP headers. */
bp->eth->eh_dst= BCAST_ETH;
bp->eth->eh_src= np->eth;
#ifdef __NBSD_LIBC
bp->eth->eh_proto= htons(ETH_IP_PROTO);
#else
bp->eth->eh_proto= HTONS(ETH_IP_PROTO);
#endif
bp->ip->ih_vers_ihl= 0x45;
bp->ip->ih_tos= 0;
bp->ip->ih_length= htons(sizeof(ip_hdr_t)
+ sizeof(udp_hdr_t) + udpio.uih_data_len);
bp->ip->ih_id= 0;
#ifdef __NBSD_LIBC
bp->ip->ih_flags_fragoff= ntohs(0x4000);
#else
bp->ip->ih_flags_fragoff= NTOHS(0x4000);
#endif
bp->ip->ih_ttl= IP_MAX_TTL;
bp->ip->ih_proto= IPPROTO_UDP;
bp->ip->ih_hdr_chk= 0;
Expand All @@ -104,11 +91,7 @@ int ether2udp(buf_t *bp)
*/
udp_io_hdr_t udpio;

#ifdef __NBSD_LIBC
if (bp->eth->eh_proto != htons(ETH_IP_PROTO)
#else
if (bp->eth->eh_proto != HTONS(ETH_IP_PROTO)
#endif
|| bp->ip->ih_vers_ihl != 0x45
|| bp->ip->ih_proto != IPPROTO_UDP
|| oneC_sum(0, bp->ip, 20) != (u16_t) ~0
Expand All @@ -135,17 +118,10 @@ void make_arp(buf_t *bp, network_t *np)
memset(arp, 0, sizeof(*arp));
arp->dstaddr= BCAST_ETH;
arp->srcaddr= np->eth;
#ifdef __NBSD_LIBC
arp->ethtype= htons(ETH_ARP_PROTO);
arp->hdr= htons(ARP_ETHERNET);
arp->pro= htons(ETH_IP_PROTO);
arp->op= htons(ARP_REQUEST);
#else
arp->ethtype= HTONS(ETH_ARP_PROTO);
arp->hdr= HTONS(ARP_ETHERNET);
arp->pro= HTONS(ETH_IP_PROTO);
arp->op= HTONS(ARP_REQUEST);
#endif
arp->hln= 6;
arp->pln= 4;

Expand All @@ -161,18 +137,10 @@ int is_arp_me(buf_t *bp, network_t *np)
*/
arp46_t *arp= (arp46_t *) bp->eth;

if (
#ifdef __NBSD_LIBC
arp->ethtype == htons(ETH_ARP_PROTO)
if (arp->ethtype == htons(ETH_ARP_PROTO)
&& arp->hdr == htons(ARP_ETHERNET)
&& arp->pro == htons(ETH_IP_PROTO)
&& arp->op == htons(ARP_REPLY)
#else
arp->ethtype == HTONS(ETH_ARP_PROTO)
&& arp->hdr == HTONS(ARP_ETHERNET)
&& arp->pro == HTONS(ETH_IP_PROTO)
&& arp->op == HTONS(ARP_REPLY)
#endif
&& memcmp(&arp->spa, &np->ip, sizeof(np->ip)) == 0
&& memcmp(&arp->sha, &np->eth, sizeof(np->eth)) != 0
) {
Expand Down Expand Up @@ -211,11 +179,7 @@ void icmp_advert(buf_t *bp, network_t *np)
icmp->ih_hun.ihh_ram.iram_aes= 2;
icmp->ih_hun.ihh_ram.iram_lt= htons(DELTA_ADV);
((u32_t *) icmp->ih_dun.uhd_data)[0] = np->gateway;
#ifdef __NBSD_LIBC
((u32_t *) icmp->ih_dun.uhd_data)[1] = htonl((u32_t) -9999);
#else
((u32_t *) icmp->ih_dun.uhd_data)[1] = HTONL((u32_t) -9999);
#endif
icmp->ih_chksum= 0;
icmp->ih_chksum= ~oneC_sum(0, icmp, 16);
}
Expand Down
2 changes: 0 additions & 2 deletions commands/diff/diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
* @(#)diff.h 8.1 (Berkeley) 6/6/93
*/

#ifdef __NBSD_LIBC
#include <minix/config.h>
#endif
#include <sys/types.h>
#include <regex.h>

Expand Down
4 changes: 0 additions & 4 deletions commands/find/find.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ enum ntype {
N_PRUNE, N_REGEX, N_SIZE, N_TYPE, N_USER, N_XDEV, N_DELETE
};

#ifndef __NBSD_LIBC
typedef unsigned int u_int32_t;
#endif

/* node definition */
typedef struct _plandata {
struct _plandata *next; /* next node */
Expand Down
3 changes: 0 additions & 3 deletions commands/finger/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
PROG= finger
MAN=

# LSC Force finger to use its local fwopen macro
CPPFLAGS.finger.c+=-D__NBSD_LIBC

.include <bsd.prog.mk>
2 changes: 0 additions & 2 deletions commands/finger/finger.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,9 @@ char *ctime();

char *prog_name;

#ifdef __NBSD_LIBC
/* Already defined in stdio.h */
#undef fwopen
#define fwopen finger_fwopen
#endif

int main (int argc, char *argv[]);
static void doall(void);
Expand Down
3 changes: 0 additions & 3 deletions commands/fix/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
PROG= fix
MAN=

# LSC Force fix to use its local definition of getline
CPPFLAGS.fix.c+= -D__NBSD_LIBC

.include <bsd.prog.mk>
2 changes: 0 additions & 2 deletions commands/fix/fix.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@

char *prog = 0, *processing = 0;

#ifdef __NBSD_LIBC
/* getline() already declared in stdio.h */
#define getline fix_getline
#endif
char *getline(FILE *fp, char *b);
char *range(char *s, int *p1, int *p2);
int getcommand(FILE *fp, int *o1, int *o2, char *pcmd, int *n1, int
Expand Down
3 changes: 0 additions & 3 deletions commands/ftp101/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ PROG= ftp
SRCS= ftp.c local.c file.c xfer.c other.c net.c crc.c
CPPFLAGS+= -DCRC_ONLY

# LSC Force ftp.c to use its local definition of getline
CPPFLAGS+= -D__NBSD_LIBC

.include <bsd.prog.mk>
2 changes: 0 additions & 2 deletions commands/ftp101/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ char *cmdargv[NUMARGS];
int printreply = 1;
char reply[1024];

#ifdef __NBSD_LIBC
/* Already declared in stdio.h */
#define getline ftp_getline
#endif

static void makeargs(char *buff);
int DOver(void);
Expand Down
8 changes: 0 additions & 8 deletions commands/ftp101/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ struct servent *servent;

/* This HACK allows the server to establish data connections correctly */
/* when using the loopback device to talk to ourselves */
#ifdef __NBSD_LIBC
if((hostip & ntohl(0xFF000000)) == inet_addr("127.0.0.0"))
#else
if((hostip & NTOHL(0xFF000000)) == inet_addr("127.0.0.0"))
#endif
hostip = myip;

if((tcp_device = getenv("TCP_DEVICE")) == NULL)
Expand Down Expand Up @@ -227,11 +223,7 @@ int wasopen;
#endif

ripaddr = hostip;
#ifdef __NBSD_LIBC
rport = htons(2);
#else
rport = HTONS(20);
#endif

/* here we set up a connection to listen on if not passive mode */
/* otherwise we use this to connect for passive mode */
Expand Down
2 changes: 0 additions & 2 deletions commands/gcov-pull/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
PROG=gcov-pull
MAN=

CPPFLAGS.gcov-pull.c+= -D__NBSD_LIBC

.include <bsd.prog.mk>
3 changes: 0 additions & 3 deletions commands/gcov-pull/gcov-pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
#ifndef __NBSD_LIBC
#include <alloca.h>
#endif
#include <string.h>
#include <assert.h>
#include <minix/gcov.h>
Expand Down
2 changes: 0 additions & 2 deletions commands/host/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
PROG= host
MAN=

CPPFLAGS.host.c+= -D__NBSD_LIBC

.include <bsd.prog.mk>
Loading

0 comments on commit f640210

Please sign in to comment.