Removing obsolete _NBSD_LIBC define

Change-Id: Ia6ce84ccdf36cf6f64540b990baaa7d85c53533d
This commit is contained in:
Lionel Sambuc 2013-02-25 21:06:20 +01:00
parent afa4fd56ac
commit f640210005
64 changed files with 15 additions and 605 deletions

View file

@ -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;

View file

@ -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}

View file

@ -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
@ -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. */

View file

@ -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)
{
@ -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;
@ -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
@ -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;
@ -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
) {
@ -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);
}

View file

@ -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>

View file

@ -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 */

View file

@ -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>

View file

@ -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);

View file

@ -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>

View file

@ -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

View file

@ -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>

View file

@ -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);

View file

@ -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)
@ -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 */

View file

@ -1,6 +1,4 @@
PROG=gcov-pull
MAN=
CPPFLAGS.gcov-pull.c+= -D__NBSD_LIBC
.include <bsd.prog.mk>

View file

@ -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>

View file

@ -1,6 +1,4 @@
PROG= host
MAN=
CPPFLAGS.host.c+= -D__NBSD_LIBC
.include <bsd.prog.mk>

View file

@ -64,12 +64,7 @@ extern int h_errno;
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;
@ -104,11 +99,7 @@ main(c, v)
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;
@ -192,33 +183,17 @@ main(c, v)
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];
@ -350,21 +325,12 @@ printanswer(hp)
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);
@ -519,37 +485,14 @@ printinfo(answer, eom, filter, isls)
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 {
@ -592,13 +535,7 @@ printinfo(answer, eom, filter, isls)
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) {
@ -642,11 +579,7 @@ pr_rr(cp, msg, file, filter)
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;
@ -802,22 +735,6 @@ pr_rr(cp, msg, file, filter)
}
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;
@ -919,14 +836,6 @@ pr_type(type)
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);
}
@ -1092,55 +1001,24 @@ ListHosts(namePtr, queryType)
}
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");
@ -1284,11 +1162,7 @@ again:
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)
{
@ -1385,11 +1259,8 @@ again:
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)) {
@ -1449,11 +1320,7 @@ again:
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));

View file

@ -1,6 +1,5 @@
PROG= hostaddr
BINMODE= 4755
MAN=
CPPFLAGS+= -D__NBSD_LIBC
.include <bsd.prog.mk>

View file

@ -16,9 +16,7 @@ Created: Jan 27, 1992 by Philip Homburg
#include <string.h>
#include <unistd.h>
#ifdef __NBSD_LIBC
#include <netinet/in.h>
#endif
#include <net/netlib.h>
#include <net/hton.h>

View file

@ -35,17 +35,6 @@
/* 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,

View file

@ -229,11 +229,7 @@ void time_functions(void)
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;
@ -256,11 +252,7 @@ void time_functions(void)
* 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. */
@ -577,11 +569,7 @@ int main(int argc, char **argv)
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)

View file

@ -1,5 +1,4 @@
PROG= logger
MAN=
CPPFLAGS.logger.c+= -D__NBSD_LIBC
.include <bsd.prog.mk>

View file

@ -100,22 +100,14 @@ int pencode(char *s)
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));
}

View file

@ -13,11 +13,7 @@
#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

View file

@ -74,24 +74,9 @@ int Printf(const char *format, ...)
{
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);

View file

@ -1,6 +1,4 @@
PROG= nonamed
MAN=
CPPFLAGS+=-D__NBSD_LIBC
.include <bsd.prog.mk>

View file

