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;
DPADD+= ${LIBL} ${LIBEDIT}
LDADD+= -ll -ledit
-CPPFLAGS+= -DSHELL -D__NBSD_LIBC
+CPPFLAGS+= -DSHELL
CPPFLAGS+=${EDIT} ${NO_PATHS_H} ${NO_JOBS}
CPPFLAGS+= -I. -I${.CURDIR}
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
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. */
#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)
{
/* 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;
*/
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
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;
*/
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
) {
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);
}
* @(#)diff.h 8.1 (Berkeley) 6/6/93
*/
-#ifdef __NBSD_LIBC
#include <minix/config.h>
-#endif
#include <sys/types.h>
#include <regex.h>
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 */
PROG= finger
MAN=
-# LSC Force finger to use its local fwopen macro
-CPPFLAGS.finger.c+=-D__NBSD_LIBC
-
.include <bsd.prog.mk>
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);
PROG= fix
MAN=
-# LSC Force fix to use its local definition of getline
-CPPFLAGS.fix.c+= -D__NBSD_LIBC
-
.include <bsd.prog.mk>
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
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>
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);
/* 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)
#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 */
PROG=gcov-pull
MAN=
-CPPFLAGS.gcov-pull.c+= -D__NBSD_LIBC
-
.include <bsd.prog.mk>
#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>
PROG= host
MAN=
-CPPFLAGS.host.c+= -D__NBSD_LIBC
-
.include <bsd.prog.mk>
FILE *filePtr;
-#ifdef __NBSD_LIBC
static struct __res_state orig;
-#else
-struct state orig;
-extern struct state _res;
-#endif
static u8_t *cname = NULL;
int getclass = C_IN;
int gettype, getdeftype = T_A;
char **v;
{
char *domain;
-#ifdef __NBSD_LIBC
struct in_addr addr;
-#else
- ipaddr_t addr;
-#endif
register struct hostent *hp;
register char *s, *p;
register int inverse = 0;
hperror(h_errno);
exit(1);
}
-#ifdef __NBSD_LIBC
memcpy(&_res.nsaddr.sin_addr, hp->h_addr, NS_INADDRSZ);
-#else
- _res.nsaddr= *(ipaddr_t *)hp->h_addr;
-#endif
printf("Using domain server:\n");
printanswer(hp);
}
else {
-#ifdef __NBSD_LIBC
_res.nsaddr.sin_family = AF_INET;
_res.nsaddr.sin_addr = addr;
_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
printf("Using domain server %s:\n",
inet_ntoa(_res.nsaddr.sin_addr));
-#else
- _res.nsaddr_list[0]= addr;
- _res.nsport_list[0]= htons(NAMESERVER_PORT);
- printf("Using domain server %s",
- inet_ntoa(_res.nsaddr));
- if (p != NULL) {
- printf(" on port %d", atoi(p));
- _res.nsport_list[0]= htons(atoi(p));
- }
- printf(":\n");
-#endif
}
}
domain = v[1];
register struct hostent *hp;
{
register char **cp;
-#ifdef __NBSD_LIBC
struct in_addr **hptr;
-#else
- register ipaddr_t **hptr;
-#endif
printf("Name: %s\n", hp->h_name);
printf("Address:");
-#ifdef __NBSD_LIBC
for (hptr = (struct in_addr **)hp->h_addr_list; *hptr; hptr++)
printf(" %s", inet_ntoa(**hptr));
-#else
- for (hptr = (ipaddr_t **)hp->h_addr_list; *hptr; hptr++)
- printf(" %s", inet_ntoa(*(ipaddr_t *)*hptr));
-#endif
printf("\nAliases:");
for (cp = hp->h_aliases; cp && *cp && **cp; cp++)
printf(" %s", *cp);
arcount = ntohs(hp->dh_arcount);
if (_res.options & RES_DEBUG || (verbose && isls == 0))
printf("rcode = %d (%s), ancount=%d\n",
-#ifdef __NBSD_LIBC
hp->rcode,
DecodeError(hp->rcode),
-#else
- hp->dh_flag2 & DHF_RCODE,
- DecodeError(hp->dh_flag2 & DHF_RCODE),
-#endif
ancount);
- if (
-#ifdef __NBSD_LIBC
- hp->rcode != NOERROR ||
-#else
- hp->dh_flag2 & DHF_RCODE != NOERROR ||
-#endif
- (ancount+nscount+arcount) == 0) {
- switch (
-#ifdef __NBSD_LIBC
- hp->rcode
-#else
- hp->dh_flag2 & DHF_RCODE
-#endif
- ) {
+ if (hp->rcode != NOERROR || (ancount+nscount+arcount) == 0) {
+ switch (hp->rcode) {
case NXDOMAIN:
/* Check if it's an authoritive answer */
- if (
-#ifdef __NBSD_LIBC
- hp->aa
-#else
- hp->dh_flag1 & DHF_AA
-#endif
- ) {
+ if (hp->aa) {
h_errno = HOST_NOT_FOUND;
return(0);
} else {
cp += dn_skipname((u8_t *)cp,(u8_t *)eom) + QFIXEDSZ;
}
if (ancount) {
- if (!
-#ifdef __NBSD_LIBC
- hp->aa
-#else
- (hp->dh_flag1 & DHF_AA)
-#endif
- )
+ if (!hp->aa)
if (verbose && isls == 0)
printf("The following answer is not authoritative:\n");
while (--ancount >= 0 && cp && cp < eom) {
int filter;
{
int type, class, dlen, n, c, proto, ttl;
-#ifdef __NBSD_LIBC
struct in_addr inaddr;
-#else
- ipaddr_t inaddr;
-#endif
u8_t *cp1;
struct protoent *protop;
struct servent *servp;
}
break;
/* Roy end */
-#ifndef __NBSD_LIBC
- case T_UINFO:
- if (doprint)
- fprintf(file,"%c%s", punc, cp);
- cp += dlen;
- break;
-
- case T_UID:
- case T_GID:
- if (dlen == 4) {
- if (doprint)
- fprintf(file,"%c%ld", punc, _getlong(cp));
- cp += sizeof(int);
- }
- break;
-#endif
case T_WKS:
if (dlen < sizeof(u_long) + 1)
break;
return("MAILA");
case T_ANY: /* matches any type */
return("ANY");
-#ifndef __NBSD_LIBC
- case T_UINFO:
- return("UINFO");
- case T_UID:
- return("UID");
- case T_GID:
- return("GID");
-#endif
default:
return (sprintf(nbuf, "%d", type) == EOF ? NULL : nbuf);
}
}
if (_res.options & RES_DEBUG || verbose)
printf("rcode = %d (%s), ancount=%d\n",
-#ifdef __NBSD_LIBC
answer.qb1.rcode,
DecodeError(answer.qb1.rcode),
- ntohs(answer.qb1.ancount)
-#else
- answer.qb1.dh_flag2 & DHF_RCODE,
- DecodeError(answer.qb1.dh_flag2 & DHF_RCODE),
- ntohs(answer.qb1.dh_ancount)
-#endif
- );
+ ntohs(answer.qb1.ancount));
/*
* Analyze response to our NS lookup
*/
-#ifdef __NBSD_LIBC
nscount = ntohs(answer.qb1.ancount) +
ntohs(answer.qb1.nscount) +
ntohs(answer.qb1.arcount);
-#else
- nscount = ntohs(answer.qb1.dh_ancount) + ntohs(answer.qb1.dh_nscount) +
- ntohs(answer.qb1.dh_arcount);
-#endif
- if (
-#ifdef __NBSD_LIBC
- answer.qb1.rcode != NOERROR || nscount == 0
-#else
- answer.qb1.dh_flag2 & DHF_RCODE != NOERROR || nscount == 0
-#endif
- ) {
- switch (
-#ifdef __NBSD_LIBC
- answer.qb1.rcode
-#else
- answer.qb1.dh_flag2 & DHF_RCODE
-#endif
- ) {
+ if (answer.qb1.rcode != NOERROR || nscount == 0) {
+ switch (answer.qb1.rcode) {
case NXDOMAIN:
/* Check if it's an authoritive answer */
- if (
-#ifdef __NBSD_LIBC
- answer.qb1.aa
-#else
- answer.qb1.dh_flag1 & DHF_AA
-#endif
- ) {
-
+ if (answer.qb1.aa) {
printf("No such domain\n");
} else {
printf("Unable to get information about domain -- try again later.\n");
tcpconf.nwtc_flags= NWTC_EXCL | NWTC_LP_SEL | NWTC_SET_RA |
NWTC_SET_RP;
tcpconf.nwtc_remaddr= *(ipaddr_t *)nsipaddr[thisns];
-#ifdef __NBSD_LIBC
tcpconf.nwtc_remport= _res.nsaddr.sin_port;
-#else
- tcpconf.nwtc_remport= _res.nsport_list[0];
-#endif
result= ioctl(tcp_fd, NWIOSTCPCONF, &tcpconf);
if (result == -1)
{
break;
}
-#ifdef __NBSD_LIBC
i = buf.qb1.rcode;
-#else
- i = buf.qb1.dh_flag2 & DHF_RCODE;
-#endif
+
if (i != NOERROR || ntohs(buf.qb1.dh_ancount) == 0) {
if ((thisns+1) < numnsaddr &&
(i == SERVFAIL || i == NOTIMP || i == REFUSED)) {
fprintf(stderr,"ListHosts: error receiving zone transfer:\n");
fprintf(stderr,
" result: %s, answers = %d, authority = %d, additional = %d\n",
-#ifdef __NBSD_LIBC
resultcodes[headerPtr->rcode],
-#else
- resultcodes[headerPtr->dh_flag2 & DHF_RCODE],
-#endif
ntohs(headerPtr->dh_ancount),
ntohs(headerPtr->dh_nscount),
ntohs(headerPtr->dh_arcount));
PROG= hostaddr
BINMODE= 4755
MAN=
-CPPFLAGS+= -D__NBSD_LIBC
.include <bsd.prog.mk>
#include <string.h>
#include <unistd.h>
-#ifdef __NBSD_LIBC
#include <netinet/in.h>
-#endif
#include <net/netlib.h>
#include <net/hton.h>
/* remove _() stuff */
#define _(a) a
-#ifndef __NBSD_LIBC
-typedef unsigned long ulong;
-void err(int eval, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- exit(eval);
-}
-#endif
/*-------------------------------------------------------------------*/
/* SHM_DEST and SHM_LOCKED are defined in kernel headers,
icmp_hdr= (icmp_hdr_t *) (ip_hdr + 1);
ip_hdr->ih_vers_ihl= 0x45;
-#ifdef __NBSD_LIBC
ip_hdr->ih_dst= htonl(0xFFFFFFFFL);
-#else
- ip_hdr->ih_dst= HTONL(0xFFFFFFFFL);
-#endif
icmp_hdr->ih_type= ICMP_TYPE_ROUTE_SOL;
icmp_hdr->ih_code= 0;
icmp_hdr->ih_chksum= 0;
* broadcast them (to keep bad hosts up.)
*/
-#ifdef __NBSD_LIBC
advertize(bcast ? htonl(0xFFFFFFFFL) : htonl(0x7F000001L));
-#else
- advertize(bcast ? HTONL(0xFFFFFFFFL) : HTONL(0x7F000001L));
-#endif
next_advert= now + MaxAdvertisementInterval;
#if !__minix_vmd
/* Make sure we are listening to RIP now. */
ipopt.nwio_ttl= 1;
ipopt.nwio_df= 0;
ipopt.nwio_hdropt.iho_opt_siz= 0;
-#ifdef __NBSD_LIBC
ipopt.nwio_rem= htonl(0xFFFFFFFFL);
-#else
- ipopt.nwio_rem= HTONL(0xFFFFFFFFL);
-#endif
ipopt.nwio_proto= IPPROTO_ICMP;
if (ioctl(irdp_fd, NWIOSIPOPT, &ipopt) < 0)
PROG= logger
MAN=
-CPPFLAGS.logger.c+= -D__NBSD_LIBC
.include <bsd.prog.mk>
for (save = s; *s && *s != '.'; ++s);
if (*s) {
*s = '\0';
-#ifdef __NBSD_LIBC
fac = decode(save, facilitynames);
-#else
- fac = decode(save, FacNames);
-#endif
if (fac < 0) bailout("unknown facility name:", save);
*s++ = '.';
} else {
fac = 0;
s = save;
}
-#ifdef __NBSD_LIBC
lev = decode(s, prioritynames);
-#else
- lev = decode(s, PriNames);
-#endif
if (lev < 0) bailout("unknown priority name:", save);
return((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
}
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
-#ifdef __NBSD_LIBC
#include <compat/a.out.h>
-#else
-#include <minix/a.out.h>
-#endif
#include "proto.h"
#define NN_UNDF 0
{
va_list ap;
int retval;
-#ifndef __NBSD_LIBC
- FILE tmp_stream;
-
- va_start(ap, format);
-
- tmp_stream._fd = -1;
- tmp_stream._flags = _IOWRITE + _IONBF + _IOWRITING;
- tmp_stream._buf = (unsigned char *) outbuf;
- tmp_stream._ptr = (unsigned char *) outbuf;
- tmp_stream._count = 512;
-
- retval = _doprnt(format, ap, &tmp_stream);
- putc('\0',&tmp_stream);
-#else
va_start(ap, format);
retval = vsnprintf(outbuf, OUTBUFSIZE, format, ap);
-#endif
va_end(ap);
outstr(outbuf);
PROG= nonamed
MAN=
-CPPFLAGS+=-D__NBSD_LIBC
-
.include <bsd.prog.mk>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/asynchio.h>
-#ifdef __NBSD_LIBC
#include <netinet/in.h>
#include <arpa/nameser.h>
-#endif
#include <net/hton.h>
#include <net/netlib.h>
#include <net/gen/in.h>
#include <paths.h>
-#ifdef __NBSD_LIBC
#undef HTONL
#undef HTONS
#define HTONL htonl
#define HTONS htons
-#endif
#define HTTL 3600L /* Default time to live for /etc/hosts data. */
#define SHORT_TIMEOUT 2 /* If you expect an answer soon. */
if (size < sizeof(HEADER)) return;
printf("%*s", indent, "");
-#ifdef __NBSD_LIBC
printf("DNS %s:", (dp->hdr.qr) ? "reply" : "query");
r = dp->hdr.rcode;
-#else
- printf("DNS %s:", (dp->hdr.dh_flag1 & DHF_QR) ? "reply" : "query");
- r= dp->hdr.dh_flag2 & DHF_RCODE;
-#endif
printf(" %s", r < arraysize(rcodes) ? rcodes[r] : itoa("ERR_%lu", r));
-#ifdef __NBSD_LIBC
if (dp->hdr.aa) printf(" AA");
if (dp->hdr.tc) printf(" TC");
if (dp->hdr.rd) printf(" RD");
if (dp->hdr.ra) printf(" RA");
if (dp->hdr.ad) printf(" AD");
if (dp->hdr.cd) printf(" CD");
-#else
- if (dp->hdr.dh_flag1 & DHF_AA) printf(" AA");
- if (dp->hdr.dh_flag1 & DHF_TC) printf(" TC");
- if (dp->hdr.dh_flag1 & DHF_RD) printf(" RD");
- if (dp->hdr.dh_flag2 & DHF_RA) printf(" RA");
-#ifdef DHF_AD
- if (dp->hdr.dh_flag2 & DHF_AD) printf(" AD");
- if (dp->hdr.dh_flag2 & DHF_CD) printf(" CD");
-#endif
-#endif
fputc('\n', stdout);
count[0]= ntohs(dp->hdr.dh_qdcount);
dlim= dns2oct(dp) + size;
if (size < sizeof(HEADER)) return 0;
-#ifdef __NBSD_LIBC
rcode= dp->hdr.rcode;
-#else
- rcode= dp->hdr.dh_flag2 & DHF_RCODE;
-#endif
count[0]= ntohs(dp->hdr.dh_qdcount);
count[1]= ntohs(dp->hdr.dh_ancount);
count[2]= ntohs(dp->hdr.dh_nscount);
if (single) return 0;
/* Assume we can answer. */
-#ifdef __NBSD_LIBC
dns.hdr.qr = 1;
dns.hdr.opcode = 0;
dns.hdr.aa = 1;
dns.hdr.ad = 0;
dns.hdr.cd = 0;
dns.hdr.rcode = 0;
-#else
- dns.hdr.dh_flag1= DHF_QR | DHF_AA;
- dns.hdr.dh_flag2= DHF_RA;
-#endif
dns.hdr.dh_qdcount= HTONS(1);
ancount= 0;
dns.hdr.dh_nscount= HTONS(0);
if (type != HTONS(T_TXT) || namecmp(qname, "version.bind") != 0) return 0;
-#ifdef __NBSD_LIBC
dns.hdr.qr = 1;
dns.hdr.opcode = 0;
dns.hdr.aa = 1;
dns.hdr.ad = 0;
dns.hdr.cd = 0;
dns.hdr.rcode = 0;
-#else
- dns.hdr.dh_flag1= DHF_QR | DHF_AA;
- dns.hdr.dh_flag2= DHF_RA;
-#endif
dns.hdr.dh_qdcount= HTONS(1);
dns.hdr.dh_ancount= HTONS(1);
dns.hdr.dh_nscount= HTONS(0);
u8_t name[MAXDNAME];
u32_t minttl;
-#if __NBSD_LIBC
if ((dp->hdr.rd && !dp->hdr.tc)) return;
-#else
- if ((dp->hdr.dh_flag1 & (DHF_RD | DHF_TC)) != DHF_RD) return;
-#endif
if (dp->hdr.dh_qdcount != HTONS(1)) return;
cp= dp->data;
r= dn_expand(dns2oct(dp), dns2oct(dp) + dlen, cp, name, MAXDNAME);
/* Remember ID and RD. */
id= dp->hdr.dh_id;
-#ifdef __NBSD_LIBC
rd= dp->hdr.rd;
-#else
- rd= dp->hdr.dh_flag1 & DHF_RD;
-#endif
if (r == -1) {
/* Malformed query, reply "FORMERR". */
-#ifdef __NBSD_LIBC
dp->hdr.tc = 0;
dp->hdr.qr = 1;
dp->hdr.aa = 1;
dp->hdr.unused = 0;
dp->hdr.ra = 1;
dp->hdr.rcode = FORMERR;
-#else
- dp->hdr.dh_flag1 &= ~(DHF_TC);
- dp->hdr.dh_flag1 |= DHF_QR | DHF_AA;
- dp->hdr.dh_flag2 &= ~(DHF_UNUSED | DHF_RCODE);
- dp->hdr.dh_flag2 |= DHF_RA | FORMERR;
-#endif
} else
if (class == HTONS(C_IN) && query_hosts(name, type, dp, pdlen)) {
/* Answer to this query is in the hosts file. */
if (class == HTONS(C_IN) && (qp= get_query(name, type)) != nil) {
/* Answer to this query is present in the cache. */
memcpy(dp, &qp->dns, dlen= qp->size);
-#ifdef __NBSD_LIBC
dp->hdr.aa = 1;
-#else
- dp->hdr.dh_flag1 &= ~DHF_AA;
-#endif
(void) dns_ttl(dp, dlen, now - qp->age);
if (rd) {
if (qp->stale <= now) {
/* No real name daemon present, or this name has a repeated top level
* domain sequence. Reply "no such domain".
*/
-#ifdef __NBSD_LIBC
dp->hdr.tc = 0;
dp->hdr.qr = 1;
dp->hdr.aa = 1;
dp->hdr.unused = 0;
dp->hdr.ra = 1;
dp->hdr.rcode = NXDOMAIN;
-#else
- dp->hdr.dh_flag1 &= ~(DHF_TC);
- dp->hdr.dh_flag1 |= DHF_QR | DHF_AA;
- dp->hdr.dh_flag2 &= ~(DHF_UNUSED | DHF_RCODE);
- dp->hdr.dh_flag2 |= DHF_RA | NXDOMAIN;
-#endif
} else
if (!rd) {
/* "Recursion Desired" is off, so don't bother to relay. */
-#ifdef __NBSD_LIBC
dp->hdr.tc = 0;
dp->hdr.qr = 1;
dp->hdr.unused = 0;
dp->hdr.ra = 1;
dp->hdr.rcode = NOERROR;
-#else
- dp->hdr.dh_flag1 &= ~(DHF_TC);
- dp->hdr.dh_flag1 |= DHF_QR;
- dp->hdr.dh_flag2 &= ~(DHF_UNUSED | DHF_RCODE);
- dp->hdr.dh_flag2 |= DHF_RA | NOERROR;
-#endif
} else {
/* Caller needs to consult with a real name daemon. */
return 0;
/* Copy ID and RD back to answer. */
dp->hdr.dh_id= id;
-#ifdef __NBSD_LIBC
dp->hdr.rd = rd;
-#else
- dp->hdr.dh_flag1 &= ~DHF_RD;
- dp->hdr.dh_flag1 |= rd;
-#endif
*pdlen= dlen;
return 1;
}
dlen= cp - dns2oct(&udp.dns);
udp.dns.hdr.dh_id= new_id(ID_REFRESH, my_port, ID_IPSELF);
-#ifdef __NBSD_LIBC
udp.dns.hdr.qr = 0;
udp.dns.hdr.opcode = 0;
udp.dns.hdr.aa = 0;
udp.dns.hdr.ad = 0;
udp.dns.hdr.cd = 0;
udp.dns.hdr.rcode = 0;
-#else
- udp.dns.hdr.dh_flag1= DHF_RD;
- udp.dns.hdr.dh_flag2= 0;
-#endif
udp.dns.hdr.dh_qdcount= HTONS(1);
udp.dns.hdr.dh_ancount= HTONS(0);
udp.dns.hdr.dh_nscount= HTONS(0);
/* Check, and if necessary reinitialize my configuration. */
init_config(udp.hdr.uih_dst_addr);
- if (
-#ifdef __NBSD_LIBC
- udp.dns.hdr.qr
-#else
- udp.dns.hdr.dh_flag1 & DHF_QR
-#endif
- ) {
+ if (udp.dns.hdr.qr) {
/* This is a remote named reply, not a query. */
/* Response to a query previously relayed? */
* "What are the name servers for the root domain?"
*/
udp.dns.hdr.dh_id= new_id(ID_PROBE, my_port, ID_IPSELF);
-#ifdef __NBSD_LIBC
udp.dns.hdr.qr = 0;
udp.dns.hdr.opcode = 0;
udp.dns.hdr.aa = 0;
udp.dns.hdr.ad = 0;
udp.dns.hdr.cd = 0;
udp.dns.hdr.rcode = 0;
-#else
- udp.dns.hdr.dh_flag1= 0;
- udp.dns.hdr.dh_flag2= 0;
-#endif
udp.dns.hdr.dh_qdcount= HTONS(1);
udp.dns.hdr.dh_ancount= HTONS(0);
udp.dns.hdr.dh_nscount= HTONS(0);
#include <string.h>
#include <unistd.h>
-#ifdef __NBSD_LIBC
#define setkey pwdauth_setkey
#define encrypt pwdauth_encrypt
-#endif
#define LEN 1024
#define MAX_RARP_RETRIES 5
#define RARP_TIMEOUT 5
-#ifdef __NBSD_LIBC
#undef HTONS
#define HTONS htons
-#endif
typedef struct rarp46
{
MAN.shutdown=
MAN.halt=
-CPPFLAGS+= -D__NBSD_LIBC
-
.include <bsd.prog.mk>
fd = open(wtmpfile,O_APPEND|O_WRONLY|O_CREAT,1);
if (fd) {
if (strcmp(prog,"reboot"))
-#ifdef __NBSD_LIBC
strcpy (wtmp.ut_name, prog);
-#else
- strcpy (wtmp.ut_user, prog);
-#endif
else
-#ifdef __NBSD_LIBC
strcpy (wtmp.ut_name, "shutdown"); /* last ... */
-#else
- strcpy (wtmp.ut_user, "shutdown"); /* last ... */
-#endif
strcpy (wtmp.ut_id, "~~");
strcpy (wtmp.ut_line, "~");
wtmp.ut_pid = 0;
crashed = (lseek(fd, - (off_t) sizeof(last), SEEK_END) == -1
|| read(fd, (void *) &last, sizeof(last)) != sizeof(last)
|| last.ut_line[0] != '~'
-#ifdef __NBSD_LIBC
|| (strncmp(last.ut_name, "shutdown", sizeof(last.ut_name))
- && strncmp(last.ut_name, "halt", sizeof(last.ut_name)))
-#else
- || (strncmp(last.ut_user, "shutdown", sizeof(last.ut_user))
- && strncmp(last.ut_user, "halt", sizeof(last.ut_user)))
-#endif
+ && strncmp(last.ut_name, "halt", sizeof(last.ut_name)))
);
close(fd);
return crashed;
#include <sys/types.h>
#include <sys/ioctl.h>
#endif
-#ifdef __NBSD_LIBC
#include <unistd.h>
-#endif
/* Default settings, the Minix ones are defined in <termios.h> */
PROG= syslogd
PIDFILE= -DPIDFILE=\"/var/run/syslogd.pid\"
CPPFLAGS+= -Ddebug=0 ${PIDFILE}
-CPPFLAGS+= -D__NBSD_LIBC
BINMODE= 700
MAN=
while (strchr(", ;", *q)) q++;
/* Decode priority name */
-#ifdef __NBSD_LIBC
pri = decode(buf, prioritynames);
-#else
- pri = decode(buf, PriNames);
-#endif
if (pri < 0) {
sprintf(xbuf, "unknown priority name \"%s\"", buf);
logerror(xbuf);
fLog->f_pmask[ix] = pri;
}
} else {
-#ifdef __NBSD_LIBC
ix = decode(buf, facilitynames);
-#else
- ix = decode(buf, FacNames);
-#endif
if (ix < 0) {
sprintf(xbuf, "unknown facility name \"%s\"", buf);
logerror(xbuf);
PROG= tcpstat
CPPFLAGS+= -I${NETBSDSRCDIR}/servers -D'ARGS(a)=a'
-# LSC Force inet.h to use ioc_net.h
-CPPFLAGS+= -D__NBSD_LIBC
MAN=
.include <bsd.prog.mk>
CPPFLAGS+= -I${NETBSDSRCDIR}/servers -D'ARGS(a)=a'
MAN=
-# LSC Force inet.h to use sys/ioc_net.h
-CPPFLAGS+= -D__NBSD_LIBC
-
.include <bsd.prog.mk>
PROG= writeisofs
MAN=
-# LSC Prevent redefinition ot types
-CPPFLAGS.writeisofs.c+= -D__NBSD_LIBC
-
.include <bsd.prog.mk>
extern char *optarg;
extern int optind;
-#ifndef __NBSD_LIBC
-typedef unsigned char u_int8_t;
-typedef unsigned short int u_int16_t;
-typedef unsigned long int u_int32_t;
-#endif
-
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#include "assert.h"
#include "random.h"
-#ifdef __NBSD_LIBC
#include <sys/sha2.h>
-#else
-#include <minix/sha2.h>
-#endif
#include "aes/rijndael.h"
#define N_DERIV 16
-#ifdef __NBSD_LIBC
-#endif
int env_parse(char *env, char *fmt, int field, long *param, long min,
long max);
void env_panic(char *env);
#define _LIB_H
/* First come the defines. */
-#ifdef __NBSD_LIBC
#include <sys/featuretest.h> /* tell headers to include NetBSD stuff. */
-#else /* !__NBSD_LIBC */
-#define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */
-#endif
-
-#define _NETBSD_SOURCE 1 /* tell headers to include MINIX stuff */
/* The following are so basic, all the lib files get them automatically. */
#include <minix/config.h> /* must be first */
#include <minix/ipc.h>
-
int __execve(const char *_path, char *const _argv[], char *const
_envp[], int _nargs, int _nenvps);
int _syscall(endpoint_t _who, int _syscallnr, message *_msgptr);
#ifndef _IPC_H
#define _IPC_H
-#ifdef __NBSD_LIBC
-#endif
#include <minix/ipcconst.h>
#include <minix/type.h>
#include <minix/const.h>
/* Miscellaneous BSD. */
char *itoa(int _n);
-#ifndef __NBSD_LIBC
-char *getpass(const char *_prompt);
-#ifdef __ACK__
-void swab(char *_from, char *_to, int _count);
-#endif
-#endif /* !_NBSD_LIBC */
/* Miscellaneous MINIX. */
void std_err(const char *_s);
#include <errno.h>
#include <stdlib.h>
#include <limits.h>
-#ifdef __NBSD_LIBC
#include <sys/signal.h>
-#endif
typedef int mthread_thread_t;
typedef int mthread_once_t;
#define VSTART 9 /* cc_c[VSTART] = START char (^S) */
#define VSTOP 10 /* cc_c[VSTOP] = STOP char (^Q) */
-#ifdef __NBSD_LIBC
-/* This is defined in <unistd.h> in NetBSD headers. */
-#else /* !__NBSD_LIBC */
-#define _POSIX_VDISABLE (cc_t)0xFF /* You can't even generate this
- * character with 'normal' keyboards.
- * But some language specific keyboards
- * can generate 0xFF. It seems that all
- * 256 are used, so cc_t should be a
- * short...
- */
-#endif /* !__NBSD_LIBC */
-
/* Values for the baud rate settings. POSIX Table 7-6. */
#define B0 0x0000 /* hang up the line */
#define B50 0x1000 /* 50 baud */
#define DHCP_FLAGS_BCAST 0x8000U /* Reply must be broadcast to client. */
/* "Magic" first four option bytes. */
-#ifdef __NBSD_LIBC
#define DHCP_MAGIC htonl(0x63825363UL)
-#else
-#define DHCP_MAGIC HTONL(0x63825363UL)
-#endif
/* DHCP common tags: */
#define DHCP_TAG_NETMASK 1 /* Netmask. */
#error "Unknown byte order"
#endif
-#ifdef __NBSD_LIBC
#define CONCAT(x,y) __CONCAT(x,y)
#define __elfN(x) CONCAT(CONCAT(CONCAT(elf,__ELF_WORD_SIZE),_),x)
#define __ElfN(x) CONCAT(CONCAT(CONCAT(Elf,__ELF_WORD_SIZE),_),x)
#define __ELFN(x) CONCAT(CONCAT(CONCAT(ELF,__ELF_WORD_SIZE),_),x)
#define __ElfType(x) typedef __ElfN(x) __CONCAT(Elf_,x)
-#else
-#define __elfN(x) __CONCAT(__CONCAT(__CONCAT(elf,__ELF_WORD_SIZE),_),x)
-#define __ElfN(x) __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x)
-#define __ELFN(x) __CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x)
-#define __ElfType(x) typedef __ElfN(x) __CONCAT(Elf_,x)
-#endif
__ElfType(Addr);
__ElfType(Half);
assert(ptr_min < ptr_max);
/* select address at random */
-#ifdef __NBSD_LIBC
tsc = 0;
-#else
- tsc = 0;
- /* LSC Broken for now... */
- /* read_tsc_64(&tsc); */
-#endif
+ /* LSC FIXME Broken for now... */
+ /* read_tsc_64(&tsc); */
totalsize = block_get_totalsize(size);
page_index_max = (ptr_max - ptr_min - totalsize) / PAGE_SIZE;
page_index = (page_index_max > 0) ? (ex64lo(tsc) % page_index_max) : 0;
# $NetBSD: Makefile.inc,v 1.9 2012/06/19 06:10:09 dholland Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
.if defined(__MINIX)
-CPPFLAGS+= -D__NBSD_LIBC=1
USE_FORT?= no
.else
USE_FORT?= yes # network server
Generate 256-bit random numbers
*/
-#ifdef __NBSD_LIBC
#include <sys/sha2.h>
-#else
-#include <minix/sha2.h>
-#endif
#include "inet.h"
#include "rand256.h"
#include <net/gen/udp_io.h>
#include <net/gen/arp_io.h>
-#ifdef __NBSD_LIBC
#include <sys/ioc_net.h>
-#else
-#include <net/ioctl.h>
-#endif
#include "const.h"
#include "inet_config.h"
extern struct tcp_conf tcp_conf[IP_PORT_MAX];
extern struct udp_conf udp_conf[IP_PORT_MAX];
void read_conf(void);
-#ifdef __NBSD_LIBC
extern void *sbrk(int);
-#else
-extern char *sbrk(int);
-#endif
void *alloc(size_t size);
/* Options */
extern int ip_forward_directed_bcast;
-#ifdef __NBSD_LIBC
#undef HTONL
#undef HTONS
#define HTONL htonl
#define HTONS htons
-#endif
#endif /* INET__INET_CONFIG_H */
PROG= init
SRCS= init.c
-CPPFLAGS.init.c+= -D__NBSD_LIBC
MAN=
BINDIR?= /usr/sbin
#include <unistd.h>
#include <utmp.h>
-#ifdef __NBSD_LIBC
/* Different ttyent structure. */
struct ttyent TT_REBOOT = { "console", "shutdown -d now CTRL-ALT_DEL", "-"};
-#else
-/* Command to execute as a response to the three finger salute. */
-char *REBOOT_CMD[] = { "shutdown", "-d", "now", "CTRL-ALT-DEL", NULL };
-
-/* Associated fake ttytab entry. */
-struct ttyent TT_REBOOT = { "console", "-", REBOOT_CMD, NULL };
-#endif
char PATH_UTMP[] = "/etc/utmp"; /* current logins */
char PATH_WTMP[] = "/usr/adm/wtmp"; /* login/logout history */
void wtmp(int type, int linenr, char *line, pid_t pid);
void startup(int linenr, struct ttyent *ttyp);
int execute(char **cmd);
-#ifdef __NBSD_LIBC
char **construct_argv(char *cmd);
-#endif
void onhup(int sig);
void onterm(int sig);
void onabrt(int sig);
if ((ttyp = getttyent()) == NULL) break;
if (ttyp->ty_getty != NULL
-#ifdef __NBSD_LIBC
/* ty_getty is a string, and TTY_ON is
* the way to check for enabled ternimanls. */
&& (ttyp->ty_status & TTY_ON)
-#else
- && ttyp->ty_getty[0] != NULL
-#endif
&& slotp->pid == NO_PID
&& slotp->errct < ERRCT_DISABLE)
{
pid_t pid; /* new pid */
int err[2]; /* error reporting pipe */
char line[32]; /* tty device name */
-#ifndef __NBSD_LIBC
- int status;
-#endif
-#ifdef __NBSD_LIBC
char **ty_getty_argv;
-#endif
slotp = &slots[linenr];
_exit(1);
}
-#ifdef __NBSD_LIBC
- /* ty_init not present. */
-#else
- if (ttyp->ty_init != NULL && ttyp->ty_init[0] != NULL) {
- /* Execute a command to initialize the terminal line. */
-
- if ((pid = fork()) == -1) {
- report(2, "fork()");
- errno= 0;
- write(err[1], &errno, sizeof(errno));
- _exit(1);
- }
-
- if (pid == 0) {
- alarm(10);
- execute(ttyp->ty_init);
- report(2, ttyp->ty_init[0]);
- _exit(1);
- }
-
- while (waitpid(pid, &status, 0) != pid) {}
- if (status != 0) {
- tell(2, "init: ");
- tell(2, ttyp->ty_name);
- tell(2, ": ");
- tell(2, ttyp->ty_init[0]);
- tell(2, ": bad exit status\n");
- errno = 0;
- write(err[1], &errno, sizeof(errno));
- _exit(1);
- }
- }
-#endif
-
/* Redirect standard error too. */
dup2(0, 2);
-#ifdef __NBSD_LIBC
/* Construct argv for execute() */
ty_getty_argv = construct_argv(ttyp->ty_getty);
if (ty_getty_argv == NULL)
/* Execute the getty process. */
execute(ty_getty_argv);
-#else
- /* Execute the getty process. */
- execute(ttyp->ty_getty);
-#endif
/* Oops, disaster strikes. */
fcntl(2, F_SETFL, fcntl(2, F_GETFL) | O_NONBLOCK);
-#ifdef __NBSD_LIBC
if (linenr != 0) report(2, ty_getty_argv[0]);
-#else
- if (linenr != 0) report(2, ttyp->ty_getty[0]);
-#endif
write(err[1], &errno, sizeof(errno));
_exit(1);
}
#include <minix/com.h>
#include <minix/vfsif.h>
#include <fcntl.h>
-#ifdef __NBSD_LIBC
#include <stddef.h>
-#endif
#include "buf.h"
static char getdents_buf[GETDENTS_BUFSIZ];
#ifndef _MFSDIR_H
#define _MFSDIR_H
-#ifdef __NBSD_LIBC
#include <sys/cdefs.h>
-#endif
#include <sys/types.h>
/* Maximum Minix MFS on-disk directory filename.
struct direct {
ino_t mfs_d_ino;
char mfs_d_name[MFS_DIRSIZ];
-#ifdef __NBSD_LIBC
} __packed;
-#else
-};
-#endif
#endif /* _MFSDIR_H */
#define VERBOSE 0 /* display diagnostics */
-#ifdef __NBSD_LIBC
#include <sys/ioc_net.h>
-#else
-#include <net/ioctl.h>
-#endif
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/select.h>
extern char *_brksize;
int brk(brk_addr)
-#ifdef __NBSD_LIBC
void *brk_addr;
-#else
-char *brk_addr;
-#endif
{
int r;
/* PM wants to call brk() itself. */
panic("select copy_fdsets: nfds wrong: %d", nfds);
/* Only copy back as many bits as the user expects. */
-#ifdef __NBSD_LIBC
fd_setsize = (size_t) (howmany(nfds, __NFDBITS) * sizeof(__fd_mask));
-#else
- fd_setsize = (size_t) (_FDSETWORDS(nfds) * _FDSETBITSPERWORD/8);
-#endif
/* Set source and destination endpoints */
src_e = (direction == FROM_PROC) ? se->req_endpt : SELF;
# 3. Minimal C library
LDADD+= -lminc
-# Some define still needed, hopefully will go away soon
-CPPFLAGS+= -D__NBSD_LIBC
-
.include <bsd.prog.mk>
BINDIR= /sbin
MAN=
-# LSC Adding this to activate the getline renaming macro
-CPPFLAGS+= -D__NBSD_LIBC
-
.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" || !defined(HOSTPROGNAME)
LDADD+= -lminlib -lcompat_minix
.endif
struct direct {
uint32_t mfs_d_ino;
char mfs_d_name[MFS_DIRSIZ];
-#ifdef __NBSD_LIBC
} __packed;
-#else
-};
-#endif
#endif /* _MFSDIR_H */
FILE *proto;
-#if defined(__NBSD_LIBC) || !defined(__minix)
#define getline _mkfs_getline
-#endif
int main(int argc, char **argv);
block_t sizeup(char *device);