Removing obsolete _NBSD_LIBC define
Change-Id: Ia6ce84ccdf36cf6f64540b990baaa7d85c53533d
This commit is contained in:
parent
afa4fd56ac
commit
f640210005
64 changed files with 15 additions and 605 deletions
|
@ -179,49 +179,28 @@ int main(int argc, char *argv[])
|
||||||
if (!(high_byte & 0x80)) /* class A or 0 */
|
if (!(high_byte & 0x80)) /* class A or 0 */
|
||||||
{
|
{
|
||||||
if (destination)
|
if (destination)
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
defaultmask= htonl(0xff000000);
|
defaultmask= htonl(0xff000000);
|
||||||
#else
|
|
||||||
defaultmask= HTONL(0xff000000);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!(high_byte & 0x40)) /* class B */
|
else if (!(high_byte & 0x40)) /* class B */
|
||||||
{
|
{
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
defaultmask= htonl(0xffff0000);
|
defaultmask= htonl(0xffff0000);
|
||||||
#else
|
|
||||||
defaultmask= HTONL(0xffff0000);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!(high_byte & 0x20)) /* class C */
|
else if (!(high_byte & 0x20)) /* class C */
|
||||||
{
|
{
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
defaultmask= htonl(0xffffff00);
|
defaultmask= htonl(0xffffff00);
|
||||||
#else
|
|
||||||
defaultmask= HTONL(0xffffff00);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else /* class D is multicast ... */
|
else /* class D is multicast ... */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s: Warning: Martian address '%s'\n",
|
fprintf(stderr, "%s: Warning: Martian address '%s'\n",
|
||||||
prog_name, inet_ntoa(destination));
|
prog_name, inet_ntoa(destination));
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
defaultmask= htonl(0xffffffff);
|
defaultmask= htonl(0xffffffff);
|
||||||
#else
|
|
||||||
defaultmask= HTONL(0xffffffff);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (destination & ~defaultmask)
|
if (destination & ~defaultmask)
|
||||||
{
|
{
|
||||||
/* host route */
|
/* host route */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
defaultmask= htonl(0xffffffff);
|
defaultmask= htonl(0xffffffff);
|
||||||
#else
|
|
||||||
defaultmask= HTONL(0xffffffff);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (!cidr)
|
if (!cidr)
|
||||||
netmask= defaultmask;
|
netmask= defaultmask;
|
||||||
|
|
|
@ -33,7 +33,7 @@ CLEANFILES+=${GENSRCS} ${GENHDRS}
|
||||||
DPADD+= ${LIBL} ${LIBEDIT}
|
DPADD+= ${LIBL} ${LIBEDIT}
|
||||||
LDADD+= -ll -ledit
|
LDADD+= -ll -ledit
|
||||||
|
|
||||||
CPPFLAGS+= -DSHELL -D__NBSD_LIBC
|
CPPFLAGS+= -DSHELL
|
||||||
CPPFLAGS+=${EDIT} ${NO_PATHS_H} ${NO_JOBS}
|
CPPFLAGS+=${EDIT} ${NO_PATHS_H} ${NO_JOBS}
|
||||||
|
|
||||||
CPPFLAGS+= -I. -I${.CURDIR}
|
CPPFLAGS+= -I. -I${.CURDIR}
|
||||||
|
|
|
@ -39,11 +39,7 @@ static char *cachefile= PATH_DHCPCACHE;
|
||||||
static int qflag; /* True if printing cached DHCP data. */
|
static int qflag; /* True if printing cached DHCP data. */
|
||||||
static int aflag, rflag; /* True if adding or deleting pool addresses. */
|
static int aflag, rflag; /* True if adding or deleting pool addresses. */
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#define BCAST_IP htonl(0xFFFFFFFFUL)
|
#define BCAST_IP htonl(0xFFFFFFFFUL)
|
||||||
#else
|
|
||||||
#define BCAST_IP HTONL(0xFFFFFFFFUL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We try to play with up to this many networks. */
|
/* We try to play with up to this many networks. */
|
||||||
#define N_NETS 32
|
#define N_NETS 32
|
||||||
|
@ -108,24 +104,13 @@ network_t *if2net(int n)
|
||||||
static ipaddr_t defaultmask(ipaddr_t ip)
|
static ipaddr_t defaultmask(ipaddr_t ip)
|
||||||
{
|
{
|
||||||
/* Compute netmask by the oldfashioned Class rules. */
|
/* Compute netmask by the oldfashioned Class rules. */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
if (B(&ip)[0] < 0x80) return htonl(0xFF000000UL); /* Class A. */
|
if (B(&ip)[0] < 0x80) return htonl(0xFF000000UL); /* Class A. */
|
||||||
if (B(&ip)[0] < 0xC0) return htonl(0xFFFF0000UL); /* Class B. */
|
if (B(&ip)[0] < 0xC0) return htonl(0xFFFF0000UL); /* Class B. */
|
||||||
if (B(&ip)[0] < 0xE0) return htonl(0xFFFFFF00UL); /* Class C. */
|
if (B(&ip)[0] < 0xE0) return htonl(0xFFFFFF00UL); /* Class C. */
|
||||||
return htonl(0xFFFFFFFFUL); /* Multicast? Shouldn't happen... */
|
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)
|
#define POOL_MAGIC htonl(0x81F85D00UL)
|
||||||
#else
|
|
||||||
#define POOL_MAGIC HTONL(0x81F85D00UL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct pool { /* Dynamic pool entry. */
|
typedef struct pool { /* Dynamic pool entry. */
|
||||||
u32_t magic; /* Pool file magic number. */
|
u32_t magic; /* Pool file magic number. */
|
||||||
|
|
|
@ -21,13 +21,8 @@
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
|
|
||||||
static ether_addr_t BCAST_ETH = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }};
|
static ether_addr_t BCAST_ETH = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }};
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#define BCAST_IP htonl(0xFFFFFFFFUL)
|
#define BCAST_IP htonl(0xFFFFFFFFUL)
|
||||||
#define LOCALHOST htonl(0x7F000001UL)
|
#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)
|
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. */
|
/* Fill in the Ethernet, IP and UDP headers. */
|
||||||
bp->eth->eh_dst= BCAST_ETH;
|
bp->eth->eh_dst= BCAST_ETH;
|
||||||
bp->eth->eh_src= np->eth;
|
bp->eth->eh_src= np->eth;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
bp->eth->eh_proto= htons(ETH_IP_PROTO);
|
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_vers_ihl= 0x45;
|
||||||
bp->ip->ih_tos= 0;
|
bp->ip->ih_tos= 0;
|
||||||
bp->ip->ih_length= htons(sizeof(ip_hdr_t)
|
bp->ip->ih_length= htons(sizeof(ip_hdr_t)
|
||||||
+ sizeof(udp_hdr_t) + udpio.uih_data_len);
|
+ sizeof(udp_hdr_t) + udpio.uih_data_len);
|
||||||
bp->ip->ih_id= 0;
|
bp->ip->ih_id= 0;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
bp->ip->ih_flags_fragoff= ntohs(0x4000);
|
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_ttl= IP_MAX_TTL;
|
||||||
bp->ip->ih_proto= IPPROTO_UDP;
|
bp->ip->ih_proto= IPPROTO_UDP;
|
||||||
bp->ip->ih_hdr_chk= 0;
|
bp->ip->ih_hdr_chk= 0;
|
||||||
|
@ -104,11 +91,7 @@ int ether2udp(buf_t *bp)
|
||||||
*/
|
*/
|
||||||
udp_io_hdr_t udpio;
|
udp_io_hdr_t udpio;
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
if (bp->eth->eh_proto != htons(ETH_IP_PROTO)
|
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_vers_ihl != 0x45
|
||||||
|| bp->ip->ih_proto != IPPROTO_UDP
|
|| bp->ip->ih_proto != IPPROTO_UDP
|
||||||
|| oneC_sum(0, bp->ip, 20) != (u16_t) ~0
|
|| 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));
|
memset(arp, 0, sizeof(*arp));
|
||||||
arp->dstaddr= BCAST_ETH;
|
arp->dstaddr= BCAST_ETH;
|
||||||
arp->srcaddr= np->eth;
|
arp->srcaddr= np->eth;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
arp->ethtype= htons(ETH_ARP_PROTO);
|
arp->ethtype= htons(ETH_ARP_PROTO);
|
||||||
arp->hdr= htons(ARP_ETHERNET);
|
arp->hdr= htons(ARP_ETHERNET);
|
||||||
arp->pro= htons(ETH_IP_PROTO);
|
arp->pro= htons(ETH_IP_PROTO);
|
||||||
arp->op= htons(ARP_REQUEST);
|
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->hln= 6;
|
||||||
arp->pln= 4;
|
arp->pln= 4;
|
||||||
|
|
||||||
|
@ -161,18 +137,10 @@ int is_arp_me(buf_t *bp, network_t *np)
|
||||||
*/
|
*/
|
||||||
arp46_t *arp= (arp46_t *) bp->eth;
|
arp46_t *arp= (arp46_t *) bp->eth;
|
||||||
|
|
||||||
if (
|
if (arp->ethtype == htons(ETH_ARP_PROTO)
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
arp->ethtype == htons(ETH_ARP_PROTO)
|
|
||||||
&& arp->hdr == htons(ARP_ETHERNET)
|
&& arp->hdr == htons(ARP_ETHERNET)
|
||||||
&& arp->pro == htons(ETH_IP_PROTO)
|
&& arp->pro == htons(ETH_IP_PROTO)
|
||||||
&& arp->op == htons(ARP_REPLY)
|
&& 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->spa, &np->ip, sizeof(np->ip)) == 0
|
||||||
&& memcmp(&arp->sha, &np->eth, sizeof(np->eth)) != 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_aes= 2;
|
||||||
icmp->ih_hun.ihh_ram.iram_lt= htons(DELTA_ADV);
|
icmp->ih_hun.ihh_ram.iram_lt= htons(DELTA_ADV);
|
||||||
((u32_t *) icmp->ih_dun.uhd_data)[0] = np->gateway;
|
((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);
|
((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= 0;
|
||||||
icmp->ih_chksum= ~oneC_sum(0, icmp, 16);
|
icmp->ih_chksum= ~oneC_sum(0, icmp, 16);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,7 @@
|
||||||
* @(#)diff.h 8.1 (Berkeley) 6/6/93
|
* @(#)diff.h 8.1 (Berkeley) 6/6/93
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <minix/config.h>
|
#include <minix/config.h>
|
||||||
#endif
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,6 @@ enum ntype {
|
||||||
N_PRUNE, N_REGEX, N_SIZE, N_TYPE, N_USER, N_XDEV, N_DELETE
|
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 */
|
/* node definition */
|
||||||
typedef struct _plandata {
|
typedef struct _plandata {
|
||||||
struct _plandata *next; /* next node */
|
struct _plandata *next; /* next node */
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
PROG= finger
|
PROG= finger
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
# LSC Force finger to use its local fwopen macro
|
|
||||||
CPPFLAGS.finger.c+=-D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -127,11 +127,9 @@ char *ctime();
|
||||||
|
|
||||||
char *prog_name;
|
char *prog_name;
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
/* Already defined in stdio.h */
|
/* Already defined in stdio.h */
|
||||||
#undef fwopen
|
#undef fwopen
|
||||||
#define fwopen finger_fwopen
|
#define fwopen finger_fwopen
|
||||||
#endif
|
|
||||||
|
|
||||||
int main (int argc, char *argv[]);
|
int main (int argc, char *argv[]);
|
||||||
static void doall(void);
|
static void doall(void);
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
PROG= fix
|
PROG= fix
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
# LSC Force fix to use its local definition of getline
|
|
||||||
CPPFLAGS.fix.c+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -38,10 +38,8 @@
|
||||||
|
|
||||||
char *prog = 0, *processing = 0;
|
char *prog = 0, *processing = 0;
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
/* getline() already declared in stdio.h */
|
/* getline() already declared in stdio.h */
|
||||||
#define getline fix_getline
|
#define getline fix_getline
|
||||||
#endif
|
|
||||||
char *getline(FILE *fp, char *b);
|
char *getline(FILE *fp, char *b);
|
||||||
char *range(char *s, int *p1, int *p2);
|
char *range(char *s, int *p1, int *p2);
|
||||||
int getcommand(FILE *fp, int *o1, int *o2, char *pcmd, int *n1, int
|
int getcommand(FILE *fp, int *o1, int *o2, char *pcmd, int *n1, int
|
||||||
|
|
|
@ -8,7 +8,4 @@ PROG= ftp
|
||||||
SRCS= ftp.c local.c file.c xfer.c other.c net.c crc.c
|
SRCS= ftp.c local.c file.c xfer.c other.c net.c crc.c
|
||||||
CPPFLAGS+= -DCRC_ONLY
|
CPPFLAGS+= -DCRC_ONLY
|
||||||
|
|
||||||
# LSC Force ftp.c to use its local definition of getline
|
|
||||||
CPPFLAGS+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -45,10 +45,8 @@ char *cmdargv[NUMARGS];
|
||||||
int printreply = 1;
|
int printreply = 1;
|
||||||
char reply[1024];
|
char reply[1024];
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
/* Already declared in stdio.h */
|
/* Already declared in stdio.h */
|
||||||
#define getline ftp_getline
|
#define getline ftp_getline
|
||||||
#endif
|
|
||||||
|
|
||||||
static void makeargs(char *buff);
|
static void makeargs(char *buff);
|
||||||
int DOver(void);
|
int DOver(void);
|
||||||
|
|
|
@ -104,11 +104,7 @@ struct servent *servent;
|
||||||
|
|
||||||
/* This HACK allows the server to establish data connections correctly */
|
/* This HACK allows the server to establish data connections correctly */
|
||||||
/* when using the loopback device to talk to ourselves */
|
/* when using the loopback device to talk to ourselves */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
if((hostip & ntohl(0xFF000000)) == inet_addr("127.0.0.0"))
|
if((hostip & ntohl(0xFF000000)) == inet_addr("127.0.0.0"))
|
||||||
#else
|
|
||||||
if((hostip & NTOHL(0xFF000000)) == inet_addr("127.0.0.0"))
|
|
||||||
#endif
|
|
||||||
hostip = myip;
|
hostip = myip;
|
||||||
|
|
||||||
if((tcp_device = getenv("TCP_DEVICE")) == NULL)
|
if((tcp_device = getenv("TCP_DEVICE")) == NULL)
|
||||||
|
@ -227,11 +223,7 @@ int wasopen;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ripaddr = hostip;
|
ripaddr = hostip;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
rport = htons(2);
|
rport = htons(2);
|
||||||
#else
|
|
||||||
rport = HTONS(20);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* here we set up a connection to listen on if not passive mode */
|
/* here we set up a connection to listen on if not passive mode */
|
||||||
/* otherwise we use this to connect for passive mode */
|
/* otherwise we use this to connect for passive mode */
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
PROG=gcov-pull
|
PROG=gcov-pull
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
CPPFLAGS.gcov-pull.c+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -9,9 +9,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifndef __NBSD_LIBC
|
|
||||||
#include <alloca.h>
|
|
||||||
#endif
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <minix/gcov.h>
|
#include <minix/gcov.h>
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
PROG= host
|
PROG= host
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
CPPFLAGS.host.c+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -64,12 +64,7 @@ extern int h_errno;
|
||||||
|
|
||||||
FILE *filePtr;
|
FILE *filePtr;
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
static struct __res_state orig;
|
static struct __res_state orig;
|
||||||
#else
|
|
||||||
struct state orig;
|
|
||||||
extern struct state _res;
|
|
||||||
#endif
|
|
||||||
static u8_t *cname = NULL;
|
static u8_t *cname = NULL;
|
||||||
int getclass = C_IN;
|
int getclass = C_IN;
|
||||||
int gettype, getdeftype = T_A;
|
int gettype, getdeftype = T_A;
|
||||||
|
@ -104,11 +99,7 @@ main(c, v)
|
||||||
char **v;
|
char **v;
|
||||||
{
|
{
|
||||||
char *domain;
|
char *domain;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
#else
|
|
||||||
ipaddr_t addr;
|
|
||||||
#endif
|
|
||||||
register struct hostent *hp;
|
register struct hostent *hp;
|
||||||
register char *s, *p;
|
register char *s, *p;
|
||||||
register int inverse = 0;
|
register int inverse = 0;
|
||||||
|
@ -192,33 +183,17 @@ main(c, v)
|
||||||
hperror(h_errno);
|
hperror(h_errno);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
memcpy(&_res.nsaddr.sin_addr, hp->h_addr, NS_INADDRSZ);
|
memcpy(&_res.nsaddr.sin_addr, hp->h_addr, NS_INADDRSZ);
|
||||||
#else
|
|
||||||
_res.nsaddr= *(ipaddr_t *)hp->h_addr;
|
|
||||||
#endif
|
|
||||||
printf("Using domain server:\n");
|
printf("Using domain server:\n");
|
||||||
printanswer(hp);
|
printanswer(hp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
_res.nsaddr.sin_family = AF_INET;
|
_res.nsaddr.sin_family = AF_INET;
|
||||||
_res.nsaddr.sin_addr = addr;
|
_res.nsaddr.sin_addr = addr;
|
||||||
_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
|
_res.nsaddr.sin_port = htons(NAMESERVER_PORT);
|
||||||
printf("Using domain server %s:\n",
|
printf("Using domain server %s:\n",
|
||||||
inet_ntoa(_res.nsaddr.sin_addr));
|
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];
|
domain = v[1];
|
||||||
|
@ -350,21 +325,12 @@ printanswer(hp)
|
||||||
register struct hostent *hp;
|
register struct hostent *hp;
|
||||||
{
|
{
|
||||||
register char **cp;
|
register char **cp;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
struct in_addr **hptr;
|
struct in_addr **hptr;
|
||||||
#else
|
|
||||||
register ipaddr_t **hptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("Name: %s\n", hp->h_name);
|
printf("Name: %s\n", hp->h_name);
|
||||||
printf("Address:");
|
printf("Address:");
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
for (hptr = (struct in_addr **)hp->h_addr_list; *hptr; hptr++)
|
for (hptr = (struct in_addr **)hp->h_addr_list; *hptr; hptr++)
|
||||||
printf(" %s", inet_ntoa(**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:");
|
printf("\nAliases:");
|
||||||
for (cp = hp->h_aliases; cp && *cp && **cp; cp++)
|
for (cp = hp->h_aliases; cp && *cp && **cp; cp++)
|
||||||
printf(" %s", *cp);
|
printf(" %s", *cp);
|
||||||
|
@ -519,37 +485,14 @@ printinfo(answer, eom, filter, isls)
|
||||||
arcount = ntohs(hp->dh_arcount);
|
arcount = ntohs(hp->dh_arcount);
|
||||||
if (_res.options & RES_DEBUG || (verbose && isls == 0))
|
if (_res.options & RES_DEBUG || (verbose && isls == 0))
|
||||||
printf("rcode = %d (%s), ancount=%d\n",
|
printf("rcode = %d (%s), ancount=%d\n",
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
hp->rcode,
|
hp->rcode,
|
||||||
DecodeError(hp->rcode),
|
DecodeError(hp->rcode),
|
||||||
#else
|
|
||||||
hp->dh_flag2 & DHF_RCODE,
|
|
||||||
DecodeError(hp->dh_flag2 & DHF_RCODE),
|
|
||||||
#endif
|
|
||||||
ancount);
|
ancount);
|
||||||
if (
|
if (hp->rcode != NOERROR || (ancount+nscount+arcount) == 0) {
|
||||||
#ifdef __NBSD_LIBC
|
switch (hp->rcode) {
|
||||||
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
|
|
||||||
) {
|
|
||||||
case NXDOMAIN:
|
case NXDOMAIN:
|
||||||
/* Check if it's an authoritive answer */
|
/* Check if it's an authoritive answer */
|
||||||
if (
|
if (hp->aa) {
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
hp->aa
|
|
||||||
#else
|
|
||||||
hp->dh_flag1 & DHF_AA
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
h_errno = HOST_NOT_FOUND;
|
h_errno = HOST_NOT_FOUND;
|
||||||
return(0);
|
return(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -592,13 +535,7 @@ printinfo(answer, eom, filter, isls)
|
||||||
cp += dn_skipname((u8_t *)cp,(u8_t *)eom) + QFIXEDSZ;
|
cp += dn_skipname((u8_t *)cp,(u8_t *)eom) + QFIXEDSZ;
|
||||||
}
|
}
|
||||||
if (ancount) {
|
if (ancount) {
|
||||||
if (!
|
if (!hp->aa)
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
hp->aa
|
|
||||||
#else
|
|
||||||
(hp->dh_flag1 & DHF_AA)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
if (verbose && isls == 0)
|
if (verbose && isls == 0)
|
||||||
printf("The following answer is not authoritative:\n");
|
printf("The following answer is not authoritative:\n");
|
||||||
while (--ancount >= 0 && cp && cp < eom) {
|
while (--ancount >= 0 && cp && cp < eom) {
|
||||||
|
@ -642,11 +579,7 @@ pr_rr(cp, msg, file, filter)
|
||||||
int filter;
|
int filter;
|
||||||
{
|
{
|
||||||
int type, class, dlen, n, c, proto, ttl;
|
int type, class, dlen, n, c, proto, ttl;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
struct in_addr inaddr;
|
struct in_addr inaddr;
|
||||||
#else
|
|
||||||
ipaddr_t inaddr;
|
|
||||||
#endif
|
|
||||||
u8_t *cp1;
|
u8_t *cp1;
|
||||||
struct protoent *protop;
|
struct protoent *protop;
|
||||||
struct servent *servp;
|
struct servent *servp;
|
||||||
|
@ -802,22 +735,6 @@ pr_rr(cp, msg, file, filter)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* Roy end */
|
/* 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:
|
case T_WKS:
|
||||||
if (dlen < sizeof(u_long) + 1)
|
if (dlen < sizeof(u_long) + 1)
|
||||||
break;
|
break;
|
||||||
|
@ -919,14 +836,6 @@ pr_type(type)
|
||||||
return("MAILA");
|
return("MAILA");
|
||||||
case T_ANY: /* matches any type */
|
case T_ANY: /* matches any type */
|
||||||
return("ANY");
|
return("ANY");
|
||||||
#ifndef __NBSD_LIBC
|
|
||||||
case T_UINFO:
|
|
||||||
return("UINFO");
|
|
||||||
case T_UID:
|
|
||||||
return("UID");
|
|
||||||
case T_GID:
|
|
||||||
return("GID");
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return (sprintf(nbuf, "%d", type) == EOF ? NULL : nbuf);
|
return (sprintf(nbuf, "%d", type) == EOF ? NULL : nbuf);
|
||||||
}
|
}
|
||||||
|
@ -1092,55 +1001,24 @@ ListHosts(namePtr, queryType)
|
||||||
}
|
}
|
||||||
if (_res.options & RES_DEBUG || verbose)
|
if (_res.options & RES_DEBUG || verbose)
|
||||||
printf("rcode = %d (%s), ancount=%d\n",
|
printf("rcode = %d (%s), ancount=%d\n",
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
answer.qb1.rcode,
|
answer.qb1.rcode,
|
||||||
DecodeError(answer.qb1.rcode),
|
DecodeError(answer.qb1.rcode),
|
||||||
ntohs(answer.qb1.ancount)
|
ntohs(answer.qb1.ancount));
|
||||||
#else
|
|
||||||
answer.qb1.dh_flag2 & DHF_RCODE,
|
|
||||||
DecodeError(answer.qb1.dh_flag2 & DHF_RCODE),
|
|
||||||
ntohs(answer.qb1.dh_ancount)
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Analyze response to our NS lookup
|
* Analyze response to our NS lookup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
nscount = ntohs(answer.qb1.ancount) +
|
nscount = ntohs(answer.qb1.ancount) +
|
||||||
ntohs(answer.qb1.nscount) +
|
ntohs(answer.qb1.nscount) +
|
||||||
ntohs(answer.qb1.arcount);
|
ntohs(answer.qb1.arcount);
|
||||||
#else
|
|
||||||
nscount = ntohs(answer.qb1.dh_ancount) + ntohs(answer.qb1.dh_nscount) +
|
|
||||||
ntohs(answer.qb1.dh_arcount);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if (
|
if (answer.qb1.rcode != NOERROR || nscount == 0) {
|
||||||
#ifdef __NBSD_LIBC
|
switch (answer.qb1.rcode) {
|
||||||
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
|
|
||||||
) {
|
|
||||||
case NXDOMAIN:
|
case NXDOMAIN:
|
||||||
/* Check if it's an authoritive answer */
|
/* Check if it's an authoritive answer */
|
||||||
if (
|
if (answer.qb1.aa) {
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
answer.qb1.aa
|
|
||||||
#else
|
|
||||||
answer.qb1.dh_flag1 & DHF_AA
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
|
|
||||||
printf("No such domain\n");
|
printf("No such domain\n");
|
||||||
} else {
|
} else {
|
||||||
printf("Unable to get information about domain -- try again later.\n");
|
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 |
|
tcpconf.nwtc_flags= NWTC_EXCL | NWTC_LP_SEL | NWTC_SET_RA |
|
||||||
NWTC_SET_RP;
|
NWTC_SET_RP;
|
||||||
tcpconf.nwtc_remaddr= *(ipaddr_t *)nsipaddr[thisns];
|
tcpconf.nwtc_remaddr= *(ipaddr_t *)nsipaddr[thisns];
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
tcpconf.nwtc_remport= _res.nsaddr.sin_port;
|
tcpconf.nwtc_remport= _res.nsaddr.sin_port;
|
||||||
#else
|
|
||||||
tcpconf.nwtc_remport= _res.nsport_list[0];
|
|
||||||
#endif
|
|
||||||
result= ioctl(tcp_fd, NWIOSTCPCONF, &tcpconf);
|
result= ioctl(tcp_fd, NWIOSTCPCONF, &tcpconf);
|
||||||
if (result == -1)
|
if (result == -1)
|
||||||
{
|
{
|
||||||
|
@ -1385,11 +1259,8 @@ again:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
i = buf.qb1.rcode;
|
i = buf.qb1.rcode;
|
||||||
#else
|
|
||||||
i = buf.qb1.dh_flag2 & DHF_RCODE;
|
|
||||||
#endif
|
|
||||||
if (i != NOERROR || ntohs(buf.qb1.dh_ancount) == 0) {
|
if (i != NOERROR || ntohs(buf.qb1.dh_ancount) == 0) {
|
||||||
if ((thisns+1) < numnsaddr &&
|
if ((thisns+1) < numnsaddr &&
|
||||||
(i == SERVFAIL || i == NOTIMP || i == REFUSED)) {
|
(i == SERVFAIL || i == NOTIMP || i == REFUSED)) {
|
||||||
|
@ -1449,11 +1320,7 @@ again:
|
||||||
fprintf(stderr,"ListHosts: error receiving zone transfer:\n");
|
fprintf(stderr,"ListHosts: error receiving zone transfer:\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" result: %s, answers = %d, authority = %d, additional = %d\n",
|
" result: %s, answers = %d, authority = %d, additional = %d\n",
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
resultcodes[headerPtr->rcode],
|
resultcodes[headerPtr->rcode],
|
||||||
#else
|
|
||||||
resultcodes[headerPtr->dh_flag2 & DHF_RCODE],
|
|
||||||
#endif
|
|
||||||
ntohs(headerPtr->dh_ancount),
|
ntohs(headerPtr->dh_ancount),
|
||||||
ntohs(headerPtr->dh_nscount),
|
ntohs(headerPtr->dh_nscount),
|
||||||
ntohs(headerPtr->dh_arcount));
|
ntohs(headerPtr->dh_arcount));
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
PROG= hostaddr
|
PROG= hostaddr
|
||||||
BINMODE= 4755
|
BINMODE= 4755
|
||||||
MAN=
|
MAN=
|
||||||
CPPFLAGS+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -16,9 +16,7 @@ Created: Jan 27, 1992 by Philip Homburg
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <net/netlib.h>
|
#include <net/netlib.h>
|
||||||
#include <net/hton.h>
|
#include <net/hton.h>
|
||||||
|
|
|
@ -35,17 +35,6 @@
|
||||||
|
|
||||||
/* remove _() stuff */
|
/* remove _() stuff */
|
||||||
#define _(a) a
|
#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,
|
/* SHM_DEST and SHM_LOCKED are defined in kernel headers,
|
||||||
|
|
|
@ -229,11 +229,7 @@ void time_functions(void)
|
||||||
icmp_hdr= (icmp_hdr_t *) (ip_hdr + 1);
|
icmp_hdr= (icmp_hdr_t *) (ip_hdr + 1);
|
||||||
|
|
||||||
ip_hdr->ih_vers_ihl= 0x45;
|
ip_hdr->ih_vers_ihl= 0x45;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
ip_hdr->ih_dst= htonl(0xFFFFFFFFL);
|
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_type= ICMP_TYPE_ROUTE_SOL;
|
||||||
icmp_hdr->ih_code= 0;
|
icmp_hdr->ih_code= 0;
|
||||||
icmp_hdr->ih_chksum= 0;
|
icmp_hdr->ih_chksum= 0;
|
||||||
|
@ -256,11 +252,7 @@ void time_functions(void)
|
||||||
* broadcast them (to keep bad hosts up.)
|
* broadcast them (to keep bad hosts up.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
advertize(bcast ? htonl(0xFFFFFFFFL) : htonl(0x7F000001L));
|
advertize(bcast ? htonl(0xFFFFFFFFL) : htonl(0x7F000001L));
|
||||||
#else
|
|
||||||
advertize(bcast ? HTONL(0xFFFFFFFFL) : HTONL(0x7F000001L));
|
|
||||||
#endif
|
|
||||||
next_advert= now + MaxAdvertisementInterval;
|
next_advert= now + MaxAdvertisementInterval;
|
||||||
#if !__minix_vmd
|
#if !__minix_vmd
|
||||||
/* Make sure we are listening to RIP now. */
|
/* Make sure we are listening to RIP now. */
|
||||||
|
@ -577,11 +569,7 @@ int main(int argc, char **argv)
|
||||||
ipopt.nwio_ttl= 1;
|
ipopt.nwio_ttl= 1;
|
||||||
ipopt.nwio_df= 0;
|
ipopt.nwio_df= 0;
|
||||||
ipopt.nwio_hdropt.iho_opt_siz= 0;
|
ipopt.nwio_hdropt.iho_opt_siz= 0;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
ipopt.nwio_rem= htonl(0xFFFFFFFFL);
|
ipopt.nwio_rem= htonl(0xFFFFFFFFL);
|
||||||
#else
|
|
||||||
ipopt.nwio_rem= HTONL(0xFFFFFFFFL);
|
|
||||||
#endif
|
|
||||||
ipopt.nwio_proto= IPPROTO_ICMP;
|
ipopt.nwio_proto= IPPROTO_ICMP;
|
||||||
|
|
||||||
if (ioctl(irdp_fd, NWIOSIPOPT, &ipopt) < 0)
|
if (ioctl(irdp_fd, NWIOSIPOPT, &ipopt) < 0)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
PROG= logger
|
PROG= logger
|
||||||
MAN=
|
MAN=
|
||||||
CPPFLAGS.logger.c+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -100,22 +100,14 @@ int pencode(char *s)
|
||||||
for (save = s; *s && *s != '.'; ++s);
|
for (save = s; *s && *s != '.'; ++s);
|
||||||
if (*s) {
|
if (*s) {
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
fac = decode(save, facilitynames);
|
fac = decode(save, facilitynames);
|
||||||
#else
|
|
||||||
fac = decode(save, FacNames);
|
|
||||||
#endif
|
|
||||||
if (fac < 0) bailout("unknown facility name:", save);
|
if (fac < 0) bailout("unknown facility name:", save);
|
||||||
*s++ = '.';
|
*s++ = '.';
|
||||||
} else {
|
} else {
|
||||||
fac = 0;
|
fac = 0;
|
||||||
s = save;
|
s = save;
|
||||||
}
|
}
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
lev = decode(s, prioritynames);
|
lev = decode(s, prioritynames);
|
||||||
#else
|
|
||||||
lev = decode(s, PriNames);
|
|
||||||
#endif
|
|
||||||
if (lev < 0) bailout("unknown priority name:", save);
|
if (lev < 0) bailout("unknown priority name:", save);
|
||||||
return((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
|
return((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <compat/a.out.h>
|
#include <compat/a.out.h>
|
||||||
#else
|
|
||||||
#include <minix/a.out.h>
|
|
||||||
#endif
|
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
|
|
||||||
#define NN_UNDF 0
|
#define NN_UNDF 0
|
||||||
|
|
|
@ -74,24 +74,9 @@ int Printf(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int retval;
|
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);
|
va_start(ap, format);
|
||||||
|
|
||||||
retval = vsnprintf(outbuf, OUTBUFSIZE, format, ap);
|
retval = vsnprintf(outbuf, OUTBUFSIZE, format, ap);
|
||||||
#endif
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
outstr(outbuf);
|
outstr(outbuf);
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
PROG= nonamed
|
PROG= nonamed
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
CPPFLAGS+=-D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -26,10 +26,8 @@ static const char version[] = "2.7";
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/asynchio.h>
|
#include <sys/asynchio.h>
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/nameser.h>
|
#include <arpa/nameser.h>
|
||||||
#endif
|
|
||||||
#include <net/hton.h>
|
#include <net/hton.h>
|
||||||
#include <net/netlib.h>
|
#include <net/netlib.h>
|
||||||
#include <net/gen/in.h>
|
#include <net/gen/in.h>
|
||||||
|
@ -47,12 +45,10 @@ static const char version[] = "2.7";
|
||||||
|
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#undef HTONL
|
#undef HTONL
|
||||||
#undef HTONS
|
#undef HTONS
|
||||||
#define HTONL htonl
|
#define HTONL htonl
|
||||||
#define HTONS htons
|
#define HTONS htons
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HTTL 3600L /* Default time to live for /etc/hosts data. */
|
#define HTTL 3600L /* Default time to live for /etc/hosts data. */
|
||||||
#define SHORT_TIMEOUT 2 /* If you expect an answer soon. */
|
#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;
|
if (size < sizeof(HEADER)) return;
|
||||||
|
|
||||||
printf("%*s", indent, "");
|
printf("%*s", indent, "");
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
printf("DNS %s:", (dp->hdr.qr) ? "reply" : "query");
|
printf("DNS %s:", (dp->hdr.qr) ? "reply" : "query");
|
||||||
r = dp->hdr.rcode;
|
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));
|
printf(" %s", r < arraysize(rcodes) ? rcodes[r] : itoa("ERR_%lu", r));
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
if (dp->hdr.aa) printf(" AA");
|
if (dp->hdr.aa) printf(" AA");
|
||||||
if (dp->hdr.tc) printf(" TC");
|
if (dp->hdr.tc) printf(" TC");
|
||||||
if (dp->hdr.rd) printf(" RD");
|
if (dp->hdr.rd) printf(" RD");
|
||||||
if (dp->hdr.ra) printf(" RA");
|
if (dp->hdr.ra) printf(" RA");
|
||||||
if (dp->hdr.ad) printf(" AD");
|
if (dp->hdr.ad) printf(" AD");
|
||||||
if (dp->hdr.cd) printf(" CD");
|
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);
|
fputc('\n', stdout);
|
||||||
|
|
||||||
count[0]= ntohs(dp->hdr.dh_qdcount);
|
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;
|
dlim= dns2oct(dp) + size;
|
||||||
if (size < sizeof(HEADER)) return 0;
|
if (size < sizeof(HEADER)) return 0;
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
rcode= dp->hdr.rcode;
|
rcode= dp->hdr.rcode;
|
||||||
#else
|
|
||||||
rcode= dp->hdr.dh_flag2 & DHF_RCODE;
|
|
||||||
#endif
|
|
||||||
count[0]= ntohs(dp->hdr.dh_qdcount);
|
count[0]= ntohs(dp->hdr.dh_qdcount);
|
||||||
count[1]= ntohs(dp->hdr.dh_ancount);
|
count[1]= ntohs(dp->hdr.dh_ancount);
|
||||||
count[2]= ntohs(dp->hdr.dh_nscount);
|
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;
|
if (single) return 0;
|
||||||
|
|
||||||
/* Assume we can answer. */
|
/* Assume we can answer. */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
dns.hdr.qr = 1;
|
dns.hdr.qr = 1;
|
||||||
dns.hdr.opcode = 0;
|
dns.hdr.opcode = 0;
|
||||||
dns.hdr.aa = 1;
|
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.ad = 0;
|
||||||
dns.hdr.cd = 0;
|
dns.hdr.cd = 0;
|
||||||
dns.hdr.rcode = 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_qdcount= HTONS(1);
|
||||||
ancount= 0;
|
ancount= 0;
|
||||||
dns.hdr.dh_nscount= HTONS(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;
|
if (type != HTONS(T_TXT) || namecmp(qname, "version.bind") != 0) return 0;
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
dns.hdr.qr = 1;
|
dns.hdr.qr = 1;
|
||||||
dns.hdr.opcode = 0;
|
dns.hdr.opcode = 0;
|
||||||
dns.hdr.aa = 1;
|
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.ad = 0;
|
||||||
dns.hdr.cd = 0;
|
dns.hdr.cd = 0;
|
||||||
dns.hdr.rcode = 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_qdcount= HTONS(1);
|
||||||
dns.hdr.dh_ancount= HTONS(1);
|
dns.hdr.dh_ancount= HTONS(1);
|
||||||
dns.hdr.dh_nscount= HTONS(0);
|
dns.hdr.dh_nscount= HTONS(0);
|
||||||
|
@ -1162,11 +1128,7 @@ static void cache_reply(dns_t *dp, size_t dlen)
|
||||||
u8_t name[MAXDNAME];
|
u8_t name[MAXDNAME];
|
||||||
u32_t minttl;
|
u32_t minttl;
|
||||||
|
|
||||||
#if __NBSD_LIBC
|
|
||||||
if ((dp->hdr.rd && !dp->hdr.tc)) return;
|
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;
|
if (dp->hdr.dh_qdcount != HTONS(1)) return;
|
||||||
cp= dp->data;
|
cp= dp->data;
|
||||||
r= dn_expand(dns2oct(dp), dns2oct(dp) + dlen, cp, name, MAXDNAME);
|
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. */
|
/* Remember ID and RD. */
|
||||||
id= dp->hdr.dh_id;
|
id= dp->hdr.dh_id;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
rd= dp->hdr.rd;
|
rd= dp->hdr.rd;
|
||||||
#else
|
|
||||||
rd= dp->hdr.dh_flag1 & DHF_RD;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
/* Malformed query, reply "FORMERR". */
|
/* Malformed query, reply "FORMERR". */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
dp->hdr.tc = 0;
|
dp->hdr.tc = 0;
|
||||||
dp->hdr.qr = 1;
|
dp->hdr.qr = 1;
|
||||||
dp->hdr.aa = 1;
|
dp->hdr.aa = 1;
|
||||||
dp->hdr.unused = 0;
|
dp->hdr.unused = 0;
|
||||||
dp->hdr.ra = 1;
|
dp->hdr.ra = 1;
|
||||||
dp->hdr.rcode = FORMERR;
|
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
|
} else
|
||||||
if (class == HTONS(C_IN) && query_hosts(name, type, dp, pdlen)) {
|
if (class == HTONS(C_IN) && query_hosts(name, type, dp, pdlen)) {
|
||||||
/* Answer to this query is in the hosts file. */
|
/* 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) {
|
if (class == HTONS(C_IN) && (qp= get_query(name, type)) != nil) {
|
||||||
/* Answer to this query is present in the cache. */
|
/* Answer to this query is present in the cache. */
|
||||||
memcpy(dp, &qp->dns, dlen= qp->size);
|
memcpy(dp, &qp->dns, dlen= qp->size);
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
dp->hdr.aa = 1;
|
dp->hdr.aa = 1;
|
||||||
#else
|
|
||||||
dp->hdr.dh_flag1 &= ~DHF_AA;
|
|
||||||
#endif
|
|
||||||
(void) dns_ttl(dp, dlen, now - qp->age);
|
(void) dns_ttl(dp, dlen, now - qp->age);
|
||||||
if (rd) {
|
if (rd) {
|
||||||
if (qp->stale <= now) {
|
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
|
/* No real name daemon present, or this name has a repeated top level
|
||||||
* domain sequence. Reply "no such domain".
|
* domain sequence. Reply "no such domain".
|
||||||
*/
|
*/
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
dp->hdr.tc = 0;
|
dp->hdr.tc = 0;
|
||||||
dp->hdr.qr = 1;
|
dp->hdr.qr = 1;
|
||||||
dp->hdr.aa = 1;
|
dp->hdr.aa = 1;
|
||||||
dp->hdr.unused = 0;
|
dp->hdr.unused = 0;
|
||||||
dp->hdr.ra = 1;
|
dp->hdr.ra = 1;
|
||||||
dp->hdr.rcode = NXDOMAIN;
|
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
|
} else
|
||||||
if (!rd) {
|
if (!rd) {
|
||||||
/* "Recursion Desired" is off, so don't bother to relay. */
|
/* "Recursion Desired" is off, so don't bother to relay. */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
dp->hdr.tc = 0;
|
dp->hdr.tc = 0;
|
||||||
dp->hdr.qr = 1;
|
dp->hdr.qr = 1;
|
||||||
dp->hdr.unused = 0;
|
dp->hdr.unused = 0;
|
||||||
dp->hdr.ra = 1;
|
dp->hdr.ra = 1;
|
||||||
dp->hdr.rcode = NOERROR;
|
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 {
|
} else {
|
||||||
/* Caller needs to consult with a real name daemon. */
|
/* Caller needs to consult with a real name daemon. */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1337,12 +1270,7 @@ static int compose_reply(dns_t *dp, size_t *pdlen)
|
||||||
|
|
||||||
/* Copy ID and RD back to answer. */
|
/* Copy ID and RD back to answer. */
|
||||||
dp->hdr.dh_id= id;
|
dp->hdr.dh_id= id;
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
dp->hdr.rd = rd;
|
dp->hdr.rd = rd;
|
||||||
#else
|
|
||||||
dp->hdr.dh_flag1 &= ~DHF_RD;
|
|
||||||
dp->hdr.dh_flag1 |= rd;
|
|
||||||
#endif
|
|
||||||
*pdlen= dlen;
|
*pdlen= dlen;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1395,7 +1323,6 @@ static void refresh_cache(void)
|
||||||
dlen= cp - dns2oct(&udp.dns);
|
dlen= cp - dns2oct(&udp.dns);
|
||||||
|
|
||||||
udp.dns.hdr.dh_id= new_id(ID_REFRESH, my_port, ID_IPSELF);
|
udp.dns.hdr.dh_id= new_id(ID_REFRESH, my_port, ID_IPSELF);
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
udp.dns.hdr.qr = 0;
|
udp.dns.hdr.qr = 0;
|
||||||
udp.dns.hdr.opcode = 0;
|
udp.dns.hdr.opcode = 0;
|
||||||
udp.dns.hdr.aa = 0;
|
udp.dns.hdr.aa = 0;
|
||||||
|
@ -1407,10 +1334,6 @@ static void refresh_cache(void)
|
||||||
udp.dns.hdr.ad = 0;
|
udp.dns.hdr.ad = 0;
|
||||||
udp.dns.hdr.cd = 0;
|
udp.dns.hdr.cd = 0;
|
||||||
udp.dns.hdr.rcode = 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_qdcount= HTONS(1);
|
||||||
udp.dns.hdr.dh_ancount= HTONS(0);
|
udp.dns.hdr.dh_ancount= HTONS(0);
|
||||||
udp.dns.hdr.dh_nscount= 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. */
|
/* Check, and if necessary reinitialize my configuration. */
|
||||||
init_config(udp.hdr.uih_dst_addr);
|
init_config(udp.hdr.uih_dst_addr);
|
||||||
|
|
||||||
if (
|
if (udp.dns.hdr.qr) {
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
udp.dns.hdr.qr
|
|
||||||
#else
|
|
||||||
udp.dns.hdr.dh_flag1 & DHF_QR
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
/* This is a remote named reply, not a query. */
|
/* This is a remote named reply, not a query. */
|
||||||
|
|
||||||
/* Response to a query previously relayed? */
|
/* 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?"
|
* "What are the name servers for the root domain?"
|
||||||
*/
|
*/
|
||||||
udp.dns.hdr.dh_id= new_id(ID_PROBE, my_port, ID_IPSELF);
|
udp.dns.hdr.dh_id= new_id(ID_PROBE, my_port, ID_IPSELF);
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
udp.dns.hdr.qr = 0;
|
udp.dns.hdr.qr = 0;
|
||||||
udp.dns.hdr.opcode = 0;
|
udp.dns.hdr.opcode = 0;
|
||||||
udp.dns.hdr.aa = 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.ad = 0;
|
||||||
udp.dns.hdr.cd = 0;
|
udp.dns.hdr.cd = 0;
|
||||||
udp.dns.hdr.rcode = 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_qdcount= HTONS(1);
|
||||||
udp.dns.hdr.dh_ancount= HTONS(0);
|
udp.dns.hdr.dh_ancount= HTONS(0);
|
||||||
udp.dns.hdr.dh_nscount= HTONS(0);
|
udp.dns.hdr.dh_nscount= HTONS(0);
|
||||||
|
|
|
@ -23,10 +23,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#define setkey pwdauth_setkey
|
#define setkey pwdauth_setkey
|
||||||
#define encrypt pwdauth_encrypt
|
#define encrypt pwdauth_encrypt
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LEN 1024
|
#define LEN 1024
|
||||||
|
|
||||||
|
|
|
@ -40,10 +40,8 @@ Changed: Dec 11, 2000 by Kees J. Bot
|
||||||
#define MAX_RARP_RETRIES 5
|
#define MAX_RARP_RETRIES 5
|
||||||
#define RARP_TIMEOUT 5
|
#define RARP_TIMEOUT 5
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#undef HTONS
|
#undef HTONS
|
||||||
#define HTONS htons
|
#define HTONS htons
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct rarp46
|
typedef struct rarp46
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,4 @@ SYMLINKS+= ${BINDIR}/reboot /usr/bin/reboot
|
||||||
MAN.shutdown=
|
MAN.shutdown=
|
||||||
MAN.halt=
|
MAN.halt=
|
||||||
|
|
||||||
CPPFLAGS+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -51,17 +51,9 @@ void write_log(char *wtmpfile)
|
||||||
fd = open(wtmpfile,O_APPEND|O_WRONLY|O_CREAT,1);
|
fd = open(wtmpfile,O_APPEND|O_WRONLY|O_CREAT,1);
|
||||||
if (fd) {
|
if (fd) {
|
||||||
if (strcmp(prog,"reboot"))
|
if (strcmp(prog,"reboot"))
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
strcpy (wtmp.ut_name, prog);
|
strcpy (wtmp.ut_name, prog);
|
||||||
#else
|
|
||||||
strcpy (wtmp.ut_user, prog);
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
strcpy (wtmp.ut_name, "shutdown"); /* last ... */
|
strcpy (wtmp.ut_name, "shutdown"); /* last ... */
|
||||||
#else
|
|
||||||
strcpy (wtmp.ut_user, "shutdown"); /* last ... */
|
|
||||||
#endif
|
|
||||||
strcpy (wtmp.ut_id, "~~");
|
strcpy (wtmp.ut_id, "~~");
|
||||||
strcpy (wtmp.ut_line, "~");
|
strcpy (wtmp.ut_line, "~");
|
||||||
wtmp.ut_pid = 0;
|
wtmp.ut_pid = 0;
|
||||||
|
|
|
@ -383,13 +383,8 @@ int crash_check()
|
||||||
crashed = (lseek(fd, - (off_t) sizeof(last), SEEK_END) == -1
|
crashed = (lseek(fd, - (off_t) sizeof(last), SEEK_END) == -1
|
||||||
|| read(fd, (void *) &last, sizeof(last)) != sizeof(last)
|
|| read(fd, (void *) &last, sizeof(last)) != sizeof(last)
|
||||||
|| last.ut_line[0] != '~'
|
|| last.ut_line[0] != '~'
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
|| (strncmp(last.ut_name, "shutdown", sizeof(last.ut_name))
|
|| (strncmp(last.ut_name, "shutdown", sizeof(last.ut_name))
|
||||||
&& strncmp(last.ut_name, "halt", 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);
|
close(fd);
|
||||||
return crashed;
|
return crashed;
|
||||||
|
|
|
@ -15,9 +15,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Default settings, the Minix ones are defined in <termios.h> */
|
/* Default settings, the Minix ones are defined in <termios.h> */
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
PROG= syslogd
|
PROG= syslogd
|
||||||
PIDFILE= -DPIDFILE=\"/var/run/syslogd.pid\"
|
PIDFILE= -DPIDFILE=\"/var/run/syslogd.pid\"
|
||||||
CPPFLAGS+= -Ddebug=0 ${PIDFILE}
|
CPPFLAGS+= -Ddebug=0 ${PIDFILE}
|
||||||
CPPFLAGS+= -D__NBSD_LIBC
|
|
||||||
BINMODE= 700
|
BINMODE= 700
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
|
|
|
@ -498,11 +498,7 @@ void cfline(char *line, struct filed * fLog)
|
||||||
while (strchr(", ;", *q)) q++;
|
while (strchr(", ;", *q)) q++;
|
||||||
|
|
||||||
/* Decode priority name */
|
/* Decode priority name */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
pri = decode(buf, prioritynames);
|
pri = decode(buf, prioritynames);
|
||||||
#else
|
|
||||||
pri = decode(buf, PriNames);
|
|
||||||
#endif
|
|
||||||
if (pri < 0) {
|
if (pri < 0) {
|
||||||
sprintf(xbuf, "unknown priority name \"%s\"", buf);
|
sprintf(xbuf, "unknown priority name \"%s\"", buf);
|
||||||
logerror(xbuf);
|
logerror(xbuf);
|
||||||
|
@ -520,11 +516,7 @@ void cfline(char *line, struct filed * fLog)
|
||||||
fLog->f_pmask[ix] = pri;
|
fLog->f_pmask[ix] = pri;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
ix = decode(buf, facilitynames);
|
ix = decode(buf, facilitynames);
|
||||||
#else
|
|
||||||
ix = decode(buf, FacNames);
|
|
||||||
#endif
|
|
||||||
if (ix < 0) {
|
if (ix < 0) {
|
||||||
sprintf(xbuf, "unknown facility name \"%s\"", buf);
|
sprintf(xbuf, "unknown facility name \"%s\"", buf);
|
||||||
logerror(xbuf);
|
logerror(xbuf);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
PROG= tcpstat
|
PROG= tcpstat
|
||||||
CPPFLAGS+= -I${NETBSDSRCDIR}/servers -D'ARGS(a)=a'
|
CPPFLAGS+= -I${NETBSDSRCDIR}/servers -D'ARGS(a)=a'
|
||||||
|
|
||||||
# LSC Force inet.h to use ioc_net.h
|
|
||||||
CPPFLAGS+= -D__NBSD_LIBC
|
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -2,7 +2,4 @@ PROG= udpstat
|
||||||
CPPFLAGS+= -I${NETBSDSRCDIR}/servers -D'ARGS(a)=a'
|
CPPFLAGS+= -I${NETBSDSRCDIR}/servers -D'ARGS(a)=a'
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
# LSC Force inet.h to use sys/ioc_net.h
|
|
||||||
CPPFLAGS+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
PROG= writeisofs
|
PROG= writeisofs
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
# LSC Prevent redefinition ot types
|
|
||||||
CPPFLAGS.writeisofs.c+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -21,12 +21,6 @@
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind;
|
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
|
#ifndef min
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,11 +12,7 @@ that data into a seed for a psuedo random number generator.
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
|
|
||||||
#include "random.h"
|
#include "random.h"
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <sys/sha2.h>
|
#include <sys/sha2.h>
|
||||||
#else
|
|
||||||
#include <minix/sha2.h>
|
|
||||||
#endif
|
|
||||||
#include "aes/rijndael.h"
|
#include "aes/rijndael.h"
|
||||||
|
|
||||||
#define N_DERIV 16
|
#define N_DERIV 16
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#endif
|
|
||||||
int env_parse(char *env, char *fmt, int field, long *param, long min,
|
int env_parse(char *env, char *fmt, int field, long *param, long min,
|
||||||
long max);
|
long max);
|
||||||
void env_panic(char *env);
|
void env_panic(char *env);
|
||||||
|
|
|
@ -6,13 +6,7 @@
|
||||||
#define _LIB_H
|
#define _LIB_H
|
||||||
|
|
||||||
/* First come the defines. */
|
/* First come the defines. */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <sys/featuretest.h> /* tell headers to include NetBSD stuff. */
|
#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. */
|
/* The following are so basic, all the lib files get them automatically. */
|
||||||
#include <minix/config.h> /* must be first */
|
#include <minix/config.h> /* must be first */
|
||||||
|
@ -27,7 +21,6 @@
|
||||||
|
|
||||||
#include <minix/ipc.h>
|
#include <minix/ipc.h>
|
||||||
|
|
||||||
|
|
||||||
int __execve(const char *_path, char *const _argv[], char *const
|
int __execve(const char *_path, char *const _argv[], char *const
|
||||||
_envp[], int _nargs, int _nenvps);
|
_envp[], int _nargs, int _nenvps);
|
||||||
int _syscall(endpoint_t _who, int _syscallnr, message *_msgptr);
|
int _syscall(endpoint_t _who, int _syscallnr, message *_msgptr);
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef _IPC_H
|
#ifndef _IPC_H
|
||||||
#define _IPC_H
|
#define _IPC_H
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#endif
|
|
||||||
#include <minix/ipcconst.h>
|
#include <minix/ipcconst.h>
|
||||||
#include <minix/type.h>
|
#include <minix/type.h>
|
||||||
#include <minix/const.h>
|
#include <minix/const.h>
|
||||||
|
|
|
@ -5,12 +5,6 @@
|
||||||
|
|
||||||
/* Miscellaneous BSD. */
|
/* Miscellaneous BSD. */
|
||||||
char *itoa(int _n);
|
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. */
|
/* Miscellaneous MINIX. */
|
||||||
void std_err(const char *_s);
|
void std_err(const char *_s);
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int mthread_thread_t;
|
typedef int mthread_thread_t;
|
||||||
typedef int mthread_once_t;
|
typedef int mthread_once_t;
|
||||||
|
|
|
@ -74,18 +74,6 @@ struct termios {
|
||||||
#define VSTART 9 /* cc_c[VSTART] = START char (^S) */
|
#define VSTART 9 /* cc_c[VSTART] = START char (^S) */
|
||||||
#define VSTOP 10 /* cc_c[VSTOP] = STOP char (^Q) */
|
#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. */
|
/* Values for the baud rate settings. POSIX Table 7-6. */
|
||||||
#define B0 0x0000 /* hang up the line */
|
#define B0 0x0000 /* hang up the line */
|
||||||
#define B50 0x1000 /* 50 baud */
|
#define B50 0x1000 /* 50 baud */
|
||||||
|
|
|
@ -32,11 +32,7 @@ typedef struct dhcp {
|
||||||
#define DHCP_FLAGS_BCAST 0x8000U /* Reply must be broadcast to client. */
|
#define DHCP_FLAGS_BCAST 0x8000U /* Reply must be broadcast to client. */
|
||||||
|
|
||||||
/* "Magic" first four option bytes. */
|
/* "Magic" first four option bytes. */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#define DHCP_MAGIC htonl(0x63825363UL)
|
#define DHCP_MAGIC htonl(0x63825363UL)
|
||||||
#else
|
|
||||||
#define DHCP_MAGIC HTONL(0x63825363UL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* DHCP common tags: */
|
/* DHCP common tags: */
|
||||||
#define DHCP_TAG_NETMASK 1 /* Netmask. */
|
#define DHCP_TAG_NETMASK 1 /* Netmask. */
|
||||||
|
|
|
@ -50,18 +50,11 @@
|
||||||
#error "Unknown byte order"
|
#error "Unknown byte order"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#define CONCAT(x,y) __CONCAT(x,y)
|
#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 __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)
|
#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(Addr);
|
||||||
__ElfType(Half);
|
__ElfType(Half);
|
||||||
|
|
|
@ -124,13 +124,9 @@ static struct block *block_alloc(size_t size)
|
||||||
assert(ptr_min < ptr_max);
|
assert(ptr_min < ptr_max);
|
||||||
|
|
||||||
/* select address at random */
|
/* select address at random */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
tsc = 0;
|
tsc = 0;
|
||||||
#else
|
/* LSC FIXME Broken for now... */
|
||||||
tsc = 0;
|
/* read_tsc_64(&tsc); */
|
||||||
/* LSC Broken for now... */
|
|
||||||
/* read_tsc_64(&tsc); */
|
|
||||||
#endif
|
|
||||||
totalsize = block_get_totalsize(size);
|
totalsize = block_get_totalsize(size);
|
||||||
page_index_max = (ptr_max - ptr_min - totalsize) / PAGE_SIZE;
|
page_index_max = (ptr_max - ptr_min - totalsize) / PAGE_SIZE;
|
||||||
page_index = (page_index_max > 0) ? (ex64lo(tsc) % page_index_max) : 0;
|
page_index = (page_index_max > 0) ? (ex64lo(tsc) % page_index_max) : 0;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# $NetBSD: Makefile.inc,v 1.9 2012/06/19 06:10:09 dholland Exp $
|
# $NetBSD: Makefile.inc,v 1.9 2012/06/19 06:10:09 dholland Exp $
|
||||||
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
|
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
|
||||||
.if defined(__MINIX)
|
.if defined(__MINIX)
|
||||||
CPPFLAGS+= -D__NBSD_LIBC=1
|
|
||||||
USE_FORT?= no
|
USE_FORT?= no
|
||||||
.else
|
.else
|
||||||
USE_FORT?= yes # network server
|
USE_FORT?= yes # network server
|
||||||
|
|
|
@ -6,11 +6,7 @@ Created: Oct 2000 by Philip Homburg <philip@f-mnx.phicoh.com>
|
||||||
Generate 256-bit random numbers
|
Generate 256-bit random numbers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <sys/sha2.h>
|
#include <sys/sha2.h>
|
||||||
#else
|
|
||||||
#include <minix/sha2.h>
|
|
||||||
#endif
|
|
||||||
#include "inet.h"
|
#include "inet.h"
|
||||||
#include "rand256.h"
|
#include "rand256.h"
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,7 @@ typedef int ioreq_t;
|
||||||
#include <net/gen/udp_io.h>
|
#include <net/gen/udp_io.h>
|
||||||
|
|
||||||
#include <net/gen/arp_io.h>
|
#include <net/gen/arp_io.h>
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <sys/ioc_net.h>
|
#include <sys/ioc_net.h>
|
||||||
#else
|
|
||||||
#include <net/ioctl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "inet_config.h"
|
#include "inet_config.h"
|
||||||
|
|
|
@ -79,22 +79,16 @@ extern struct ip_conf ip_conf[IP_PORT_MAX];
|
||||||
extern struct tcp_conf tcp_conf[IP_PORT_MAX];
|
extern struct tcp_conf tcp_conf[IP_PORT_MAX];
|
||||||
extern struct udp_conf udp_conf[IP_PORT_MAX];
|
extern struct udp_conf udp_conf[IP_PORT_MAX];
|
||||||
void read_conf(void);
|
void read_conf(void);
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
extern void *sbrk(int);
|
extern void *sbrk(int);
|
||||||
#else
|
|
||||||
extern char *sbrk(int);
|
|
||||||
#endif
|
|
||||||
void *alloc(size_t size);
|
void *alloc(size_t size);
|
||||||
|
|
||||||
/* Options */
|
/* Options */
|
||||||
extern int ip_forward_directed_bcast;
|
extern int ip_forward_directed_bcast;
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#undef HTONL
|
#undef HTONL
|
||||||
#undef HTONS
|
#undef HTONS
|
||||||
#define HTONL htonl
|
#define HTONL htonl
|
||||||
#define HTONS htons
|
#define HTONS htons
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* INET__INET_CONFIG_H */
|
#endif /* INET__INET_CONFIG_H */
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
PROG= init
|
PROG= init
|
||||||
SRCS= init.c
|
SRCS= init.c
|
||||||
|
|
||||||
CPPFLAGS.init.c+= -D__NBSD_LIBC
|
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
BINDIR?= /usr/sbin
|
BINDIR?= /usr/sbin
|
||||||
|
|
|
@ -29,16 +29,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
/* Different ttyent structure. */
|
/* Different ttyent structure. */
|
||||||
struct ttyent TT_REBOOT = { "console", "shutdown -d now CTRL-ALT_DEL", "-"};
|
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_UTMP[] = "/etc/utmp"; /* current logins */
|
||||||
char PATH_WTMP[] = "/usr/adm/wtmp"; /* login/logout history */
|
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 wtmp(int type, int linenr, char *line, pid_t pid);
|
||||||
void startup(int linenr, struct ttyent *ttyp);
|
void startup(int linenr, struct ttyent *ttyp);
|
||||||
int execute(char **cmd);
|
int execute(char **cmd);
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
char **construct_argv(char *cmd);
|
char **construct_argv(char *cmd);
|
||||||
#endif
|
|
||||||
void onhup(int sig);
|
void onhup(int sig);
|
||||||
void onterm(int sig);
|
void onterm(int sig);
|
||||||
void onabrt(int sig);
|
void onabrt(int sig);
|
||||||
|
@ -192,13 +182,9 @@ int main(void)
|
||||||
if ((ttyp = getttyent()) == NULL) break;
|
if ((ttyp = getttyent()) == NULL) break;
|
||||||
|
|
||||||
if (ttyp->ty_getty != NULL
|
if (ttyp->ty_getty != NULL
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
/* ty_getty is a string, and TTY_ON is
|
/* ty_getty is a string, and TTY_ON is
|
||||||
* the way to check for enabled ternimanls. */
|
* the way to check for enabled ternimanls. */
|
||||||
&& (ttyp->ty_status & TTY_ON)
|
&& (ttyp->ty_status & TTY_ON)
|
||||||
#else
|
|
||||||
&& ttyp->ty_getty[0] != NULL
|
|
||||||
#endif
|
|
||||||
&& slotp->pid == NO_PID
|
&& slotp->pid == NO_PID
|
||||||
&& slotp->errct < ERRCT_DISABLE)
|
&& slotp->errct < ERRCT_DISABLE)
|
||||||
{
|
{
|
||||||
|
@ -238,12 +224,7 @@ void startup(int linenr, struct ttyent *ttyp)
|
||||||
pid_t pid; /* new pid */
|
pid_t pid; /* new pid */
|
||||||
int err[2]; /* error reporting pipe */
|
int err[2]; /* error reporting pipe */
|
||||||
char line[32]; /* tty device name */
|
char line[32]; /* tty device name */
|
||||||
#ifndef __NBSD_LIBC
|
|
||||||
int status;
|
|
||||||
#endif
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
char **ty_getty_argv;
|
char **ty_getty_argv;
|
||||||
#endif
|
|
||||||
|
|
||||||
slotp = &slots[linenr];
|
slotp = &slots[linenr];
|
||||||
|
|
||||||
|
@ -276,44 +257,9 @@ void startup(int linenr, struct ttyent *ttyp)
|
||||||
_exit(1);
|
_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. */
|
/* Redirect standard error too. */
|
||||||
dup2(0, 2);
|
dup2(0, 2);
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
/* Construct argv for execute() */
|
/* Construct argv for execute() */
|
||||||
ty_getty_argv = construct_argv(ttyp->ty_getty);
|
ty_getty_argv = construct_argv(ttyp->ty_getty);
|
||||||
if (ty_getty_argv == NULL)
|
if (ty_getty_argv == NULL)
|
||||||
|
@ -321,18 +267,10 @@ void startup(int linenr, struct ttyent *ttyp)
|
||||||
|
|
||||||
/* Execute the getty process. */
|
/* Execute the getty process. */
|
||||||
execute(ty_getty_argv);
|
execute(ty_getty_argv);
|
||||||
#else
|
|
||||||
/* Execute the getty process. */
|
|
||||||
execute(ttyp->ty_getty);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Oops, disaster strikes. */
|
/* Oops, disaster strikes. */
|
||||||
fcntl(2, F_SETFL, fcntl(2, F_GETFL) | O_NONBLOCK);
|
fcntl(2, F_SETFL, fcntl(2, F_GETFL) | O_NONBLOCK);
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
if (linenr != 0) report(2, ty_getty_argv[0]);
|
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));
|
write(err[1], &errno, sizeof(errno));
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
#include <minix/com.h>
|
#include <minix/com.h>
|
||||||
#include <minix/vfsif.h>
|
#include <minix/vfsif.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#endif
|
|
||||||
#include "buf.h"
|
#include "buf.h"
|
||||||
|
|
||||||
static char getdents_buf[GETDENTS_BUFSIZ];
|
static char getdents_buf[GETDENTS_BUFSIZ];
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#ifndef _MFSDIR_H
|
#ifndef _MFSDIR_H
|
||||||
#define _MFSDIR_H
|
#define _MFSDIR_H
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#endif
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
/* Maximum Minix MFS on-disk directory filename.
|
/* Maximum Minix MFS on-disk directory filename.
|
||||||
|
@ -17,10 +15,6 @@
|
||||||
struct direct {
|
struct direct {
|
||||||
ino_t mfs_d_ino;
|
ino_t mfs_d_ino;
|
||||||
char mfs_d_name[MFS_DIRSIZ];
|
char mfs_d_name[MFS_DIRSIZ];
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
} __packed;
|
} __packed;
|
||||||
#else
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _MFSDIR_H */
|
#endif /* _MFSDIR_H */
|
||||||
|
|
|
@ -4,12 +4,7 @@
|
||||||
|
|
||||||
#define VERBOSE 0 /* display diagnostics */
|
#define VERBOSE 0 /* display diagnostics */
|
||||||
|
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
#include <sys/ioc_net.h>
|
#include <sys/ioc_net.h>
|
||||||
#else
|
|
||||||
#include <net/ioctl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
|
@ -477,11 +477,7 @@ int do_svrctl()
|
||||||
|
|
||||||
extern char *_brksize;
|
extern char *_brksize;
|
||||||
int brk(brk_addr)
|
int brk(brk_addr)
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
void *brk_addr;
|
void *brk_addr;
|
||||||
#else
|
|
||||||
char *brk_addr;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
/* PM wants to call brk() itself. */
|
/* PM wants to call brk() itself. */
|
||||||
|
|
|
@ -547,11 +547,7 @@ static int copy_fdsets(struct selectentry *se, int nfds, int direction)
|
||||||
panic("select copy_fdsets: nfds wrong: %d", nfds);
|
panic("select copy_fdsets: nfds wrong: %d", nfds);
|
||||||
|
|
||||||
/* Only copy back as many bits as the user expects. */
|
/* Only copy back as many bits as the user expects. */
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
fd_setsize = (size_t) (howmany(nfds, __NFDBITS) * sizeof(__fd_mask));
|
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 */
|
/* Set source and destination endpoints */
|
||||||
src_e = (direction == FROM_PROC) ? se->req_endpt : SELF;
|
src_e = (direction == FROM_PROC) ? se->req_endpt : SELF;
|
||||||
|
|
|
@ -22,7 +22,4 @@ LDADD+= -L/usr/pkg/compiler-rt/lib -lCompilerRT-Generic -lsys -lCompilerRT-Gener
|
||||||
# 3. Minimal C library
|
# 3. Minimal C library
|
||||||
LDADD+= -lminc
|
LDADD+= -lminc
|
||||||
|
|
||||||
# Some define still needed, hopefully will go away soon
|
|
||||||
CPPFLAGS+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -3,9 +3,6 @@ SRCS= mkfs.c
|
||||||
BINDIR= /sbin
|
BINDIR= /sbin
|
||||||
MAN=
|
MAN=
|
||||||
|
|
||||||
# LSC Adding this to activate the getline renaming macro
|
|
||||||
CPPFLAGS+= -D__NBSD_LIBC
|
|
||||||
|
|
||||||
.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" || !defined(HOSTPROGNAME)
|
.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" || !defined(HOSTPROGNAME)
|
||||||
LDADD+= -lminlib -lcompat_minix
|
LDADD+= -lminlib -lcompat_minix
|
||||||
.endif
|
.endif
|
||||||
|
|
|
@ -12,10 +12,6 @@
|
||||||
struct direct {
|
struct direct {
|
||||||
uint32_t mfs_d_ino;
|
uint32_t mfs_d_ino;
|
||||||
char mfs_d_name[MFS_DIRSIZ];
|
char mfs_d_name[MFS_DIRSIZ];
|
||||||
#ifdef __NBSD_LIBC
|
|
||||||
} __packed;
|
} __packed;
|
||||||
#else
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _MFSDIR_H */
|
#endif /* _MFSDIR_H */
|
||||||
|
|
|
@ -91,9 +91,7 @@ int extra_space_percent;
|
||||||
|
|
||||||
FILE *proto;
|
FILE *proto;
|
||||||
|
|
||||||
#if defined(__NBSD_LIBC) || !defined(__minix)
|
|
||||||
#define getline _mkfs_getline
|
#define getline _mkfs_getline
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char **argv);
|
int main(int argc, char **argv);
|
||||||
block_t sizeup(char *device);
|
block_t sizeup(char *device);
|
||||||
|
|
Loading…
Reference in a new issue