@ -26,10 +26,8 @@ static const char version[] = "2.7";
#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>
@ -47,12 +45,10 @@ static const char version[] = "2.7";
#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. */
@ -358,31 +354,15 @@ static void dns_tell(int indent, dns_t *dp, size_t size)
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);
@ -421,11 +401,7 @@ static u32_t dns_ttl(dns_t *dp, size_t size, u32_t delta)
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);
@ -929,7 +905,6 @@ static int query_hosts(u8_t *qname, unsigned type, dns_t *dp, size_t *pdlen)
if (single) return 0;
/* Assume we can answer. */
#ifdef __NBSD_LIBC
dns.hdr.qr = 1;
dns.hdr.opcode = 0;
dns.hdr.aa = 1;
@ -940,10 +915,6 @@ static int query_hosts(u8_t *qname, unsigned type, dns_t *dp, size_t *pdlen)
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);
@ -1080,7 +1051,6 @@ static int query_chaos(u8_t *qname, unsigned type, dns_t *dp, size_t *pdlen)
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;
@ -1091,10 +1061,6 @@ static int query_chaos(u8_t *qname, unsigned type, dns_t *dp, size_t *pdlen)
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);
@ -1162,11 +1128,7 @@ static void cache_reply(dns_t *dp, size_t dlen)
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);
@ -1250,27 +1212,16 @@ static int compose_reply(dns_t *dp, size_t *pdlen)
/* 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. */
@ -1279,11 +1230,7 @@ static int compose_reply(dns_t *dp, size_t *pdlen)
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) {
@ -1302,34 +1249,20 @@ static int compose_reply(dns_t *dp, size_t *pdlen)
/* 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;
@ -1337,12 +1270,7 @@ static int compose_reply(dns_t *dp, size_t *pdlen)
/* 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;
}
@ -1395,7 +1323,6 @@ static void refresh_cache(void)
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;
@ -1407,10 +1334,6 @@ static void refresh_cache(void)
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);
@ -1473,13 +1396,7 @@ static int job_read_udp(void *data, int expired)
/* 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? */
@ -2038,7 +1955,6 @@ static void named_probe(ipaddr_t ip)
* "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;
@ -2049,10 +1965,6 @@ static void named_probe(ipaddr_t ip)
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);

View file

@ -23,10 +23,8 @@
#include <string.h>
#include <unistd.h>
#ifdef __NBSD_LIBC
#define setkey pwdauth_setkey
#define encrypt pwdauth_encrypt
#endif
#define LEN 1024

View file

@ -40,10 +40,8 @@ Changed: Dec 11, 2000 by Kees J. Bot
#define MAX_RARP_RETRIES 5
#define RARP_TIMEOUT 5
#ifdef __NBSD_LIBC
#undef HTONS
#define HTONS htons
#endif
typedef struct rarp46
{

View file

@ -12,6 +12,4 @@ SYMLINKS+= ${BINDIR}/reboot /usr/bin/reboot
MAN.shutdown=
MAN.halt=
CPPFLAGS+= -D__NBSD_LIBC
.include <bsd.prog.mk>

View file

@ -51,17 +51,9 @@ void write_log(char *wtmpfile)
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;

View file

@ -383,13 +383,8 @@ int crash_check()
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
);
close(fd);
return crashed;

View file

@ -15,9 +15,7 @@
#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> */

View file

@ -6,7 +6,6 @@
PROG= syslogd
PIDFILE= -DPIDFILE=\"/var/run/syslogd.pid\"
CPPFLAGS+= -Ddebug=0 ${PIDFILE}
CPPFLAGS+= -D__NBSD_LIBC
BINMODE= 700
MAN=

View file

@ -498,11 +498,7 @@ void cfline(char *line, struct filed * fLog)
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);
@ -520,11 +516,7 @@ void cfline(char *line, struct filed * fLog)
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);

View file

@ -1,8 +1,6 @@
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>

View file

@ -2,7 +2,4 @@ PROG= udpstat
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>

View file

@ -1,7 +1,4 @@
PROG= writeisofs
MAN=
# LSC Prevent redefinition ot types
CPPFLAGS.writeisofs.c+= -D__NBSD_LIBC
.include <bsd.prog.mk>

View file

@ -21,12 +21,6 @@
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

View file

@ -12,11 +12,7 @@ that data into a seed for a psuedo random number generator.
#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

View file

@ -1,5 +1,3 @@
#ifdef __NBSD_LIBC
#endif
int env_parse(char *env, char *fmt, int field, long *param, long min,
long max);
void env_panic(char *env);

