summaryrefslogtreecommitdiffstats
path: root/contrib/bind/port
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-11-30 02:43:11 +0000
committerpeter <peter@FreeBSD.org>1999-11-30 02:43:11 +0000
commit4ef23ce6957fc75fc005885496d605fed48213e1 (patch)
tree7828b08c74ef918938b1b853c98f0cb41edac52c /contrib/bind/port
parent67e0f3ce71726dc4058c2f80a813341a59244dbd (diff)
downloadFreeBSD-src-4ef23ce6957fc75fc005885496d605fed48213e1.zip
FreeBSD-src-4ef23ce6957fc75fc005885496d605fed48213e1.tar.gz
Import bind v8.2.2.p5, minus the crypto for the time being. The bind
package does have BXA export approval, but the licensing strings on the dnssafe code are a bit unpleasant. The crypto is easy to restore and bind will run without it - just without full dnssec support. Obtained from: The Internet Software Consortium (www.isc.org)
Diffstat (limited to 'contrib/bind/port')
-rw-r--r--contrib/bind/port/Makefile8
-rw-r--r--contrib/bind/port/freebsd/Makefile6
-rwxr-xr-xcontrib/bind/port/freebsd/bin/probe_ipv655
-rw-r--r--contrib/bind/port/freebsd/include/Makefile4
-rw-r--r--contrib/bind/port/freebsd/include/port_after.h41
-rw-r--r--contrib/bind/port/freebsd/include/port_before.h8
-rw-r--r--contrib/bind/port/freebsd/include/prand_conf.h43
-rw-r--r--contrib/bind/port/freebsd/include/sys/bitypes.h2
-rw-r--r--contrib/bind/port/prand_conf/Makefile100
-rw-r--r--contrib/bind/port/prand_conf/README8
-rw-r--r--contrib/bind/port/prand_conf/prand_conf.c217
-rwxr-xr-xcontrib/bind/port/settings4
-rwxr-xr-xcontrib/bind/port/systype2
13 files changed, 489 insertions, 9 deletions
diff --git a/contrib/bind/port/Makefile b/contrib/bind/port/Makefile
index 803ba0d..af7f797 100644
--- a/contrib/bind/port/Makefile
+++ b/contrib/bind/port/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 1996 by Internet Software Consortium
+# Copyright (c) 1996,1999 by Internet Software Consortium
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -13,7 +13,7 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 8.12 1997/06/19 03:22:17 halley Exp $
+# $Id: Makefile,v 8.15 1999/08/08 17:13:24 vixie Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
@@ -30,7 +30,7 @@ INCL= ${TOP}/include
PORTINCL= ${TOP}/port/${SYSTYPE}/include
LIBBIND= ${TOP}/lib/libbind.${A}
RANLIB= ranlib
-AR= ar cruv
+AR= ar cru
INSTALL= install
CDEBUG= -g
@@ -39,7 +39,7 @@ SUBDIRS = bsdos decunix linux netbsd sunos ultrix
MARGS = "SYSTYPE=${SYSTYPE}" "SHELL=${SHELL}" "A=${A}" "O=${O}" \
"CC=${CC}" "LEX=${LEX}" "CDEBUG=${CDEBUG}" \
"SYSLIBS=${SYSLIBS}" "LDFLAGS=${LDFLAGS}" \
- "DESTDIR=${DESTDIR}" "PIDDIR=${PIDDIR}" "DESTMAN=${DESTMAN}" \
+ "DESTDIR=${DESTDIR}" "DESTMAN=${DESTMAN}" \
"DESTBIN=${DESTBIN}" "DESTSBIN=${DESTSBIN}" "DESTEXEC=${DESTEXEC}" \
"DESTLIB=${DESTLIB}" "DESTINC=${DESTINC}" "DESTHELP=${DESTHELP}" \
"RANLIB=${RANLIB}" "AR=${AR}" "ARPREF=${ARPREF}" "ARSUFF=${ARSUFF}" \
diff --git a/contrib/bind/port/freebsd/Makefile b/contrib/bind/port/freebsd/Makefile
index 966cd56..2f5b121 100644
--- a/contrib/bind/port/freebsd/Makefile
+++ b/contrib/bind/port/freebsd/Makefile
@@ -1,4 +1,4 @@
-# Copyright (c) 1996 by Internet Software Consortium
+# Copyright (c) 1996,1999 by Internet Software Consortium
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -13,7 +13,7 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
-# $Id: Makefile,v 1.6 1997/06/19 03:22:25 halley Exp $
+# $Id: Makefile,v 1.8 1999/02/22 02:48:01 vixie Exp $
# these are only appropriate for BSD 4.4 or derivatives, and are used in
# development. normal builds will be done in the top level directory and
@@ -33,7 +33,7 @@ PORTINCL = ${TOP}/port/${SYSTYPE}/include
LIBBIND = ${TOP}/lib/libbind.${A}
CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL}
LD_LIBFLAGS= -x -r
-AR= ar cruv
+AR= ar cru
RANLIB= ranlib
INSTALL= install
diff --git a/contrib/bind/port/freebsd/bin/probe_ipv6 b/contrib/bind/port/freebsd/bin/probe_ipv6
new file mode 100755
index 0000000..ba7135d
--- /dev/null
+++ b/contrib/bind/port/freebsd/bin/probe_ipv6
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+set -e
+PATH=/bin:/usr/bin:$PATH; export PATH
+trap "rm -f tmp$$a.c tmp$$b.c tmp$$a.o tmp$$b.o" 0
+target=port_ipv6
+new=new_${target}.h
+old=${target}.h
+
+cat > tmp$$a.c <<EOF
+#include <sys/types.h>
+#include <netinet/in.h>
+struct sockaddr_in6 xx;
+EOF
+
+cat > tmp$$b.c <<EOF
+#include <sys/types.h>
+#include <netinet/in.h>
+struct in6_addr xx;
+EOF
+
+cat > ${new} <<EOF
+
+/* This file is automatically generated. Do Not Edit. */
+
+#ifndef ${target}_h
+#define ${target}_h
+
+EOF
+
+if ${CC} -c tmp$$a.c > /dev/null 2>&1
+then
+ echo "#define HAS_INET6_STRUCTS" >> ${new}
+ if ${CC} -c tmp$$b.c > /dev/null 2>&1
+ then
+ :
+ else
+ echo "#define in6_addr in_addr6" >> ${new}
+ fi
+else
+ echo "#undef HAS_INET6_STRUCTS" >> ${new}
+fi
+echo >> ${new}
+echo "#endif" >> ${new}
+if [ -f ${old} ]; then
+ if cmp -s ${new} ${old} ; then
+ rm -f ${new}
+ else
+ rm -f ${old}
+ mv ${new} ${old}
+ fi
+else
+ mv ${new} ${old}
+fi
+exit 0
diff --git a/contrib/bind/port/freebsd/include/Makefile b/contrib/bind/port/freebsd/include/Makefile
index dd8b4e9..40fe3f8 100644
--- a/contrib/bind/port/freebsd/include/Makefile
+++ b/contrib/bind/port/freebsd/include/Makefile
@@ -65,10 +65,14 @@ all depend clean distclean install::
(cd $$x; pwd; ${MAKE} ${MARGS} $@); \
done
+all depend::
+ probe_ipv6
+
distclean:: clean
clean::
rm -f *~ *.BAK *.CKP *.orig
+ rm -f port_ipv6.h new_port_ipv6.h
links: FRC
@set -e; ln -s SRC/*.h .
diff --git a/contrib/bind/port/freebsd/include/port_after.h b/contrib/bind/port/freebsd/include/port_after.h
index 20c92b5..a496ac5 100644
--- a/contrib/bind/port/freebsd/include/port_after.h
+++ b/contrib/bind/port/freebsd/include/port_after.h
@@ -1,3 +1,5 @@
+#ifndef PORT_AFTER_H
+#define PORT_AFTER_H
#define CAN_RECONNECT
#define USE_POSIX
#define POSIX_SIGNALS
@@ -11,6 +13,7 @@
#define USE_LOG_CONS
#define HAVE_CHROOT
#define CAN_CHANGE_ID
+#define MISSING_IN6ADDR_ANY
#define _TIMEZONE timezone
@@ -21,6 +24,13 @@
#define KMEM "/dev/kmem"
#define UDPSUM "udpcksum"
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+#if (!defined(BSD)) || (BSD < 199306)
+#include <sys/bitypes.h>
+#endif
+
/*
* We need to know the IPv6 address family number even on IPv4-only systems.
* Note that this is NOT a protocol constant, and that if the system has its
@@ -31,4 +41,35 @@
*/
#ifndef AF_INET6
#define AF_INET6 24
+#else
+#define HAS_INET6_STRUCTS
+#define HAVE_SA_LEN
+#endif
+
+#ifndef PF_INET6
+#define PF_INET6 AF_INET6
+#endif
+
+#include <port_ipv6.h>
+
+#ifndef HAS_INET6_STRUCTS
+/* Replace with structure from later rev of O/S if known. */
+struct in6_addr {
+ u_int8_t s6_addr[16];
+};
+
+/* Replace with structure from later rev of O/S if known. */
+struct sockaddr_in6 {
+#ifdef HAVE_SA_LEN
+ u_int8_t sin6_len; /* length of this struct */
+ u_int8_t sin6_family; /* AF_INET6 */
+#else
+ u_int16_t sin6_family; /* AF_INET6 */
#endif
+ u_int16_t sin6_port; /* transport layer port # */
+ u_int32_t sin6_flowinfo; /* IPv6 flow information */
+ struct in6_addr sin6_addr; /* IPv6 address */
+ u_int32_t sin6_scope_id; /* set of interfaces for a scope */
+};
+#endif /* HAS_INET6_STRUCTS */
+#endif /* ! PORT_AFTER_H */
diff --git a/contrib/bind/port/freebsd/include/port_before.h b/contrib/bind/port/freebsd/include/port_before.h
index bc6b89c..d713050 100644
--- a/contrib/bind/port/freebsd/include/port_before.h
+++ b/contrib/bind/port/freebsd/include/port_before.h
@@ -4,3 +4,11 @@
#define SIG_FN void
#define ts_sec tv_sec
#define ts_nsec tv_nsec
+
+#if defined(HAS_PTHREADS) && defined(_REENTRANT)
+#define DO_PTHREADS
+#endif
+
+#if defined (__FreeBSD__) && __FreeBSD__>=3
+#define SETPWENT_VOID
+#endif
diff --git a/contrib/bind/port/freebsd/include/prand_conf.h b/contrib/bind/port/freebsd/include/prand_conf.h
new file mode 100644
index 0000000..7244282
--- /dev/null
+++ b/contrib/bind/port/freebsd/include/prand_conf.h
@@ -0,0 +1,43 @@
+#ifndef _PRAND_CMD_H_
+#define _PRAND_CMD_H_
+
+
+#ifndef HAVE_DEV_RANDOM
+ # define HAVE_DEV_RANDOM 1
+ #endif /* HAVE_DEV_RANDOM */
+
+const char *cmds[] = {
+ "/bin/ps -axlw 2>&1",
+ "/usr/sbin/arp -an 2>&1",
+ "/usr/bin/netstat -an 2>&1",
+ "/bin/df 2>&1",
+ "/usr/bin/dig com. soa +ti=1 +retry=0 2>&1",
+ "/usr/bin/netstat -an 2>&1",
+ "/usr/bin/dig . soa +ti=1 +retry=0 2>&1",
+ "/usr/sbin/iostat 2>&1",
+ "/usr/bin/vmstat 2>&1",
+ "/usr/bin/w 2>&1",
+ NULL
+};
+
+const char *dirs[] = {
+ "/tmp",
+ "/usr/tmp",
+ ".",
+ "/",
+ "/var/spool",
+ "/dev",
+ "/var/mail",
+ "/home",
+ "/usr/home",
+ NULL
+};
+
+const char *files[] = {
+ "/var/log/messages",
+ "/var/log/wtmp",
+ "/var/log/lastlog",
+ NULL
+};
+
+#endif /* _PRAND_CMD_H_ */
diff --git a/contrib/bind/port/freebsd/include/sys/bitypes.h b/contrib/bind/port/freebsd/include/sys/bitypes.h
index ad0dfcb..361156a 100644
--- a/contrib/bind/port/freebsd/include/sys/bitypes.h
+++ b/contrib/bind/port/freebsd/include/sys/bitypes.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996 by Internet Software Consortium.
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
diff --git a/contrib/bind/port/prand_conf/Makefile b/contrib/bind/port/prand_conf/Makefile
new file mode 100644
index 0000000..d8a1fdc
--- /dev/null
+++ b/contrib/bind/port/prand_conf/Makefile
@@ -0,0 +1,100 @@
+# ++Copyright++
+# -
+# Copyright (c)
+# The Regents of the University of California. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the University of
+# California, Berkeley and its contributors.
+# 4. Neither the name of the University nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+# -
+# Portions Copyright (c) 1993 by Digital Equipment Corporation.
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies, and that
+# the name of Digital Equipment Corporation not be used in advertising or
+# publicity pertaining to distribution of the document or software without
+# specific, written prior permission.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+# WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+# CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+# SOFTWARE.
+# -
+# --Copyright--
+
+SUBDIRS =
+# Ensure that HFILES isn't empty to keep bash happy
+HFILES =
+
+DESTDIR=
+DESTINC= /usr/local/bind/include
+INSTALL= install
+SYSTYPE= unknown
+
+MARGS= DESTDIR="${DESTDIR}" DESTINC="${DESTINC}" INSTALL="${INSTALL}"
+
+all depend clean distclean install::
+ @for x in ${SUBDIRS}; do \
+ (cd $$x; pwd; ${MAKE} ${MARGS} $@); \
+ done
+
+prand_conf.h: prand_conf.c
+ $(CC) prand_conf.c -o prand_conf
+ ./prand_conf
+ rm -f prand_conf
+ cp prand_conf.h prand_conf.h.${SYSTYPE}
+distclean:: clean
+
+clean::
+ rm -f *~ *.BAK *.CKP *.orig *.h a.out
+
+links: FRC
+ @set -e; ln -s SRC/*.h .
+ @set -e; for x in ${SUBDIRS}; do \
+ ( mkdir $$x; cd $$x; pwd; ln -s ../SRC/$$x SRC; \
+ cp SRC/Makefile Makefile; chmod +w Makefile; \
+ ${MAKE} ${MARGS} links ); \
+ done
+
+install:: ${DESTDIR}${DESTINC}
+ -for x in ${HFILES}; do \
+ if [ -f "$$x" ]; then \
+ ${INSTALL} -c -m 444 $$x ${DESTDIR}${DESTINC}/$$x; \
+ fi; \
+ done
+
+${DESTDIR}${DESTINC}:
+ mkdir -p ${DESTDIR}${DESTINC}
+
+FRC:
+
+
diff --git a/contrib/bind/port/prand_conf/README b/contrib/bind/port/prand_conf/README
new file mode 100644
index 0000000..5f7728d
--- /dev/null
+++ b/contrib/bind/port/prand_conf/README
@@ -0,0 +1,8 @@
+this is a utility used to build prand_conf.h on new ports.
+
+To run you can either compile the program prand_conf.c with
+cc prand_conf.c -o prand_conf # add -posix on NeXTstep systems
+./prand_conf
+
+both programs create a file prand_conf.h,
+copy this file to the appropriate port/<os>/include directory
diff --git a/contrib/bind/port/prand_conf/prand_conf.c b/contrib/bind/port/prand_conf/prand_conf.c
new file mode 100644
index 0000000..5f9bf29
--- /dev/null
+++ b/contrib/bind/port/prand_conf/prand_conf.c
@@ -0,0 +1,217 @@
+/* $Id: prand_conf.c,v 1.5 1999/07/31 16:44:13 cyarnell Exp $
+ *
+ * Portions Copyright (c) 1995-1998 by TIS Labs at Network Assoociates Inc.
+ * Portions Copyright (c) 1998-1998 by TIS Labs @ Network Associates Inc.
+ *
+ * Permission to use, copy modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND NETWORK ASSOCIATES
+ * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * TRUSTED INFORMATION SYSTEMS BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
+ *
+ * program to find where system commands reside
+ * and what directores are avialable for inspection
+ * this information is stored in the file prand_conf.h in current directory
+ *
+ * function my_find get variable number of arguments
+ * the first argument is the name of the command
+ * all remaining arguments are list of directories to search for the command in
+ * this function returns the path to the command
+ */
+
+#include <sys/stat.h>
+#include <unistd.h>
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+#define LINE_MAX 256
+
+int
+my_find(char *cmd, char **dir)
+{
+ int curr = 0, c_len, i;
+ char cmd_line[LINE_MAX];
+
+ memset(cmd_line, 0, sizeof(cmd_line));
+ c_len = strlen(cmd);
+ for (i = 0; dir[i]; i++) {
+ curr = strlen(dir[i]);
+ if (curr + c_len < sizeof(cmd_line)-3) {
+ sprintf(cmd_line, "%s%s",dir[i], cmd);
+ if (access(cmd_line, X_OK) == 0)
+ return (i);
+ memset(cmd_line, 0, c_len + curr + 2);
+ }
+ }
+ return (0);
+}
+
+/*
+ * function to simulate the ` ` operator in perl return the number
+ * of bytes read from the pipe
+ */
+int
+pipe_run(char *cmd_line)
+{
+ FILE *pd;
+ char scratch[LINE_MAX];
+ int ex, no_bytes = 0, no = 1;
+
+ pd = popen(cmd_line, "r");
+ for (; (pd != NULL) && (no > 0); no_bytes += no)
+ no = fread(scratch, sizeof(char), sizeof(scratch), pd);
+ ex = pclose(pd);
+ return (no_bytes);
+}
+
+/*
+ * function that executes a command with certain flags and checks that the
+ * output is at least certain length
+ * First parameter the command
+ * Second parameter is ther flags
+ * third parameter is the number of bytes required
+ * output is 1 if the command works 0 if not
+ * This function writes to the include file if
+ */
+int
+ex(FILE *fd, char *path, char *cmd, char *arg, int lower_bound)
+{
+ char line[LINE_MAX];
+
+ if (strlen(path) + strlen(cmd) + strlen(arg) < sizeof(line)-7) {
+ memset(line, 0, sizeof(line));
+ sprintf(line, "%s%s %s 2>&1", path, cmd, arg);
+ if (pipe_run(line) > lower_bound) {
+ fprintf(fd,"\t\"%s\",\n", line);
+ return (1);
+ }
+ }
+ return (0);
+}
+
+int
+main()
+{
+ extern int errno;
+ FILE *fd;
+ int res, vm, i;
+ int ps, arp, net, dig, cmd;
+/*
+ * set up list of directories where each command may be found in
+ */
+ char *arp_path[] = {"/usr/sbin", "/sbin", "/usr/etc/", "/etc/",
+ "/usr/bin/", NULL};
+ char *ps_path[] = {"/usr/bin", "/bin/", NULL};
+ char *net_path[] = {"/usr/ucb/", "/usr/bin/", "/usr/etc/",
+ "/usr/sbin/", "/bin/", NULL};
+ char *dig_path[] = {"/usr/bin/", "/usr/local/bin/", NULL};
+ char **df_path = ps_path;
+ char *uptime_path[] = {"/usr/ucb/", "/usr/bin/", "/usr/bsd/", NULL};
+ char *iostat_path[] = { "/usr/bin/", "/bin/", "/usr/sbin/", NULL};
+ char *vmstat_path[] = {"/usr/ucb/", "/usr/bin/", "/usr/sbin/", NULL};
+ char *vm_stat_path[] = {"/usr/ucb/", "/usr/bin/", NULL};
+ char **w_path = uptime_path;
+
+/* find which directories exist */
+ char *dirs[] = {"/tmp", "/usr/tmp", "/var/tmp", ".", "/",
+ "/var/spool", "/usr/spool",
+ "/usr/adm", "/var/adm", "/dev",
+ "/usr/mail", "/var/spool/mail", "/var/mail",
+ "/home", "/usr/home", NULL};
+
+ char *files[] = {"/proc/stat", "/proc/rtc", "/proc/meminfo",
+ "/proc/interrupts", "/proc/self/status",
+ "/proc/self/maps",
+ "/var/log/messages", "/var/log/wtmp",
+ "/var/log/lastlog", "/var/adm/messages",
+ "/var/adm/wtmp", "/var/adm/lastlog", NULL};
+
+ struct stat st;
+ time_t tim;
+/* main program: */
+
+ if ((fd = fopen("prand_conf.h", "w")) == NULL) {
+ perror("Failed creating file prand_conf.h");
+ exit(errno);
+ }
+
+ fprintf(fd, "#ifndef _PRAND_CMD_H_\n#define _PRAND_CMD_H_\n\n");
+
+ fprintf(fd, "const char *cmds[] = {\n");
+
+ if ((ps = my_find("ps", ps_path)) >= 0)
+ res = ex(fd, ps_path[ps], "ps","-axlw", 460) ||
+ ex(fd, ps_path[ps], "ps", "-ef", 300) ||
+ ex(fd, ps_path[ps], "ps", "-ale", 300);
+
+ if ((arp = my_find("arp", arp_path)) >= 0)
+ res = ex(fd, arp_path[arp], "arp", "-n -a", 40);
+
+ if ((net = my_find("netstat", net_path)) >= 0)
+ res = ex(fd, net_path[net], "netstat", "-an", 1000);
+ if ((cmd = my_find("df", df_path)) >= 0)
+ res = ex(fd, df_path[cmd], "df", "", 40);
+
+ if ((dig = my_find("dig", dig_path)) >= 0)
+ res = ex(fd, dig_path[dig], "dig", "com. soa +ti=1 +retry=0",
+ 100);
+ if ((cmd = my_find("uptime", uptime_path)) >= 0)
+ res = ex(fd, uptime_path[cmd], "uptime", "", 40);
+ if ((cmd = my_find("printenv", uptime_path)) >= 0)
+ res = ex(fd, uptime_path[cmd], "printenv", "", 400);
+ if (net >= 0)
+ res = ex(fd, net_path[net], "netstat", "-s", 1000);
+
+ if (dig >= 0)
+ res = ex(fd, net_path[net], "dig", ". soa +ti=1 +retry=0",100);
+ if ((cmd = my_find("iostat", iostat_path)) >= 0)
+ res = ex(fd, iostat_path[cmd], "iostat", "", 100);
+
+ vm = 0;
+ if ((cmd = my_find("vmstat", vmstat_path)))
+ vm = ex(fd, vmstat_path[cmd], "vmstat", "", 200);
+ if (vm ==0 && ((cmd = my_find("vm_stat", vm_stat_path)) >= 0))
+ vm = ex(fd, vm_stat_path[cmd], "vm_stat", "", 200);
+ if ((cmd = my_find("w", w_path)))
+ res = ex(fd, w_path[cmd], "w", "", 100);
+ fprintf(fd,"\tNULL\n};\n\n");
+
+ fprintf(fd, "const char *dirs[] = {\n");
+
+ for (i=0; dirs[i]; i++) {
+ if (lstat(dirs[i], &st) == 0)
+ if (S_ISDIR(st.st_mode))
+ fprintf(fd,"\t\"%s\",\n", dirs[i]);
+ }
+ fprintf(fd,"\tNULL\n};\n\n");
+
+
+ fprintf(fd, "const char *files[] = {\n");
+ tim = time(NULL);
+ for (i=0; files[i]; i++) {
+ if (lstat(files[i],&st) == 0)
+ if (S_ISREG(st.st_mode) &&
+ (tim -st.st_mtime) < 84600)
+ fprintf(fd,"\t\"%s\",\n", files[i]);
+ }
+ fprintf (fd, "\tNULL\n};\n");
+
+ if ((stat("/dev/random", &st) == 0))
+ if (S_ISCHR(st.st_mode))
+ fprintf(fd, "\n#ifndef HAVE_DEV_RANDOM\n%s%s",
+ "# define HAVE_DEV_RANDOM 1\n",
+ "#endif /* HAVE_DEV_RANDOM */\n\n");
+
+ fprintf(fd, "\n#endif /* _PRAND_CMD_H_ */\n");
+ fclose(fd);
+ exit (0);
+}
diff --git a/contrib/bind/port/settings b/contrib/bind/port/settings
index 942236e..539faf2 100755
--- a/contrib/bind/port/settings
+++ b/contrib/bind/port/settings
@@ -18,6 +18,10 @@ case $cachefile in
*) echo "Making $cachefile" >&2 ;;
esac
+# expr is sensitive to LC_COLLATE settings. We want 'C'.
+LC_COLLATE=C
+export LC_COLLATE
+
result=''
while read setting; do
var=`expr "$setting" : "'\([A-Z0-9_]*\)="`
diff --git a/contrib/bind/port/systype b/contrib/bind/port/systype
index b022651..56d5e26 100755
--- a/contrib/bind/port/systype
+++ b/contrib/bind/port/systype
@@ -12,7 +12,7 @@ case $cachefile in
*) cachefile=`pwd`/$cachefile ;;
esac
-cd `dirname $0`
+cd `dirname $0` > /dev/null
for systype in [a-z]*; do
if [ -f $systype/probe ]; then
if sh $systype/probe; then
OpenPOWER on IntegriCloud