View file

@ -6,13 +6,7 @@
#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 */
@ -27,7 +21,6 @@
#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);

View file

@ -1,8 +1,6 @@
#ifndef _IPC_H
#define _IPC_H
#ifdef __NBSD_LIBC
#endif
#include <minix/ipcconst.h>
#include <minix/type.h>
#include <minix/const.h>

View file

@ -5,12 +5,6 @@
/* 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);

View file

@ -9,9 +9,7 @@
#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;

View file

@ -74,18 +74,6 @@ struct termios {
#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 */

View file

@ -32,11 +32,7 @@ typedef struct dhcp {
#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. */

View file

@ -50,18 +50,11 @@
#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);

View file

@ -124,13 +124,9 @@ static struct block *block_alloc(size_t size)
assert(ptr_min < ptr_max);
/* select address at random */
#ifdef __NBSD_LIBC
tsc = 0;
#else
tsc = 0;
/* LSC Broken for now... */
/* LSC FIXME Broken for now... */
/* read_tsc_64(&tsc); */
#endif
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;

View file

@ -1,7 +1,6 @@
# $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

View file

@ -6,11 +6,7 @@ Created: Oct 2000 by Philip Homburg <philip@f-mnx.phicoh.com>
Generate 256-bit random numbers
*/
#ifdef __NBSD_LIBC
#include <sys/sha2.h>
#else
#include <minix/sha2.h>
#endif
#include "inet.h"
#include "rand256.h"

View file

@ -53,11 +53,7 @@ typedef int ioreq_t;
#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"

View file

@ -79,22 +79,16 @@ extern struct ip_conf ip_conf[IP_PORT_MAX];
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 */

View file

@ -4,7 +4,6 @@
PROG= init
SRCS= init.c
CPPFLAGS.init.c+= -D__NBSD_LIBC
MAN=
BINDIR?= /usr/sbin

View file

@ -29,16 +29,8 @@
#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 */
@ -65,9 +57,7 @@ void report(int fd, char *label);
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);
@ -192,13 +182,9 @@ int main(void)
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)
{
@ -238,12 +224,7 @@ void startup(int linenr, struct ttyent *ttyp)
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];
@ -276,44 +257,9 @@ void startup(int linenr, struct ttyent *ttyp)
_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)
@ -321,18 +267,10 @@ void startup(int linenr, struct ttyent *ttyp)
/* 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);
}

View file

@ -2,9 +2,7 @@
#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];

View file

@ -1,9 +1,7 @@
#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.
@ -17,10 +15,6 @@
struct direct {
ino_t mfs_d_ino;
char mfs_d_name[MFS_DIRSIZ];
#ifdef __NBSD_LIBC
} __packed;
#else
};
#endif
#endif /* _MFSDIR_H */

View file

@ -4,12 +4,7 @@
#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>

View file

@ -477,11 +477,7 @@ int do_svrctl()
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. */

View file

@ -547,11 +547,7 @@ static int copy_fdsets(struct selectentry *se, int nfds, int direction)
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;

View file

@ -22,7 +22,4 @@ LDADD+= -L/usr/pkg/compiler-rt/lib -lCompilerRT-Generic -lsys -lCompilerRT-Gener
# 3. Minimal C library
LDADD+= -lminc
# Some define still needed, hopefully will go away soon
CPPFLAGS+= -D__NBSD_LIBC
.include <bsd.prog.mk>

View file

@ -3,9 +3,6 @@ SRCS= mkfs.c
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

View file

@ -12,10 +12,6 @@
struct direct {
uint32_t mfs_d_ino;
char mfs_d_name[MFS_DIRSIZ];
#ifdef __NBSD_LIBC
} __packed;
#else
};
#endif
#endif /* _MFSDIR_H */

View file

@ -91,9 +91,7 @@ int extra_space_percent;
FILE *proto;
#if defined(__NBSD_LIBC) || !defined(__minix)
#define getline _mkfs_getline
#endif
int main(int argc, char **argv);
block_t sizeup(char *device);