Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/freebsd-src.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>1997-05-19 14:35:55 +0400
committercvs2svn <cvs2svn@FreeBSD.org>1997-05-19 14:35:55 +0400
commitfcc0587080d3250a509550d7222e70e6cdc7d281 (patch)
tree827c9ac8236bbd050dc5f1f0753a0ebab99e026a
parent8935d79733d4e5938b0f22904e35d251e8eb514d (diff)
This commit was manufactured by cvs2svn to create tagrelease/2.2.2
'RELENG_2_2_2_RELEASE'.
Notes
Notes: svn path=/stable/2.2/; revision=25919 svn path=/release/2.2.2/; revision=25920; tag=release/2.2.2
-rw-r--r--bin/sh/cd.h34
-rw-r--r--contrib/bind/named/ns_udp.c113
-rw-r--r--contrib/bind/res/base64.c321
-rw-r--r--contrib/bind/res/inet_net_ntop.c139
-rw-r--r--contrib/bind/res/inet_net_pton.c207
-rw-r--r--contrib/bind/res/inet_neta.c82
-rw-r--r--contrib/cpio/COPYING339
-rw-r--r--contrib/cpio/COPYING.LIB481
-rw-r--r--contrib/cpio/ChangeLog968
-rw-r--r--contrib/cpio/FREEBSD-upgrade15
-rw-r--r--contrib/cpio/NEWS64
-rw-r--r--contrib/cpio/README71
-rw-r--r--contrib/cpio/alloca.c495
-rw-r--r--contrib/cpio/copyout.c945
-rw-r--r--contrib/cpio/cpio.1328
-rw-r--r--contrib/cpio/cpio.h69
-rw-r--r--contrib/cpio/cpio.texi558
-rw-r--r--contrib/cpio/cpiohdr.h90
-rw-r--r--contrib/cpio/defer.c43
-rw-r--r--contrib/cpio/defer.h8
-rw-r--r--contrib/cpio/dirname.c70
-rw-r--r--contrib/cpio/dstring.c114
-rw-r--r--contrib/cpio/dstring.h49
-rw-r--r--contrib/cpio/error.c130
-rw-r--r--contrib/cpio/extern.h199
-rw-r--r--contrib/cpio/filemode.c255
-rw-r--r--contrib/cpio/filetypes.h84
-rw-r--r--contrib/cpio/getopt.c765
-rw-r--r--contrib/cpio/getopt.h129
-rw-r--r--contrib/cpio/getopt1.c180
-rw-r--r--contrib/cpio/global.c197
-rw-r--r--contrib/cpio/idcache.c210
-rw-r--r--contrib/cpio/main.c531
-rw-r--r--contrib/cpio/makepath.c307
-rw-r--r--contrib/cpio/rmt.h98
-rw-r--r--contrib/cpio/rtapelib.c566
-rw-r--r--contrib/cpio/safe-stat.h1
-rw-r--r--contrib/cpio/stripslash.c43
-rw-r--r--contrib/cpio/system.h142
-rw-r--r--contrib/cpio/tar.c522
-rw-r--r--contrib/cpio/tar.h112
-rw-r--r--contrib/cpio/tarhdr.h62
-rw-r--r--contrib/cpio/userspec.c277
-rw-r--r--contrib/cpio/util.c1343
-rw-r--r--contrib/cpio/version.c2
-rw-r--r--contrib/cpio/xmalloc.c103
-rw-r--r--contrib/cpio/xstrdup.c36
-rw-r--r--crypto/README9
-rw-r--r--lib/libF77/lbitbits.c62
-rw-r--r--lib/libF77/lbitshft.c11
-rw-r--r--lib/libF77/signal1.h25
-rw-r--r--lib/libc/Makefile.inc25
-rw-r--r--lib/libc/i386/string/memcpy.S2
-rw-r--r--lib/libc/net/base64.c321
-rw-r--r--lib/libc/net/inet_net_ntop.c140
-rw-r--r--lib/libc/net/inet_net_pton.c208
-rw-r--r--lib/libc/net/inet_neta.c83
-rw-r--r--lib/libc/sys/issetugid.294
-rw-r--r--lib/libc_r/uthread/uthread_attr_getdetachstate.c57
-rw-r--r--lib/libc_r/uthread/uthread_attr_getstackaddr.c52
-rw-r--r--lib/libc_r/uthread/uthread_attr_getstacksize.c52
-rw-r--r--lib/libc_r/uthread/uthread_attr_setdetachstate.c59
-rw-r--r--lib/libc_r/uthread/uthread_attr_setstackaddr.c52
-rw-r--r--lib/libc_r/uthread/uthread_condattr_destroy.c52
-rw-r--r--lib/libc_r/uthread/uthread_condattr_init.c58
-rw-r--r--lib/libc_r/uthread/uthread_kill.c78
-rw-r--r--lib/libc_r/uthread/uthread_mattr_init.c58
-rw-r--r--lib/libc_r/uthread/uthread_mattr_kind_np.c64
-rw-r--r--lib/libc_r/uthread/uthread_mutexattr_destroy.c52
-rw-r--r--lib/libc_r/uthread/uthread_sigmask.c92
-rw-r--r--lib/libc_r/uthread/uthread_sigwait.c73
-rw-r--r--lib/libutil/login_auth.371
-rw-r--r--sbin/ifconfig/ifconfig.h46
-rw-r--r--sbin/ifconfig/ifmedia.c530
-rw-r--r--share/doc/handbook/russian.sgml195
-rw-r--r--share/examples/drivers/README45
-rwxr-xr-xshare/examples/drivers/make_device_driver.sh400
-rw-r--r--share/examples/drivers/make_pseudo_driver.sh321
-rw-r--r--share/examples/printing/diablo-if-net7
-rw-r--r--share/examples/printing/hpdf59
-rw-r--r--share/examples/printing/hpif11
-rw-r--r--share/examples/printing/hpof8
-rw-r--r--share/examples/printing/hprf8
-rw-r--r--share/examples/printing/hpvf10
-rw-r--r--share/examples/printing/if-simple9
-rw-r--r--share/examples/printing/if-simpleX10
-rw-r--r--share/examples/printing/ifhp32
-rw-r--r--share/examples/printing/make-ps-header79
-rw-r--r--share/examples/printing/netprint24
-rw-r--r--share/examples/printing/psdf8
-rw-r--r--share/examples/printing/psdfX31
-rw-r--r--share/examples/printing/psif23
-rw-r--r--share/examples/printing/pstf6
-rw-r--r--share/examples/printing/pstfX6
-rw-r--r--share/man/man4/od.4288
-rw-r--r--share/timedef/data/ko_KR.EUC.src89
-rw-r--r--sys/conf/newvers.sh8
-rw-r--r--sys/dev/aic7xxx/aicasm.c482
-rw-r--r--sys/dev/aic7xxx/aicasm.h68
-rw-r--r--sys/dev/aic7xxx/aicasm_gram.y1304
-rw-r--r--sys/dev/aic7xxx/aicasm_scan.l243
-rw-r--r--sys/dev/aic7xxx/aicasm_symbol.c451
-rw-r--r--sys/dev/aic7xxx/aicasm_symbol.h144
-rw-r--r--sys/i386/include/asm.h201
-rw-r--r--sys/net/if_media.c476
-rw-r--r--sys/net/if_media.h307
-rw-r--r--usr.bin/colldef/data/lt_LN.ASCII.src6
-rw-r--r--usr.bin/ee/Artistic117
-rw-r--r--usr.bin/ee/ee.i18n.guide141
-rw-r--r--usr.bin/ee/new_curse.c3574
-rw-r--r--usr.bin/ee/new_curse.h255
-rw-r--r--usr.bin/file/Magdir/alpha21
-rw-r--r--usr.bin/file/Magdir/amanda7
-rw-r--r--usr.bin/file/Magdir/amigaos10
-rw-r--r--usr.bin/file/Magdir/asterix17
-rw-r--r--usr.bin/file/Magdir/digital41
-rw-r--r--usr.bin/file/Magdir/island9
-rw-r--r--usr.bin/file/Magdir/mach38
-rw-r--r--usr.bin/file/Magdir/osf110
-rw-r--r--usr.bin/file/Magdir/sniffer63
-rw-r--r--usr.bin/file/Magdir/xenix72
-rw-r--r--usr.bin/file/internat.c72
-rw-r--r--usr.bin/file/readelf.c318
-rw-r--r--usr.bin/file/readelf.h167
-rw-r--r--usr.sbin/sendmail/cf/ostype/powerux.m446
-rw-r--r--usr.sbin/sendmail/cf/ostype/sinix.m445
-rw-r--r--usr.sbin/vidcontrol/decode.h1
127 files changed, 4 insertions, 24702 deletions
diff --git a/bin/sh/cd.h b/bin/sh/cd.h
deleted file mode 100644
index 2b00fc2b7c73..000000000000
--- a/bin/sh/cd.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * Copyright (c) 1995
- * 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.
- */
-
-char *getpwd __P((void));
diff --git a/contrib/bind/named/ns_udp.c b/contrib/bind/named/ns_udp.c
deleted file mode 100644
index 7fb583124bc7..000000000000
--- a/contrib/bind/named/ns_udp.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#if !defined(lint) && !defined(SABER)
-static char rcsid[] = "$Id: ns_udp.c,v 8.3 1996/08/27 08:33:23 vixie Exp $";
-#endif /* not lint */
-
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/file.h>
-
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <arpa/inet.h>
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <syslog.h>
-#include <netdb.h>
-#include <nlist.h>
-#include <resolv.h>
-
-#include "named.h"
-
-void
-ns_udp() {
-#if defined(CHECK_UDP_SUM) || defined(FIX_UDP_SUM)
- struct nlist nl[2];
- int fd;
- int sum;
- u_long res, offset;
-
- nl[0].n_name = UDPSUM;
- nl[1].n_name = 0;
-
- if (nlist(KSYMS, nl)) {
- dprintf(1, (ddt, "ns_udp: nlist (%s,%s) failed\n",
- KSYMS, UDPSUM));
- return;
- }
-
- dprintf(1, (ddt, "ns_udp: %s %d %lu (%ld)\n",
- nl[0].n_name, nl[0].n_type, nl[0].n_value,
- nl[0].n_value));
-
- if (!nl[0].n_type)
- return;
-
- if ((fd = open(KMEM, O_RDWR, 0)) < 0) {
- dprintf(1, (ddt, "ns_udp: open %s failed\n", KMEM));
- return;
- }
-
- offset = nl[0].n_value;
-#ifdef KMAP
- offset &= ((~0UL)>>1);
-#endif
-
- res = lseek(fd, offset, SEEK_SET);
- if (res != offset) {
- dprintf(1, (ddt, "ns_udp: lseek %ul failed %lu %d\n",
- offset, res, errno));
- goto cleanup;
- }
-
- if (read(fd, &sum, sizeof(sum)) != sizeof(sum)) {
- dprintf(1, (ddt, "ns_udp: read failed\n"));
- goto cleanup;
- }
-
- dprintf(1, (ddt, "ns_udp: %d\n", sum));
- if (sum == 0) {
-#ifdef FIX_UDP_SUM
- sum = 1;
- lseek(fd, offset, SEEK_SET);
- if (res != offset) {
- dprintf(1, (ddt, "ns_udp: lseek %ul failed %lu %d\n",
- offset, res, errno));
- goto cleanup;
- }
- if (write(fd, &sum, sizeof(sum)) != sizeof(sum)) {
- dprintf(1, (ddt, "ns_udp: write failed\n"));
- goto cleanup;
- }
- dprintf(1, (ddt, "ns_udp: set to 1\n"));
- syslog(LOG_WARNING, "ns_udp: check sums turned on");
-#else
- dprintf(1, (ddt, "ns_udp: Exiting\n"));
- syslog(LOG_WARNING, "ns_udp: checksums NOT turned on: Exiting");
- exit(1);
-#endif
- }
-cleanup:
- close(fd);
-#endif
-}
diff --git a/contrib/bind/res/base64.c b/contrib/bind/res/base64.c
deleted file mode 100644
index 868826a777dc..000000000000
--- a/contrib/bind/res/base64.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-/*
- * Portions Copyright (c) 1995 by International Business Machines, Inc.
- *
- * International Business Machines, Inc. (hereinafter called IBM) grants
- * permission under its copyrights to use, copy, modify, and distribute this
- * Software with or without fee, provided that the above copyright notice and
- * all paragraphs of this notice appear in all copies, and that the name of IBM
- * not be used in connection with the marketing of any product incorporating
- * the Software or modifications thereof, without specific, written prior
- * permission.
- *
- * To the extent it has a right to do so, IBM grants an immunity from suit
- * under its patents, if any, for the use, sale or manufacture of products to
- * the extent that such products are used for performing Domain Name System
- * dynamic updates in TCP/IP networks by means of the Software. No immunity is
- * granted for any product per se or for any other function of any product.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
- * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
- * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-#include <ctype.h>
-#include <resolv.h>
-#include <stdio.h>
-
-#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
-# include <stdlib.h>
-# include <string.h>
-#else
-# include "../conf/portability.h"
-#endif
-
-#define Assert(Cond) if (!(Cond)) abort()
-
-static const char Base64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-static const char Pad64 = '=';
-
-/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
- The following encoding technique is taken from RFC 1521 by Borenstein
- and Freed. It is reproduced here in a slightly edited form for
- convenience.
-
- A 65-character subset of US-ASCII is used, enabling 6 bits to be
- represented per printable character. (The extra 65th character, "=",
- is used to signify a special processing function.)
-
- The encoding process represents 24-bit groups of input bits as output
- strings of 4 encoded characters. Proceeding from left to right, a
- 24-bit input group is formed by concatenating 3 8-bit input groups.
- These 24 bits are then treated as 4 concatenated 6-bit groups, each
- of which is translated into a single digit in the base64 alphabet.
-
- Each 6-bit group is used as an index into an array of 64 printable
- characters. The character referenced by the index is placed in the
- output string.
-
- Table 1: The Base64 Alphabet
-
- Value Encoding Value Encoding Value Encoding Value Encoding
- 0 A 17 R 34 i 51 z
- 1 B 18 S 35 j 52 0
- 2 C 19 T 36 k 53 1
- 3 D 20 U 37 l 54 2
- 4 E 21 V 38 m 55 3
- 5 F 22 W 39 n 56 4
- 6 G 23 X 40 o 57 5
- 7 H 24 Y 41 p 58 6
- 8 I 25 Z 42 q 59 7
- 9 J 26 a 43 r 60 8
- 10 K 27 b 44 s 61 9
- 11 L 28 c 45 t 62 +
- 12 M 29 d 46 u 63 /
- 13 N 30 e 47 v
- 14 O 31 f 48 w (pad) =
- 15 P 32 g 49 x
- 16 Q 33 h 50 y
-
- Special processing is performed if fewer than 24 bits are available
- at the end of the data being encoded. A full encoding quantum is
- always completed at the end of a quantity. When fewer than 24 input
- bits are available in an input group, zero bits are added (on the
- right) to form an integral number of 6-bit groups. Padding at the
- end of the data is performed using the '=' character.
-
- Since all base64 input is an integral number of octets, only the
- -------------------------------------------------
- following cases can arise:
-
- (1) the final quantum of encoding input is an integral
- multiple of 24 bits; here, the final unit of encoded
- output will be an integral multiple of 4 characters
- with no "=" padding,
- (2) the final quantum of encoding input is exactly 8 bits;
- here, the final unit of encoded output will be two
- characters followed by two "=" padding characters, or
- (3) the final quantum of encoding input is exactly 16 bits;
- here, the final unit of encoded output will be three
- characters followed by one "=" padding character.
- */
-
-int
-b64_ntop(src, srclength, target, targsize)
- u_char const *src;
- size_t srclength;
- char *target;
- size_t targsize;
-{
- size_t datalength = 0;
- u_char input[3];
- u_char output[4];
- int i;
-
- while (2 < srclength) {
- input[0] = *src++;
- input[1] = *src++;
- input[2] = *src++;
- srclength -= 3;
-
- output[0] = input[0] >> 2;
- output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
- output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
- output[3] = input[2] & 0x3f;
- Assert(output[0] < 64);
- Assert(output[1] < 64);
- Assert(output[2] < 64);
- Assert(output[3] < 64);
-
- if (datalength + 4 > targsize)
- return (-1);
- target[datalength++] = Base64[output[0]];
- target[datalength++] = Base64[output[1]];
- target[datalength++] = Base64[output[2]];
- target[datalength++] = Base64[output[3]];
- }
-
- /* Now we worry about padding. */
- if (0 != srclength) {
- /* Get what's left. */
- input[0] = input[1] = input[2] = '\0';
- for (i = 0; i < srclength; i++)
- input[i] = *src++;
-
- output[0] = input[0] >> 2;
- output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
- output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
- Assert(output[0] < 64);
- Assert(output[1] < 64);
- Assert(output[2] < 64);
-
- if (datalength + 4 > targsize)
- return (-1);
- target[datalength++] = Base64[output[0]];
- target[datalength++] = Base64[output[1]];
- if (srclength == 1)
- target[datalength++] = Pad64;
- else
- target[datalength++] = Base64[output[2]];
- target[datalength++] = Pad64;
- }
- if (datalength >= targsize)
- return (-1);
- target[datalength] = '\0'; /* Returned value doesn't count \0. */
- return (datalength);
-}
-
-/* skips all whitespace anywhere.
- converts characters, four at a time, starting at (or after)
- src from base - 64 numbers into three 8 bit bytes in the target area.
- it returns the number of data bytes stored at the target, or -1 on error.
- */
-
-int
-b64_pton(src, target, targsize)
- char const *src;
- u_char *target;
- size_t targsize;
-{
- int tarindex, state, ch;
- char *pos;
-
- state = 0;
- tarindex = 0;
-
- while ((ch = *src++) != '\0') {
- if (isspace(ch)) /* Skip whitespace anywhere. */
- continue;
-
- if (ch == Pad64)
- break;
-
- pos = strchr(Base64, ch);
- if (pos == 0) /* A non-base64 character. */
- return (-1);
-
- switch (state) {
- case 0:
- if (target) {
- if (tarindex >= targsize)
- return (-1);
- target[tarindex] = (pos - Base64) << 2;
- }
- state = 1;
- break;
- case 1:
- if (target) {
- if (tarindex + 1 >= targsize)
- return (-1);
- target[tarindex] |= (pos - Base64) >> 4;
- target[tarindex+1] = ((pos - Base64) & 0x0f)
- << 4 ;
- }
- tarindex++;
- state = 2;
- break;
- case 2:
- if (target) {
- if (tarindex + 1 >= targsize)
- return (-1);
- target[tarindex] |= (pos - Base64) >> 2;
- target[tarindex+1] = ((pos - Base64) & 0x03)
- << 6;
- }
- tarindex++;
- state = 3;
- break;
- case 3:
- if (target) {
- if (tarindex >= targsize)
- return (-1);
- target[tarindex] |= (pos - Base64);
- }
- tarindex++;
- state = 0;
- break;
- default:
- abort();
- }
- }
-
- /*
- * We are done decoding Base-64 chars. Let's see if we ended
- * on a byte boundary, and/or with erroneous trailing characters.
- */
-
- if (ch == Pad64) { /* We got a pad char. */
- ch = *src++; /* Skip it, get next. */
- switch (state) {
- case 0: /* Invalid = in first position */
- case 1: /* Invalid = in second position */
- return (-1);
-
- case 2: /* Valid, means one byte of info */
- /* Skip any number of spaces. */
- for (NULL; ch != '\0'; ch = *src++)
- if (!isspace(ch))
- break;
- /* Make sure there is another trailing = sign. */
- if (ch != Pad64)
- return (-1);
- ch = *src++; /* Skip the = */
- /* Fall through to "single trailing =" case. */
- /* FALLTHROUGH */
-
- case 3: /* Valid, means two bytes of info */
- /*
- * We know this char is an =. Is there anything but
- * whitespace after it?
- */
- for (NULL; ch != '\0'; ch = *src++)
- if (!isspace(ch))
- return (-1);
-
- /*
- * Now make sure for cases 2 and 3 that the "extra"
- * bits that slopped past the last full byte were
- * zeros. If we don't check them, they become a
- * subliminal channel.
- */
- if (target && target[tarindex] != 0)
- return (-1);
- }
- } else {
- /*
- * We ended by seeing the end of the string. Make sure we
- * have no partial bytes lying around.
- */
- if (state != 0)
- return (-1);
- }
-
- return (tarindex);
-}
diff --git a/contrib/bind/res/inet_net_ntop.c b/contrib/bind/res/inet_net_ntop.c
deleted file mode 100644
index ff948ff799a4..000000000000
--- a/contrib/bind/res/inet_net_ntop.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp $";
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
-static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
- char *dst, size_t size));
-
-/*
- * char *
- * inet_net_ntop(af, src, bits, dst, size)
- * convert network number from network to presentation format.
- * generates CIDR style result always.
- * return:
- * pointer to dst, or NULL if an error occurred (check errno).
- * author:
- * Paul Vixie (ISC), July 1996
- */
-char *
-inet_net_ntop(af, src, bits, dst, size)
- int af;
- const void *src;
- int bits;
- char *dst;
- size_t size;
-{
- switch (af) {
- case AF_INET:
- return (inet_net_ntop_ipv4(src, bits, dst, size));
- default:
- errno = EAFNOSUPPORT;
- return (NULL);
- }
-}
-
-/*
- * static char *
- * inet_net_ntop_ipv4(src, bits, dst, size)
- * convert IPv4 network number from network to presentation format.
- * generates CIDR style result always.
- * return:
- * pointer to dst, or NULL if an error occurred (check errno).
- * note:
- * network byte order assumed. this means 192.5.5.240/28 has
- * 0x11110000 in its fourth octet.
- * author:
- * Paul Vixie (ISC), July 1996
- */
-static char *
-inet_net_ntop_ipv4(src, bits, dst, size)
- const u_char *src;
- int bits;
- char *dst;
- size_t size;
-{
- char *odst = dst;
- char *t;
- u_int m;
- int b;
-
- if (bits < 0 || bits > 32) {
- errno = EINVAL;
- return (NULL);
- }
- if (bits == 0) {
- if (size < sizeof "0")
- goto emsgsize;
- *dst++ = '0';
- *dst = '\0';
- }
-
- /* Format whole octets. */
- for (b = bits / 8; b > 0; b--) {
- if (size < sizeof "255.")
- goto emsgsize;
- t = dst;
- dst += SPRINTF((dst, "%u", *src++));
- if (b > 1) {
- *dst++ = '.';
- *dst = '\0';
- }
- size -= (size_t)(dst - t);
- }
-
- /* Format partial octet. */
- b = bits % 8;
- if (b > 0) {
- if (size < sizeof ".255")
- goto emsgsize;
- t = dst;
- if (dst != odst)
- *dst++ = '.';
- m = ((1 << b) - 1) << (8 - b);
- dst += SPRINTF((dst, "%u", *src & m));
- size -= (size_t)(dst - t);
- }
-
- /* Format CIDR /width. */
- if (size < sizeof "/32")
- goto emsgsize;
- dst += SPRINTF((dst, "/%u", bits));
- return (odst);
-
- emsgsize:
- errno = EMSGSIZE;
- return (NULL);
-}
diff --git a/contrib/bind/res/inet_net_pton.c b/contrib/bind/res/inet_net_pton.c
deleted file mode 100644
index 5dfb1329c819..000000000000
--- a/contrib/bind/res/inet_net_pton.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp $";
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
-static int inet_net_pton_ipv4 __P((const char *src, u_char *dst,
- size_t size));
-
-/*
- * static int
- * inet_net_pton(af, src, dst, size)
- * convert network number from presentation to network format.
- * accepts hex octets, hex strings, decimal octets, and /CIDR.
- * "size" is in bytes and describes "dst".
- * return:
- * number of bits, either imputed classfully or specified with /CIDR,
- * or -1 if some failure occurred (check errno). ENOENT means it was
- * not a valid network specification.
- * author:
- * Paul Vixie (ISC), June 1996
- */
-int
-inet_net_pton(af, src, dst, size)
- int af;
- const char *src;
- void *dst;
- size_t size;
-{
- switch (af) {
- case AF_INET:
- return (inet_net_pton_ipv4(src, dst, size));
- default:
- errno = EAFNOSUPPORT;
- return (-1);
- }
-}
-
-/*
- * static int
- * inet_net_pton_ipv4(src, dst, size)
- * convert IPv4 network number from presentation to network format.
- * accepts hex octets, hex strings, decimal octets, and /CIDR.
- * "size" is in bytes and describes "dst".
- * return:
- * number of bits, either imputed classfully or specified with /CIDR,
- * or -1 if some failure occurred (check errno). ENOENT means it was
- * not an IPv4 network specification.
- * note:
- * network byte order assumed. this means 192.5.5.240/28 has
- * 0x11110000 in its fourth octet.
- * author:
- * Paul Vixie (ISC), June 1996
- */
-static int
-inet_net_pton_ipv4(src, dst, size)
- const char *src;
- u_char *dst;
- size_t size;
-{
- static const char
- xdigits[] = "0123456789abcdef",
- digits[] = "0123456789";
- int n, ch, tmp, dirty, bits;
- const u_char *odst = dst;
-
- ch = *src++;
- if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
- && isascii(src[1]) && isxdigit(src[1])) {
- /* Hexadecimal: Eat nybble string. */
- if (size <= 0)
- goto emsgsize;
- *dst = 0, dirty = 0;
- src++; /* skip x or X. */
- while ((ch = *src++) != '\0' &&
- isascii(ch) && isxdigit(ch)) {
- if (isupper(ch))
- ch = tolower(ch);
- n = strchr(xdigits, ch) - xdigits;
- assert(n >= 0 && n <= 15);
- *dst |= n;
- if (!dirty++)
- *dst <<= 4;
- else if (size-- > 0)
- *++dst = 0, dirty = 0;
- else
- goto emsgsize;
- }
- if (dirty)
- size--;
- } else if (isascii(ch) && isdigit(ch)) {
- /* Decimal: eat dotted digit string. */
- for (;;) {
- tmp = 0;
- do {
- n = strchr(digits, ch) - digits;
- assert(n >= 0 && n <= 9);
- tmp *= 10;
- tmp += n;
- if (tmp > 255)
- goto enoent;
- } while ((ch = *src++) != '\0' &&
- isascii(ch) && isdigit(ch));
- if (size-- <= 0)
- goto emsgsize;
- *dst++ = (u_char) tmp;
- if (ch == '\0' || ch == '/')
- break;
- if (ch != '.')
- goto enoent;
- ch = *src++;
- if (!isascii(ch) || !isdigit(ch))
- goto enoent;
- }
- } else
- goto enoent;
-
- bits = -1;
- if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
- /* CIDR width specifier. Nothing can follow it. */
- ch = *src++; /* Skip over the /. */
- bits = 0;
- do {
- n = strchr(digits, ch) - digits;
- assert(n >= 0 && n <= 9);
- bits *= 10;
- bits += n;
- } while ((ch = *src++) != '\0' &&
- isascii(ch) && isdigit(ch));
- if (ch != '\0')
- goto enoent;
- if (bits > 32)
- goto emsgsize;
- }
-
- /* Firey death and destruction unless we prefetched EOS. */
- if (ch != '\0')
- goto enoent;
-
- /* If nothing was written to the destination, we found no address. */
- if (dst == odst)
- goto enoent;
- /* If no CIDR spec was given, infer width from net class. */
- if (bits == -1) {
- if (*odst >= 240) /* Class E */
- bits = 32;
- else if (*odst >= 224) /* Class D */
- bits = 4;
- else if (*odst >= 192) /* Class C */
- bits = 24;
- else if (*odst >= 128) /* Class B */
- bits = 16;
- else /* Class A */
- bits = 8;
- /* If imputed mask is narrower than specified octets, widen. */
- if (bits >= 8 && bits < ((dst - odst) * 8))
- bits = (dst - odst) * 8;
- }
- /* Extend network to cover the actual mask. */
- while (bits > ((dst - odst) * 8)) {
- if (size-- <= 0)
- goto emsgsize;
- *dst++ = '\0';
- }
- return (bits);
-
- enoent:
- errno = ENOENT;
- return (-1);
-
- emsgsize:
- errno = EMSGSIZE;
- return (-1);
-}
diff --git a/contrib/bind/res/inet_neta.c b/contrib/bind/res/inet_neta.c
deleted file mode 100644
index 098059bc017e..000000000000
--- a/contrib/bind/res/inet_neta.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp $";
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <errno.h>
-#include <stdio.h>
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
-/*
- * char *
- * inet_neta(src, dst, size)
- * format a u_long network number into presentation format.
- * return:
- * pointer to dst, or NULL if an error occurred (check errno).
- * note:
- * format of ``src'' is as for inet_network().
- * author:
- * Paul Vixie (ISC), July 1996
- */
-char *
-inet_neta(src, dst, size)
- u_long src;
- char *dst;
- size_t size;
-{
- char *odst = dst;
- char *tp;
-
- while (src & 0xffffffff) {
- u_char b = (src & 0xff000000) >> 24;
-
- src <<= 8;
- if (b) {
- if (size < sizeof "255.")
- goto emsgsize;
- tp = dst;
- dst += SPRINTF((dst, "%u", b));
- if (src != 0L) {
- *dst++ = '.';
- *dst = '\0';
- }
- size -= (size_t)(dst - tp);
- }
- }
- if (dst == odst) {
- if (size < sizeof "0.0.0.0")
- goto emsgsize;
- strcpy(dst, "0.0.0.0");
- }
- return (odst);
-
- emsgsize:
- errno = EMSGSIZE;
- return (NULL);
-}
diff --git a/contrib/cpio/COPYING b/contrib/cpio/COPYING
deleted file mode 100644
index a43ea2126fb6..000000000000
--- a/contrib/cpio/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/contrib/cpio/COPYING.LIB b/contrib/cpio/COPYING.LIB
deleted file mode 100644
index bbe3fe198789..000000000000
--- a/contrib/cpio/COPYING.LIB
+++ /dev/null
@@ -1,481 +0,0 @@
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
-
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-
- GNU LIBRARY GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also compile or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- c) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- d) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/contrib/cpio/ChangeLog b/contrib/cpio/ChangeLog
deleted file mode 100644
index eaf14a9f8dfa..000000000000
--- a/contrib/cpio/ChangeLog
+++ /dev/null
@@ -1,968 +0,0 @@
-Tue Jan 16 19:03:05 1996 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * util.c: An I/O error reading a file would cause the last byte
- of the next file to be corrupted in the archive. Thanks to a
- buggy NT NFS server for pointing out this problem.
- * Version 2.4.2 released.
-
-Tue Jan 9 23:19:37 1996 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * copyout.c: missed 1 part of last bug fix.
-
-Mon Jan 8 16:49:01 1996 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * copyout.c, copypass.c: Use result of readlink() as length
- of link name instead of size from lstat(). On some OS's lstat()
- doesn't return the true length in size. Bug reported by
- Robert Joop (rj@rainbow.IN-berlin.DE).
-
-Wed Dec 20 10:52:56 1995 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * rmt.c: Added temporary kludge so make rmt will work on Linux.
- * configure.in: Only define HAVE_UTIME_H if utime.h declares
- struct utimbuf.
- * Makefile.in: Change prefix, exec_prefix and bindir to get their
- values from configure. Added cpio.info to DISTFILES.
- * cpio.texi: Added INFO-DIR-ENTRY.
- * Version 2.4.1 released.
-
-Wed Nov 22 19:37:05 1995 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * cpio.texi: Updated release date and FSF's address.
- * NEWS: Listed major new features for 2.4.
- * mt.c, mt.1: Added seek and fsfm commands.
- * Version 2.4 released.
-
-Tue Jun 27 19:14:27 1995 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * configure.in: fixed for new autoconf. Added check to make
- sure fnmatch() works.
- * Makefile.in: changed realclean to maintainer-clean. Added
- support to handle fnmatch separate from other LIBOBJS.
- * cpio.texi: More changes for 2.4.
-
-Wed Dec 14 16:14:27 1994 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * copypass.h: When given the -a option, set the access time of
- the copy to be the access time of the original (instead of the
- modification time of the original). Reported by
- karney@pppl.gov (Charles Karney).
- * cpio.texi: Updated with changes for 2.4.
-
-Wed Nov 3 18:18:07 1994 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * safe-stat.h, Makefile.in: New file used by mkdir.c. This will go
- away when we get the real safe-xstat.[ch]in for mkdir.c.
- * main.c: Don't mention [--null] twice in -p's usage message.
- Changed --no-absolute-paths to --no-absolute-filenames.
- * cpio.1: Updated man page with new features.
- * cpio.texi, texinfo.tex, Makefile.in: Added texi documentation
- from Robert Carleton (rbc@gnu.ai.mit.edu).
-
-Mon Oct 3 00:46:30 1994 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * makefile.pc, system.h: Changes to compile with Borland C++ 4.0.
-
-Thu Sep 29 22:15:50 1994 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * makepath.c: Don't #define index if it is already #defined.
-
- * mt.c: Check for __hpux defined instead of __hpux__. Reported
- by ericb@lsid.hp.com (Eric Backus).
-
-Thu Sep 29 11:21:31 1994 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * extern.h, util.c, copyout.c, copypass.c, main.c, global.c:
- Never mind --ignore-disk-input-errors flag, we'll just always
- do that, like tar.
-
- * global.c, extern.h, main.c, copyin.c, copyout.c, copypass.c:
- Added --quiet flag to supress printing number of blocks copied.
-
- * global.c, extern.h: If compiled with gcc, make input_bytes
- and output_bytes `long long' instead of `long'. We need more
- than 32 bits to keep track of the number of bytes copied to
- and from tape drives that hold more than 4Gbytes.
-
- * util.c, copyin.c, main.c, global.c, extern.h: Added
- --only-verify-crc flag to read a CRC format archive and verify
- its contents' CRCs.
-
- * copyout.c: Fixed problem with creating oldc format archives
- on machines with 16 bit ints. Reported by mpoole@cix.compulink.co.uk
- (Martin Poole).
-
- * mt.c: Need to open tape WR_ONLY for erase command (and probably
- others?). Reported by robert@hst.e.technik.uni-kl.de (Robert
- Vogelgesan). Accept `eject' as a synonym for `offline'. Accept
- `-t' as a synonym for `-f' (to be compatible with HPUX mt, which
- only accepts `-t').
-
-Wed Sep 28 12:01:55 1994 John Oleynick (juo@wombat.gnu.ai.mit.edu)
- * extern.h, global.c, main.c, util.c: only write sparse files
- when given --sparse flag.
- * extern.h, util.c, copyout.c, copypass.c, main.c, global.c:
- Added support for --ignore-disk-input-errors flag.
-
-Wed Aug 24 12:55:38 1994 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu)
-
- * configure.in: Replace calls to AC_REMOTE_TAPE and AC_RSH
- with equivalent code, since those macros are going away.
-
-Sun Feb 13 00:56:48 1994 John Oleynick (juo@goldman.gnu.ai.mit.edu)
- * extern.h, global.c, main.c, util.c: Added code to
- tape_buffered_peek() to properly handle large, corrutped
- archives, without overrunning the allocated buffer and
- dumping core. Also changed the way the input and output
- buffers are allocated in initialize_buffers().
-
-Tue Jan 25 01:04:32 1994 John Oleynick (juo@goldman.gnu.ai.mit.edu)
- * copyin.c, copyout.c, copypass.c, extern.h, main.c, tar.c, util.c:
- Redid i/o buffer code. Previously, the same routines buffered input and
- output for accessing the archive and the filesystem. Now there are
- separate routines for buffering input and output and for buffering the
- archive and the filesystem. This simplifies much of the buffer code
- (e.g., only input from the archive has to check for end of tape and
- allow the tape to be changed, only output to the filesystem has to
- handle byte and word swapping, etc.; previously one routine had to
- handle all of these special cases) This is how the routines got split
- and renamed (old name -> new name):
-
- clear_rest_of_block -> tape_clear_rest_of_block
- copy_files -> copy_files_tape_to_disk
- " -> copy_files_disk_to_disk
- " -> copy_files_disk_to_tape
- copy_buf_out -> disk_buffered_write
- " -> tape_buffered_write
- copy_in_buf -> tape_buffered_read
- empty_output_buffer -> tape_empty_output_buffer
- " -> disk_empty_output_buffer
- fill_input_buffer -> tape_fill_input_buffer
- " -> disk_fill_input_buffer
- pad_output -> tape_pad_output
- peek_in_buf -> tape_buffered_peek
- skip_padding -> tape_skip_padding
- toss_input -> tape_toss_input
-
- * extern.h, global.c, main.c, util.c: Added support for
- writing sparse files.
-
-Tue Dec 28 23:01:36 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
- * util.c, system.h, makepath.c, extern.h: don't define chown()
- and don't typedef uid_t and gid_t if we are being compiled
- by DJGPP.
-
- * copyin.c, extern.h, global.c, main.c: Added support for
- --rename-batch-file.
-
- * copyin.c, copyout.c, extern.h: Cleaned up to pass gcc -Wall.
-
-Wed Dec 22 02:17:44 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
-
- * makepath.c, copypass.c, copyin.c: If cpio was creating a
- directory that contained `.' in the pathname (e.g. `foo/./bar'),
- it would complain that it could not create `.', since it already
- exists. From schwab@issan.informatik.uni-dortmund.de (Andreas
- Schwab).
-
- * mt.c: Added "eject" as a synonym for "offline".
-
- * util.c: Slight modification to when we lseek with
- BROKEN_LONG_TAPE_DRIVER (do it every 1Gb, instead
- of every 2Gb).
-
- * copyin.c, global.c, extern.h: Added --no-absolute-paths option,
- to ignore absolute paths in archives.
-
-Tue Dec 21 01:30:59 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
-
- * util.c: Fix for copying new_media_message_after_number. From
- Christian.Kuehnke@arbi.informatik.uni-oldenburg.de (Christian
- Kuehnke).
-
-Thu Jul 29 20:35:57 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu)
-
- * Makefile.in (config.status): Run config.status --recheck, not
- configure, to get the right args passed.
-
-Mon Jul 19 23:01:00 1993 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu)
-
- * Makefile.in (libdir): Use standard GNU value --
- $(exec_prefix)/lib, not /etc.
- (.c.o): Put CFLAGS last.
-
-Thu Jul 8 19:43:39 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
-
- * Makefile.in: Add rules for remaking Makefile, configure,
- config.status.
-
-Mon Jul 5 14:54:08 1993 John Oleynick (juo@spiff.gnu.ai.mit.edu)
-
- * cpio.1: Updated man page for 2.3.
- * Makefile.in: Create distribution with .gz extension, instead of .z.
-
-Tue Jun 29 18:54:37 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
-
- * Makefile.in: Added installdirs target (using mkinstalldirs).
- * Added mkinstalldirs script.
- * main.c, mt.c: Added --help option. Changed usage() to
- take a stream and exit value (so --help can print on stdout
- and return a 0 exit status).
- * extern.h: Removed usage()'s prototype (it was out of date,
- and only used in main.c).
-
-Thu May 6 00:22:22 1993 John Oleynick (juo@hal.gnu.ai.mit.edu)
-
- * cpio.1: Added hpbin and hpodc.
-
-Tue May 4 00:32:29 1993 John Oleynick (juo@hal.gnu.ai.mit.edu)
-
- * copyin.c (process_copy_in), copypass.c (process_copy_pass): When
- deleting an existing file, if the file is a directory, use rmdir()
- instead of unlink().
-
-Thu Apr 29 14:43:56 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
-
- * tar.c (read_in_tar_header): Clear non-protection bits from
- mode, in case tar has left some device bits in there.
-
-Wed Apr 28 10:36:53 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
-
- * util.c: Added code to try and work around broken tape drivers
- that have problems with tapes > 2Gb.
-
- * copyout.c (process_copy_out): Pass file_hdr to
- writeout_other_defers() and add_link_defer() by reference,
- not by value.
-
- * copyin.c (process_copy_in): Pass file_hdr to defer_copyin()
- and create_defered_links() by reference, not by value.
-
- * defer.c: include <sys/types.h> (to build on BSD 4.3 on HP300)
-
-Fri Apr 16 18:01:17 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
-
- * mt.c, util.c: Include <sys/mtio.h> if HAVE_SYS_MTIO_H is
- defined, not HAVE_MTIO_H.
-
-Wed Apr 14 17:37:46 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
-
- * util.c: Include <sys/io/trioctl.h> if HAVE_SYS_IO_TRIOCTL_H
- is defined.
-
- * mt.c: Only include <sys/mtio.h> if HAVE_SYS_MTIO_H is defined.
-
-Fri Apr 2 13:09:11 1993 John Oleynick (juo@goldman.gnu.ai.mit.edu)
-
- * configure.in: Added fnmatch to AC_REPLACE_FUNCS. Added
- sys/io/trioctl.h to AC_HAVE_HEADERS.
-
- * Makefile.in: Removed fnmatch.o from OBJS.
-
- * copyin.c: Only include "fnmatch.h" if FNM_PATHNAME isn't
- defined yet.
-
- * mt.c: Include <sys/io/trioctl.h> if HAVE_SYS_IO_TRIOCTL_H is
- defined.
-
-Mon Mar 29 17:04:06 1993 John Oleynick (juo@hal.gnu.ai.mit.edu)
-
- * Many changes for supporting HPUX Context Dependent Files;
- also some bug fixes to fix problems with multiply (hard) linked
- device files; minor changes to support HPUX format archives
- (slightly broken?) System V.4 posix tar archives and HPUX
- posix tar archives.
-
- * Makefile.in: New files defer.o, defer,c and defer.h; added
- -DSYMLINK_USES_UMASK and -DHPUX_CDF comments; changed dist rule
- to use gzip with tar, instead of compress.
-
- * copyin.c: changes for new arf_hpbinary and arf_hpascii formats;
- HPUX CDF's; DEBUG_CPIO; fixes to properly handle multiple
- links in newc and crc format archives (new routines defer_copyin(),
- create_defered_links(), create_final_defers()); move most
- multiple (hard) link code to new routines link_name() and
- link_to_maj_min_ino(); use new macro UMASKED_SYMLINK instead of
- symlink().
-
- * copyout.c: fixes to properly handle multiple links in newc
- and crc format archives (new routines last_link(),
- count_defered_links_to_dev_ino(), add_link_defer(),
- writeout_other_defers(), writeout_final_defers(),
- writeout_defered_file()); support for new arf_hpbinary and
- arf_hpascii formats; support for HPUX CDF's.
-
- * copypass.c: move most multiple link code to new routines
- link_name() and link_to_maj_min_ino(); use new macro UMASKED_SYMLINK
- instead of symlink(); support for HPUX CDF's.
-
- * extern.h: added arf_hpascii and arf_hpbinary archive enum types;
- added debug_flag.
-
- * global.c: added debug_flag.
-
- * main.c: added debug_flag; support for hpodc and hpbin formats.
-
- * makepath.c: split from standard makpath.c to add support
- for HPUX CDF's.
-
- * mt.c: added !defined(__osf__) (from Andrew Marquis
- <amarquis@genome.wi.mit.edu>).
-
- * system.h: new macro UMASKED_SYMLINK
-
- * tar.c: minor changes to read (slightly broken?) System V.4 posix
- tar archives and HPUX posix tar archives.
-
- * util.c: HPUX CDF support (including new routines
- add_cdf_double_slashes() and islasparentcdf()); new routine
- umasked_symlink().
-
-Sun Mar 14 23:00:14 1993 Jim Meyering (meyering@comco.com)
-
- * copypass.c (process_copy_pass): Use <=, not just <, when comparing
- mtimes. From Pieter Bowman <bowman@math.utah.edu>.
-
-Fri Jan 15 14:35:37 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu)
-
- * copyin.c: Move include of fnmatch.h to get right FNM* macros.
-
-Tue Nov 24 08:45:32 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
-
- * Version 2.2.
-
- * copyout.c (process_copy_out): Add parens for gcc -Wall.
- From Jim Meyering.
-
- * system.h: Use HAVE_FCNTL_H, not USG.
-
- * dstring.c, mt.c, system.h: Use HAVE_STRING_H, not USG.
-
-Fri Nov 20 22:47:18 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
-
- * copyin.c (read_in_binary): Copy the dev and ino that are
- already in `file_hdr' into `short_hdr'.
- From dao@abars.att.com (David A Oshinsky).
-
- * system.h [!_POSIX_VERSION]: Declare lseek as off_t, not long.
- From Karl Berry.
-
-Wed Oct 14 13:53:41 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
-
- * Version 2.1.
-
-Tue Oct 13 22:51:34 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
-
- * main.c: Add --swap equivalent to -b.
-
- * mt.c: Add f_force_local variable and -V --version option.
-
-Fri Oct 2 18:42:27 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu)
-
- * main.c (long_opts, usage): Add --force-local option.
-
-Thu Oct 1 23:23:43 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu)
-
- * main.c (process_args) [__MSDOS__]: Don't call geteuid.
-
- * copyin.c (read_in_{old,new}_ascii): Use `l' for sscanf into longs.
- * copyout.c (write_out_header): Ditto for sprintf.
- * global.c, extern.h: Make input_size and output_size long.
-
-Thu Sep 10 23:39:30 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
-
- * global.c, extern.h: Add new var f_force_local to work with
- rmt.h change from tar.
-
-Sun Aug 23 00:18:20 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu)
-
- * Version 2.0.
-
- * tar.c (otoa): Compute value in an unsigned long, not an int.
- * copyout.c (write_out_header) [__MSDOS__]: Don't use dev_t.
-
- * main.c (process_args): By default, don't chown for non-root users.
-
-Sat Aug 22 14:17:54 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
-
- * global.c, extern.h: Use uid_t and gid_t.
-
- * main.c (main) [__EMX__]: Expand wildcards.
- * system.h [__EMX__]: Alias some error names. From Kai Uwe Rommel.
-
- * extern.h [__STDC__]: Use prototypes.
-
- * copyin.c (process_copy_in), copyout.c (process_copy_out),
- copypass.c (process_copy_pass): Open all files with O_BINARY.
- Add cast to chmod call.
- * util.c: Add cast to bcopy calls. Make hash_insert static.
- From Kai Uwe Rommel.
-
-Thu Aug 20 22:03:49 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
-
- * util.c (peek_in_buf): Don't print "end of file" before
- getting the next reel of medium.
-
- * copyin.c (read_in_old_ascii): Allocate space for NUL terminator.
- Print newline for dot line when done, even if appending.
-
-Thu Jul 23 16:34:53 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
-
- * tar.c (write_out_tar_header, read_in_tar_header)
- [__MSDOS__]: Don't try to get user and group names.
- * extern.h: Don't declare the functions to do it (need uid_t).
-
- * main.c [__MSDOS__]: Ignore the -R option.
-
- * system.h: Define makedev if defining major and minor.
-
- * copyin.c, copyout.c [__MSDOS__]: setmode on archive_des, not
- 0 and 1.
-
-Sat Jul 18 14:30:55 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
-
- * tar.c, stripslash.c, userspec.c, cpiohdr.h, tar.h, tarhdr.h,
- system.h: New files.
- * Move portability stuff from various files to system.h.
- * cpio.h: Rename header structure and members, and add
- new structure for SVR4 format.
- * copyin.c, copyout.c: Use the new structure internally, the
- old one only for I/O in the old formats.
- * copyin.c (read_in_header): Recognize the new archive formats.
- (read_in_new_ascii, read_pattern_file, skip_padding): New functions.
- (swab_array): Do the swapping using char pointers instead of
- bitwise arithmetic.
- (process_copy_in): Handle byte and halfword swapping and new formats.
- Ok if a directory we want to make already exists, but set its perms.
- Do chmod after chown to fix any set[ug]id bits.
- Use `struct utimbuf' instead of a long array.
- * copyout.c (write_out_header): Handle new formats.
- (process_copy_out): Use `struct utimbuf'.
- Handle appending and new formats.
- Remove any leading `./' from filenames.
- (read_for_checksum, clear_rest_of_block, pad_output): New functions.
- * copypass.c (process_copy_pass): Use `struct utimbuf'.
- Ok if a directory we want to make already exists, but set its perms.
- Do chmod after chown to fix any set[ug]id bits.
- Don't change perms of `.'.
- * extern.h, global.c: Replace the separate format flags with
- one variable. Add new variables for the new options.
- * main.c: Add new options -A --append, -H --format, -C --io-size,
- -M --message, --no-preserve-owner, -R --owner, -E --pattern-file,
- -V --dot, -s --swap-bytes, -S --swap-halfwords, -b, -I, -k, -O.
- (usage): Document them.
- (process_args): Recognize them. Use open_archive.
- (initialize_buffers): Allow room for tar archives and double buffers.
- * util.c (empty_output_buffer_swap): New function.
- (empty_output_buffer): Call it if swapping current file.
- Check additional end of media indicators.
- (swahw_array, peek_in_buf, prepare_append, open_archive,
- set_new_media_message): New functions.
- (fill_input_buffer): Don't print error message if end of media.
- (toss_input): Don't seek, always read.
- (copy_files): Update crc if needed.
- (find_inode_file, add_inode): Check major and minor numbers as
- well as dev.
- (get_next_reel): Prompt user if archive name is unknown.
- Print fancy messages.
- Close the archive and reopen it.
-
- Above primarily from John Oleynick <juo@klinzhai.rutgers.edu>.
-
- * util.c (find_inode_file): Use modulus when computing initial
- loop index.
- (add_inode): Zero out new entry.
- From scott@sctc.com (Scott Hammond).
-
- * cpio.h, copyin.c, copyout.c: Rename `struct cpio_header'
- members from h_foo to c_foo.
-
-Wed May 20 00:09:26 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu)
-
- * copyin.c: If we include a header file specifically to get
- major et al., assume we have them.
-
-Mon Mar 9 19:29:20 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
-
- * mt.c (main): rmtclose the tape file descriptor.
-
- * main.c (main): rmtclose the archive, if not in copy-pass mode.
-
- * util.c (create_all_directories): Don't print a message when
- creating a directory, for UNIX compat.
-
- * copyin.c (process_copy_in), copypass.c (process_copy_pass):
- Skip file if it has the same timestamp as existing file, not just
- if it is older than existing file, for UNIX compat.
-
-Tue Mar 3 12:06:58 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu)
-
- * main.c, mt.c (usage): Document long options as starting with
- -- instead of +.
-
- * extern.h: Only declare lseek if not _POSIX_VERSION.
-
-Tue Dec 24 00:19:45 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu)
-
- * copyin.c: Use MAJOR_IN_MKDEV and MAJOR_IN_SYSMACROS instead
- of USG and _POSIX_VERSION to find major and minor macros.
-
- * mt.c: Use unistd.h and stdlib.h if available.
-
- * copyin.c, copyout.c, copypass.c, util.c, extern.h: Change
- POSIX ifdefs to HAVE_UNISTD_H and _POSIX_VERSION.
-
-Sun Aug 25 06:31:08 1991 David J. MacKenzie (djm at apple-gunkies)
-
- * Version 1.5.
-
- * bcopy.c: New file (moved from util.c).
-
- * mt.c (print_status): Not all hpux machines have mt_fileno
- and mt_blkno; rather than trying to track HP's product line,
- just assume none of them have them.
-
- * util.c (copy_buf_out, copy_in_buf): Use more efficient
- copying technique for a big speedup.
-
-Fri Aug 2 04:06:45 1991 David J. MacKenzie (djm at apple-gunkies)
-
- * configure: Support +srcdir. Create config.status.
- Remove it and Makefile if interrupted while creating them.
-
-Thu Jul 18 09:43:40 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu)
-
- * Many files: use __MSDOS__ instead of MSDOS.
-
- * util.c, configure: Use NO_MTIO instead of HAVE_MTIO, to keep
- up with tar and rtapelib.c.
-
-Mon Jul 15 13:45:30 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu)
-
- * configure: Also look in sys/signal.h for signal decl.
-
-Thu Jul 11 01:50:32 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu)
-
- * Version 1.4.
-
- * configure: Remove /etc and /usr/etc from PATH to avoid
- finding /etc/install.
-
-Wed Jul 10 01:40:07 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu)
-
- * makefile.pc: Rewrite for Turbo C 2.0.
- * util.c [__TURBOC__] (utime): New function.
- * alloca.c, tcexparg.c: New files.
-
- * extern.h [STDC_HEADERS]: Don't declare malloc and realloc.
-
- * main.c [MSDOS]: Make binary mode the default.
- * copyin.c, copyout.c: Make stdin or stdout binary mode as
- appropriate (so cpio archives don't get corrupted).
-
- * Many files: Use <string.h> if STDC_HEADERS as well as if USG.
-
- * configure, Makefile.in: $(INSTALLPROG) -> $(INSTALL),
- $(INSTALLTEXT) -> $(INSTALLDATA).
-
-Mon Jul 8 23:18:28 1991 David J. MacKenzie (djm at wookumz.gnu.ai.mit.edu)
-
- * configure: For some library functions that might be missing,
- conditionally add the .o files to Makefile instead of
- defining func_MISSING.
- * mkdir.c: Renamed from mkrmdir.c.
-
-Sat Jul 6 02:27:22 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu)
-
- * configure: echo messages to stdout, not stderr.
- Use a test program to see if alloca needs -lPW.
-
-Thu Jun 27 16:15:15 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu)
-
- * copyin.c (process_copy_in), copyout.c (process_copy_out),
- copypass.c (process_copy_pass): Check close return value for
- delayed error notification because of NFS.
-
-Thu Jun 20 02:43:33 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu)
-
- * configure: Include $DEFS when compiling test programs.
-
- * util.c: Only declare getpwuid and getgrgid if not POSIX.
-
- * Version 1.3.
-
- * copyin.c: Use time_t, not long, for time values.
-
- * mt.c (print_status): Special cases for HP-UX and Ultrix.
-
- * util.c: Compile bcopy if USG or STDC_HEADERS, not BCOPY_MISSING.
-
-Tue Jun 11 16:40:02 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu)
-
- * copyin.c: Don't include sys/sysmacros.h if _POSIX_SOURCE.
-
- * copyin.c, copyout.c, copypass.c: Don't include sys/file.h if POSIX.
-
- * util.c: Include sys/types.h before, not after, pwd.h and grp.h.
-
- * configure: New shell script to aid configuration and create
- Makefile from Makefile.in.
-
- * copyin.c (process_copy_in): Use POSIX.2 fnmatch instead of
- glob_match.
-
-Mon Jun 10 22:11:19 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu)
-
- * global.c, extern.h: New variable, name_end.
- * main.c (process_args, usage): Add -0 +null option to set it.
- * copypass.c (process_copy_pass), copyout.c (process_copy_out):
- Use it.
-
- * dstring.c (ds_fgetstr): New function made from ds_fgets.
- (ds_fgets, ds_fgetname): Implement as front ends to ds_fgetstr.
-
-Sun Jun 2 15:45:24 1991 David J. MacKenzie (djm at wheat-chex)
-
- * most files: use GPL version 2.
-
-Sat May 18 11:39:22 1991 David J. MacKenzie (djm at geech.gnu.ai.mit.edu)
-
- * copyin.c, copypass.c: Take out #ifdef MSDOS around chown.
- * util.c [MSDOS]: Provide dummy chown.
-
-Fri May 17 21:29:05 1991 David J. MacKenzie (djm at churchy.gnu.ai.mit.edu)
-
- * Version 1.2.
-
- * makefile.pc, cpio.cs: Update for new source and object files.
-
-Fri Mar 15 05:48:36 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
-
- * global.c, extern.h: New variable `archive_desc'.
- * main.c (process_args): Set it.
- * copyout.c (process_copy_out), copyin.c (process_copy_in):
- Use it.
-
- * copyout.c (process_copy_out), copyin.c (process_copy_in):
- Remote tapes are special and not seekable; don't fstat them.
-
- * main.c (main, usage): Add -F, +file option. Use rmtopen.
- (main): Exit after printing version number.
- * util.c (empty_output_buffer): Use rmtwrite instead of write.
- (fill_input_buffer): Use rmtread instead of read.
- (tape_offline): Use rmtioctl instead of ioctl.
- Test HAVE_MTIO instead of MTIO_MISSING, for tar compatibility.
-
-Thu Mar 14 17:49:57 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
-
- * util.c (create_all_directories): Use make_path to do the work.
-
-Sat Jan 12 15:32:15 1991 David J. MacKenzie (djm at geech.ai.mit.edu)
-
- * copyin.c, copyout.c, copypass.c, util.c: Only declare
- `errno' if not MSDOS. Some Unix errno.h do, some don't . . . .
-
- * global.c, extern.h: Make `input_size' and `output_size'
- unsigned, for 16 bit machines.
-
- * copyin.c (print_name_with_quoting): All non-ctrl chars are
- printable on MS-DOS.
-
- * util.c (empty_output_buffer): Never make sparse files;
- can create unrunnable executables.
- * copyin.c, copyout.c, copypass.c: Callers changed.
- * util.c (finish_output_file): Function removed.
-
-Tue Nov 6 15:47:16 1990 David J. MacKenzie (djm at apple-gunkies)
-
- * copyin.c, util.c, extern.h: Rename copystring to xstrdup.
-
-Mon Oct 29 02:24:41 1990 David J. MacKenzie (djm at apple-gunkies)
-
- * util.c (empty_output_buffer): Only make sparse files if
- NO_SPARSE_FILES is undefined, to accomodate dumb kernels.
-
-Wed Jul 25 18:48:35 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
-
- * util.c (getuser, getgroup): Make uid and gid unsigned short,
- not int.
-
-Sat Jul 21 00:44:44 1990 David J. MacKenzie (djm at apple-gunkies)
-
- * copyin.c, copyout.c, copypass.c, util.c, cpio.h: Add ifdefs
- for MSDOS.
-
-Sun Jul 15 23:51:48 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
-
- * copyin.c, copyout.c, copypass.c, global.c, extern.h, util.c:
- Use longs where appropriate, for 16 bit machines.
-
-Sun Jul 8 22:58:06 1990 David J. MacKenzie (djm at apple-gunkies)
-
- * main.c (process_args, usage): Change -b option to -O (old), to
- allow adding byte swapping later.
-
-Sat Jul 7 14:48:35 1990 David J. MacKenzie (dave at edfmd)
-
- * Version 1.1.
-
- * cpio.h: Make `mtime' and `filesize' unsigned long.
- * copyin.c (read_in_binary), copyout.c (write_out_header):
- High short-word of `mtime' and `filesize' always comes first.
-
- * (read_in_ascii, read_in_binary): New functions, from code in
- read_in_header.
- (read_in_header): Search for valid magic number, then fill in
- rest of header using read_in_ascii and read_in_binary.
- * global.c, extern.h: New variable, `binary_flag'.
- * main.c (process_args): Recognize new -b +binary option.
- * util.c [BCOPY_MISSING] (bcopy): New function.
-
-Wed Jul 4 00:40:58 1990 David J. MacKenzie (djm at apple-gunkies)
-
- * main.c (process_args): Add local pointers to functions to
- work around a pcc bug found on a Convex.
-
- * copyin.c (process_copy_in), util.c (toss_input,
- create_all_directories, add_inode): Don't use `index' as a
- variable name.
-
-Tue Jul 3 02:33:36 1990 David J. MacKenzie (djm at apple-gunkies)
-
- * version 1.0.
-
-Mon Jul 2 23:18:56 1990 David J. MacKenzie (djm at twiddle)
-
- * copyin.c (process_copy_in), copyout.c (process_copy_out),
- copypass.c (process_copy_pass): Print "1 block", not "1 blocks".
-
- * copyin.c (process_copy_in), copypass.c (process_copy_pass):
- Unlink existing dest. file unless either it is newer and
- not unconditional, or it is a directory.
-
-Mon Jul 2 03:57:41 1990 David J. MacKenzie (dave at edfmd)
-
- * util.c (xrealloc): New function.
- * dstring.c (ds_resize): Use xrealloc instead of free and
- xmalloc. Never shrink the string.
-
- * copypass.c (process_copy_pass): More efficient
- string handling while constructing output filename.
-
- * global.c, extern.h, main.c, cpio.h: Change from an enum,
- `copy_command', to a pointer to a void function, `copy_function'.
-
- * cpio.h (struct cpio_header): Make most fields unsigned.
- Rename h_filesize to h_filesizes and h_mtime to h_mtimes, and
- add new `long' fields with the old names at the end of the
- structure.
- * copyin.c (read_in_header): Set the long fields from the
- short arrays, making sure longs are aligned properly.
- (process_copy_in, long_format): Use the long fields.
- * copyout.c (write_out_header): Set the short arrays from the
- long fields, making sure longs are aligned properly.
- (process_copy_out): Use the long fields.
-
- * global.c, extern.h: New variable `output_is_seekable'.
- * util.c (empty_output_buffer): If output_is_seekable, use
- lseek to write blocks of zeros.
- (finish_output_file): New function.
- * copyin.c (process_copy_in), copyout.c (process_copy_out),
- copypass.c (process_copy_pass): Set `output_is_seekable'
- correctly and call finish_output_file.
- * main.c (initialize_buffers): Allocate space for sentinel in
- `output_buffer'.
-
- * global.c, extern.h: New variable `numeric_uid'.
- * main.c (process_args): Accept -n +numeric-uid-gid option, like ls.
- * copyin.c (long_format): Use numeric_uid.
-
- * copyin.c (process_copy_in), copyout.c (process_copy_out),
- copypass.c (process_copy_pass): Don't (for verbose) print the
- names of files that are not copied because of errors. Try to
- create missing directories for all file types. Free temporary
- buffers on error.
-
-Sat Jun 30 14:28:45 1990 David J. MacKenzie (djm at apple-gunkies)
-
- * version.c: New file.
- * main.c: Add -V, +version option.
- * Makefile [dist]: Extract version number from version.c.
-
-Sat Jun 30 12:44:47 1990 David J. MacKenzie (dave at edfmd)
-
- * global.c, extern.h, copyin.c, copyout.c, util.c: Rename
- `{input,output}_is_regular' to `{input,output}_is_special' and
- reverse the truth value.
-
- * global.c, extern.h: New variable `input_is_seekable' to
- control whether to skip data with lseek or read.
- * copyin.c (process_copy_in): Set it.
- * util.c (toss_input): Use it.
-
- * global.c, extern.h: New variable `xstat' that selects stat
- or lstat for input files.
- * main.c (process_args): New option -L, +dereference to set
- xstat to stat instead of lstat.
- (usage): Document it.
- * copyout.c (process_copy_out), copypass.c
- (process_copy_pass): Use *xstat on input file.
-
-Sat Jun 30 01:53:12 1990 David J. MacKenzie (dave at edfmd)
-
- * dstring.c (ds_init): Return void because return value was
- never used.
- (ds_resize): Ditto, and free old value instead of new one.
-
- * util.c (empty_output_buffer, fill_input_buffer,
- copy_out_buf, copy_in_buf, toss_input, copy_files): Return
- void instead of an error value and make errors fatal
- immediately instead of several levels up, to prevent printing
- of multiple error messages by different levels of functions.
-
- * copyin.c (read_in_header): Return void, because the error
- handling all happens at lower levels.
- (print_name_with_quoting): New function.
- (long_format): Call print_name_with_quoting. Take additional
- arg for name of linked-to file, and print it if nonzero.
- (process_copy_in): For verbose listing of symlinks, read in
- the linkname and pass it to long_format.
-
- * extern.h: Declare some more functions.
-
-Thu Jun 28 16:07:15 1990 David J. MacKenzie (dave at edfmd)
-
- * copypass.c (process_copy_pass): Warn about unknown file types.
-
- * copyout.c (process_copy_out): Check fstat return for error.
- Record filesize of 0 for special files. Warn about unknown
- file types.
-
- * copyin.c (process_copy_in): Warn about unknown file types.
- (read_in_header): Warn about byte-reversed binary headers.
-
-Sat Jun 23 22:50:45 1990 David J. MacKenzie (dave at edfmd)
-
- * main.c (main): Set umask to 0 so permissions of created
- files are preserved.
-
- * copyin.c, copyout.c, copypass.c, util.c: Pass file
- descriptors as ints, not pointers to ints.
- Cast file timestamps and sizes to long *, not int *, for 16
- bit machines.
- Use lstat instead of stat, if available.
- Handle FIFO's, sockets, and symlinks, if supported by O.S.
-
- * copyin.c (process_copy_in), copyout.c (process_copy_out):
- Don't consider FIFO'S, sockets, etc. to be possible tape drives.
-
- * util.c (create_all_directories): Fix incorrect loop
- termination check. Only copy string if it contains slashes.
- Don't check whether directory "" exists.
- (tape_offline): Code moved from get_next_reel.
- (get_next_reel): Print message before taking tape offline.
- Read a line of arbitrary length.
-
- * copyout.c, copyin.c, copypass.c: Always use utime, not utimes.
-
- * copyin.c (swab_short): New macro.
- (swab_array): New function.
- (read_in_header): In binary mode, if a byte-swapped header is
- read, swap the bytes back.
- (process_copy_in, process_copy_pass): Don't stat each file to
- create unless !unconditional_flag. Create device files correctly.
- Don't temporarily allow files being created to be read by
- other users. Don't unnecessarily chmod special files.
-
-Thu May 31 20:51:43 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
-
- * copyin.c (long_format): Use mode_string to format
- file protections instead of doing it ourselves.
- (protections): Function removed.
-
-Sat Apr 14 02:31:01 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
-
- * cpio.h (struct cpio_header): Make inode, mode, uid, gid
- fields unsigned.
-
- * util.c (getgroup): New function.
- * copyin.c (long_format): Print group name of files.
- Print file size, etc. as unsigned integers, not signed.
-
- * main.c (process_args): If -t is given and neither -i, -o, or
- -p is given, assume -i.
-
- * Add -f, +nonmatching option.
- * main.c: Rename +out to +create, +in to +extract,
- +modification-time to +preserve-modification-time,
- +pass to +pass-through.
-
- * copyin.c (process_copy_in), copypass.c (process_copy_pass):
- Don't complain in chown fails because the user doesn't have
- permission.
-
-Fri Apr 13 13:53:20 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
-
- * Add ifdefs for USG/Xenix.
- * util.c (cpio_error): Function removed.
- * Use error instead of cpio_error, so system error messages
- will be included.
- * cpio.h: Rename 'hdr_struct' to 'struct cpio_header'.
- * Move definition of xmalloc from dstring.c to util.c.
- * global.c, extern.c: Add global `program_name'.
- * main.c (main): Set program_name.
- (process_args): Rename +reset-atime to +reset-access-time,
- +table to +list.
- Have +block-size take an argument.
-
-Thu Apr 12 13:33:32 1990 David J. MacKenzie (djm at rice-chex)
-
- * util.c (find_inode_file): Make inode an int, not a short.
-
- * Make functions that don't return a value have type void.
- Add some casts to function calls.
-
-Wed Apr 11 14:55:28 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
-
- * main.c (process_args): -i, -o, and -p don't take arguments.
-
- * main.c (process_args): Get the non-option args from the
- correct elements of argv.
-
-Tue Apr 10 00:20:26 1990 David J. MacKenzie (djm at albert.ai.mit.edu)
-
- * Indent source code and update copyrights.
-
- * cpio.c (usage): Change `collection' to `archive' in message.
-
-Thu Dec 28 03:03:55 1989 David J. MacKenzie (djm at hobbes.ai.mit.edu)
-
- * dstring.c (xmalloc): Don't return a null pointer if size is 0,
- on the assumption that trying to allocate 0 bytes is a bug that
- should be trapped.
-
-Wed Dec 20 03:24:48 1989 David J. MacKenzie (djm at hobbes.ai.mit.edu)
-
- * All files: Change from GNU CPIO General Public License to
- GNU General Public License.
-
-Mon Dec 18 13:18:36 1989 David J. MacKenzie (djm at hobbes.ai.mit.edu)
-
- * Makefile: Add clean target and defines for CC and LDFLAGS.
- Add dist target and SRCS, DISTFILES macros. Add tags and TAGS targets.
- * dstring.c (ds_fgets): Read characters into an int, not char.
- (xmalloc): New function.
- (out_of_memory): Function removed.
- Global: use xmalloc instead of malloc and out_of_memory.
- * extern.h, global.c: Make flag variables ints instead of chars for
- compatibility with getopt_long.
- * extern.h: Declare more functions.
- * main.c (usage): Put the whole usage message into a single string
- and fix errors.
- * util.c (create_all_directories): Remove unused variable.
- (get_next_reel): Ditto.
- * dstring.h: Declare function.
-
-Sat Dec 2 13:22:37 1989 David J. MacKenzie (djm at hobbes.ai.mit.edu)
-
- * main.c: Change +copy-pass option to +pass, +copy-in to +in,
- +copy-out to +out, and +mkdir to +make-directories, and add null
- option to terminate table.
- (process_args): Use the same code to handle long and short named
- options.
- (usage): Mention long options in message.
-
-Local Variables:
-mode: indented-text
-left-margin: 8
-version-control: never
-End:
diff --git a/contrib/cpio/FREEBSD-upgrade b/contrib/cpio/FREEBSD-upgrade
deleted file mode 100644
index ac95b1efde94..000000000000
--- a/contrib/cpio/FREEBSD-upgrade
+++ /dev/null
@@ -1,15 +0,0 @@
-GNU cpio 2.4.2
- originals can be found at: ftp://prep.ai.mit.edu/pub/gnu
-
- removed files:
- INSTALL cpio.info mkdir.c
- Makefile.in cpio.texi mkinstalldirs
- argmatch.c fnmatch.c mt.1
- bcopy.c fnmatch.h mt.c
- configure install-sh rmt.c
- configure.in makefile.os2 strdup.c
- cpio.def makefile.pc tcexparg.c
- texinfo.tex
-
-
- obrien@FreeBSD.org
diff --git a/contrib/cpio/NEWS b/contrib/cpio/NEWS
deleted file mode 100644
index 5da98da8d83a..000000000000
--- a/contrib/cpio/NEWS
+++ /dev/null
@@ -1,64 +0,0 @@
-
-Major changes in version 2.4:
-
-* new texinfo documentation
-* --sparse option to write sparse files
-* --only-verify-crc option to verify a CRC format archive
-* --no-absolute-paths option to ignore absolute paths
-* --quiet option to supress printing number of blocks copied
-* handle disk input errors more gracefully
-
-Major changes in version 2.3:
-
-* in newc and crc format archives, only store 1 copy of multiply linked files
-* handle multiply linked devices properly
-* handle multiply linked files with cpio -pl even when the source and
- destination are on different file systems
-* support HPUX Context Dependent Files
-* read and write HPUX cpio archives
-* read System V.4 POSIX tar archives and HPUX POSIX tar archives
-* use rmdir, instead of unlink, to delete existing directories
-
-Major changes in version 2.2:
-
-* handle link counts correctly when reading binary cpio archives
-* configure checks for some libraries that SVR4 needs
-
-Major changes in version 2.1:
-
-* cpio can access remote non-device files as well as remote devices
-* fix bugs in the MS-DOS port
-* add --swap equivalent to -b option
-
-Version 2.0 adds the following features:
-
-Support for the SVR4 cpio formats, which can store inodes >65535, and
-for traditional and POSIX tar archives. Also adds these options:
-
--A --append append to instead of replacing the archive
--V --dot print a dot for each file processed
--H --format select archive format
--C --io-size select I/O block size in bytes
--M --message print a message at end of media volumes
---no-preserve-owner don't change files' owners when extracting
--R --owner set files' owners when extracting
--E --pattern-file list of shell filename patterns to process
--s --swap-bytes handle byte-order differences when extracting files
--S --swap-halfwords ditto
--b like -sS
--I input archive filename
--k recognize corrupted archives (we alawys do it, though)
--O output archive filename
-
-Some options of previous versions have been renamed in 2.0:
-
---binary was replaced by --format=bin
---portability was replaced by --format=odc
-
-Some options have changed meaning in 2.0, for SVR4 compatibility:
-
--O used to select the binary archive format, now selects the output file
--V used to print the version number, now prints a dot for each file
-
-Version 2.0 also fixes several bugs in the handling of files with
-multiple links and of multi-volume archives on floppy disks.
diff --git a/contrib/cpio/README b/contrib/cpio/README
deleted file mode 100644
index 8206e9731537..000000000000
--- a/contrib/cpio/README
+++ /dev/null
@@ -1,71 +0,0 @@
-This is GNU cpio, a program to manage archives of files.
-As of version 2.0, it supports the features of the System V release 4
-cpio, including support for tar archives.
-
-This package also includes rmt, the remote tape server, and mt, a tape
-drive control program; these two programs will only be compiled if
-your system supports remote command execution, and tape drive control
-operations, respectively.
-
-See the file INSTALL for compilation and installation instructions for Unix.
-
-For non-Unix systems:
-
-makefile.pc is a makefile for Turbo C or C++ or Borland C++ on MS-DOS.
-
-makefile.os2 is a makefile for MS C and GNU C (emx/gcc) on OS/2.
-cpio.def is a linker definition file for the MS C OS/2 version.
-
-
-The main advantages of GNU cpio over Unix versions are:
-
-* It can access tape drives on other hosts using TCP/IP.
-
-* `-o' and `-p' can copy symbolic links either as symbolic links or,
-with `-L', as the files they point to.
-
-* `-i' automatically recognizes the archive format and tries to
-recover from corrupted archives.
-
-* The output of '-itv' looks like 'ls -l'.
-
-* It accepts long-named options as well as traditional
-single-character options.
-
-A few features of other versions of cpio are missing from GNU cpio, including:
-
-* The `-6' option to support Sixth Edition Unix cpio archives with `-i'.
-
-* An option to limit volume size, like afio -s.
-
-
-GNU cpio supports the POSIX.1 "ustar" tar format. GNU tar supports a
-somewhat different, early draft of that format. That draft format has
-a slightly different magic number in the tar header and doesn't
-include the path prefix part of the header, which allows storing file
-names that are longer than 100 characters. GNU cpio knows to
-recognize the nonstandard GNU tar "ustar" archives.
-
-The following patch to GNU tar 1.11.1 makes GNU tar recognize standard
-"ustar" archives, such as GNU cpio produces, except that it won't use
-the path prefix. Without this patch, GNU tar thinks that standard
-"ustar" archives are old-format tar archives and can not use the extra
-information that "ustar" format contains. If you use this patch,
-remember that you will lose the beginnings of paths that are longer
-than 100 characters. That's why it's not an official part of GNU tar.
-(Adding support for the path prefix to GNU tar is not trivial.)
-
---- list.c.orig Mon Sep 14 17:04:03 1992
-+++ list.c Wed Oct 14 14:02:28 1992
-@@ -439,7 +439,7 @@
- st->st_ctime = from_oct(1+12, header->header.ctime);
- }
-
-- if (0==strcmp(header->header.magic, TMAGIC)) {
-+ if (0==strncmp(header->header.magic, TMAGIC, 5)) {
- /* Unix Standard tar archive */
- *stdp = 1;
- if (wantug) {
-
-Mail suggestions and bug reports for GNU cpio to
-bug-gnu-utils@prep.ai.mit.edu.
diff --git a/contrib/cpio/alloca.c b/contrib/cpio/alloca.c
deleted file mode 100644
index 7061cec2d314..000000000000
--- a/contrib/cpio/alloca.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
-#define NULL 0
-
-/* Different portions of Emacs need to call different versions of
- malloc. The Emacs executable needs alloca to call xmalloc, because
- ordinary malloc isn't protected from input signals. On the other
- hand, the utilities in lib-src need alloca to call malloc; some of
- them are very simple, and don't have an xmalloc routine.
-
- Non-Emacs programs expect this to call use xmalloc.
-
- Callers below should use malloc. */
-
-#ifndef emacs
-#define malloc xmalloc
-#endif
-extern pointer malloc ();
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (size)
- unsigned size;
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
diff --git a/contrib/cpio/copyout.c b/contrib/cpio/copyout.c
deleted file mode 100644
index 39890b07ef3b..000000000000
--- a/contrib/cpio/copyout.c
+++ /dev/null
@@ -1,945 +0,0 @@
-/* copyout.c - create a cpio archive
- Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "filetypes.h"
-#include "system.h"
-#include "cpiohdr.h"
-#include "dstring.h"
-#include "extern.h"
-#include "defer.h"
-#include "rmt.h"
-
-static unsigned long read_for_checksum ();
-static void tape_clear_rest_of_block ();
-static void tape_pad_output ();
-static int last_link ();
-static int count_defered_links_to_dev_ino ();
-static void add_link_defer ();
-static void writeout_other_defers ();
-static void writeout_final_defers();
-static void writeout_defered_file ();
-static int check_rdev ();
-
-/* Write out header FILE_HDR, including the file name, to file
- descriptor OUT_DES. */
-
-void
-write_out_header (file_hdr, out_des)
- struct new_cpio_header *file_hdr;
- int out_des;
-{
- if (archive_format == arf_newascii || archive_format == arf_crcascii)
- {
- char ascii_header[112];
- char *magic_string;
-
- if (archive_format == arf_crcascii)
- magic_string = "070702";
- else
- magic_string = "070701";
- sprintf (ascii_header,
- "%6s%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx",
- magic_string,
- file_hdr->c_ino, file_hdr->c_mode, file_hdr->c_uid,
- file_hdr->c_gid, file_hdr->c_nlink, file_hdr->c_mtime,
- file_hdr->c_filesize, file_hdr->c_dev_maj, file_hdr->c_dev_min,
- file_hdr->c_rdev_maj, file_hdr->c_rdev_min, file_hdr->c_namesize,
- file_hdr->c_chksum);
- tape_buffered_write (ascii_header, out_des, 110L);
-
- /* Write file name to output. */
- tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize);
- tape_pad_output (out_des, file_hdr->c_namesize + 110);
- }
- else if (archive_format == arf_oldascii || archive_format == arf_hpoldascii)
- {
- char ascii_header[78];
-#ifndef __MSDOS__
- dev_t dev;
- dev_t rdev;
-
- if (archive_format == arf_oldascii)
- {
- dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
- rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
- }
- else
- {
- /* HP/UX cpio creates archives that look just like ordinary archives,
- but for devices it sets major = 0, minor = 1, and puts the
- actual major/minor number in the filesize field. */
- switch (file_hdr->c_mode & CP_IFMT)
- {
- case CP_IFCHR:
- case CP_IFBLK:
-#ifdef CP_IFSOCK
- case CP_IFSOCK:
-#endif
-#ifdef CP_IFIFO
- case CP_IFIFO:
-#endif
- file_hdr->c_filesize = makedev (file_hdr->c_rdev_maj,
- file_hdr->c_rdev_min);
- rdev = 1;
- break;
- default:
- dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
- rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
- break;
- }
- }
-#else
- int dev = 0, rdev = 0;
-#endif
-
- if ((file_hdr->c_ino >> 16) != 0)
- error (0, 0, "%s: truncating inode number", file_hdr->c_name);
-
- sprintf (ascii_header,
- "%06o%06o%06lo%06lo%06lo%06lo%06lo%06o%011lo%06lo%011lo",
- file_hdr->c_magic & 0xFFFF, dev & 0xFFFF,
- file_hdr->c_ino & 0xFFFF, file_hdr->c_mode & 0xFFFF,
- file_hdr->c_uid & 0xFFFF, file_hdr->c_gid & 0xFFFF,
- file_hdr->c_nlink & 0xFFFF, rdev & 0xFFFF,
- file_hdr->c_mtime, file_hdr->c_namesize & 0xFFFF,
- file_hdr->c_filesize);
- tape_buffered_write (ascii_header, out_des, 76L);
-
- /* Write file name to output. */
- tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize);
- }
- else if (archive_format == arf_tar || archive_format == arf_ustar)
- {
- write_out_tar_header (file_hdr, out_des);
- }
- else
- {
- struct old_cpio_header short_hdr;
-
- short_hdr.c_magic = 070707;
- short_hdr.c_dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
-
- if ((file_hdr->c_ino >> 16) != 0)
- error (0, 0, "%s: truncating inode number", file_hdr->c_name);
-
- short_hdr.c_ino = file_hdr->c_ino & 0xFFFF;
- short_hdr.c_mode = file_hdr->c_mode & 0xFFFF;
- short_hdr.c_uid = file_hdr->c_uid & 0xFFFF;
- short_hdr.c_gid = file_hdr->c_gid & 0xFFFF;
- short_hdr.c_nlink = file_hdr->c_nlink & 0xFFFF;
- if (archive_format != arf_hpbinary)
- short_hdr.c_rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
- else
- {
- switch (file_hdr->c_mode & CP_IFMT)
- {
- /* HP/UX cpio creates archives that look just like ordinary
- archives, but for devices it sets major = 0, minor = 1, and
- puts the actual major/minor number in the filesize field. */
- case CP_IFCHR:
- case CP_IFBLK:
-#ifdef CP_IFSOCK
- case CP_IFSOCK:
-#endif
-#ifdef CP_IFIFO
- case CP_IFIFO:
-#endif
- file_hdr->c_filesize = makedev (file_hdr->c_rdev_maj,
- file_hdr->c_rdev_min);
- short_hdr.c_rdev = makedev (0, 1);
- break;
- default:
- short_hdr.c_rdev = makedev (file_hdr->c_rdev_maj,
- file_hdr->c_rdev_min);
- break;
- }
- }
- short_hdr.c_mtimes[0] = file_hdr->c_mtime >> 16;
- short_hdr.c_mtimes[1] = file_hdr->c_mtime & 0xFFFF;
-
- short_hdr.c_namesize = file_hdr->c_namesize & 0xFFFF;
-
- short_hdr.c_filesizes[0] = file_hdr->c_filesize >> 16;
- short_hdr.c_filesizes[1] = file_hdr->c_filesize & 0xFFFF;
-
- /* Output the file header. */
- tape_buffered_write ((char *) &short_hdr, out_des, 26L);
-
- /* Write file name to output. */
- tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize);
-
- tape_pad_output (out_des, file_hdr->c_namesize + 26);
- }
-}
-
-/* Read a list of file names from the standard input
- and write a cpio collection on the standard output.
- The format of the header depends on the compatibility (-c) flag. */
-
-void
-process_copy_out ()
-{
- int res; /* Result of functions. */
- dynamic_string input_name; /* Name of file read from stdin. */
- struct utimbuf times; /* For resetting file times after copy. */
- struct stat file_stat; /* Stat record for file. */
- struct new_cpio_header file_hdr; /* Output header information. */
- int in_file_des; /* Source file descriptor. */
- int out_file_des; /* Output file descriptor. */
- char *p;
-
- /* Initialize the copy out. */
- ds_init (&input_name, 128);
- /* Initialize this in case it has members we don't know to set. */
- bzero (&times, sizeof (struct utimbuf));
- file_hdr.c_magic = 070707;
-
-#ifdef __MSDOS__
- setmode (archive_des, O_BINARY);
-#endif
- /* Check whether the output file might be a tape. */
- out_file_des = archive_des;
- if (_isrmt (out_file_des))
- {
- output_is_special = 1;
- output_is_seekable = 0;
- }
- else
- {
- if (fstat (out_file_des, &file_stat))
- error (1, errno, "standard output is closed");
- output_is_special =
-#ifdef S_ISBLK
- S_ISBLK (file_stat.st_mode) ||
-#endif
- S_ISCHR (file_stat.st_mode);
- output_is_seekable = S_ISREG (file_stat.st_mode);
- }
-
- if (append_flag)
- {
- process_copy_in ();
- prepare_append (out_file_des);
- }
-
- /* Copy files with names read from stdin. */
- while (ds_fgetstr (stdin, &input_name, name_end) != NULL)
- {
- /* Check for blank line. */
- if (input_name.ds_string[0] == 0)
- {
- error (0, 0, "blank line ignored");
- continue;
- }
-
- /* Process next file. */
- if ((*xstat) (input_name.ds_string, &file_stat) < 0)
- error (0, errno, "%s", input_name.ds_string);
- else
- {
- /* Set values in output header. */
- file_hdr.c_dev_maj = major (file_stat.st_dev);
- file_hdr.c_dev_min = minor (file_stat.st_dev);
- file_hdr.c_ino = file_stat.st_ino;
- /* For POSIX systems that don't define the S_IF macros,
- we can't assume that S_ISfoo means the standard Unix
- S_IFfoo bit(s) are set. So do it manually, with a
- different name. Bleah. */
- file_hdr.c_mode = (file_stat.st_mode & 07777);
- if (S_ISREG (file_stat.st_mode))
- file_hdr.c_mode |= CP_IFREG;
- else if (S_ISDIR (file_stat.st_mode))
- file_hdr.c_mode |= CP_IFDIR;
-#ifdef S_ISBLK
- else if (S_ISBLK (file_stat.st_mode))
- file_hdr.c_mode |= CP_IFBLK;
-#endif
-#ifdef S_ISCHR
- else if (S_ISCHR (file_stat.st_mode))
- file_hdr.c_mode |= CP_IFCHR;
-#endif
-#ifdef S_ISFIFO
- else if (S_ISFIFO (file_stat.st_mode))
- file_hdr.c_mode |= CP_IFIFO;
-#endif
-#ifdef S_ISLNK
- else if (S_ISLNK (file_stat.st_mode))
- file_hdr.c_mode |= CP_IFLNK;
-#endif
-#ifdef S_ISSOCK
- else if (S_ISSOCK (file_stat.st_mode))
- file_hdr.c_mode |= CP_IFSOCK;
-#endif
-#ifdef S_ISNWK
- else if (S_ISNWK (file_stat.st_mode))
- file_hdr.c_mode |= CP_IFNWK;
-#endif
- file_hdr.c_uid = file_stat.st_uid;
- file_hdr.c_gid = file_stat.st_gid;
- file_hdr.c_nlink = file_stat.st_nlink;
-
- /* The rdev is meaningless except for block and character
- special files (POSIX standard) and perhaps fifos and
- sockets. Clear it for other types of files so that
- check_rdev() doesn't reject files just because stat()
- put garbage in st_rdev and so that the output doesn't
- depend on the garbage. */
- switch (file_hdr.c_mode & CP_IFMT)
- {
- case CP_IFBLK:
- case CP_IFCHR:
-#ifdef CP_IFIFO
- case CP_IFIFO:
-#endif
-#ifdef CP_IFSOCK
- case CP_IFSOCK:
-#endif
- file_hdr.c_rdev_maj = major (file_stat.st_rdev);
- file_hdr.c_rdev_min = minor (file_stat.st_rdev);
- break;
- default:
- file_hdr.c_rdev_maj = 0;
- file_hdr.c_rdev_min = 0;
- break;
- }
-
- file_hdr.c_mtime = file_stat.st_mtime;
- file_hdr.c_filesize = file_stat.st_size;
- file_hdr.c_chksum = 0;
- file_hdr.c_tar_linkname = NULL;
-
- /* Strip leading `./' from the filename. */
- p = input_name.ds_string;
- while (*p == '.' && *(p + 1) == '/')
- {
- ++p;
- while (*p == '/')
- ++p;
- }
-#ifndef HPUX_CDF
- file_hdr.c_name = p;
- file_hdr.c_namesize = strlen (p) + 1;
-#else
- if ( (archive_format != arf_tar) && (archive_format != arf_ustar) )
- {
- /* We mark CDF's in cpio files by adding a 2nd `/' after the
- "hidden" directory name. We need to do this so we can
- properly recreate the directory as hidden (in case the
- files of a directory go into the archive before the
- directory itself (e.g from "find ... -depth ... | cpio")). */
- file_hdr.c_name = add_cdf_double_slashes (p);
- file_hdr.c_namesize = strlen (file_hdr.c_name) + 1;
- }
- else
- {
- /* We don't mark CDF's in tar files. We assume the "hidden"
- directory will always go into the archive before any of
- its files. */
- file_hdr.c_name = p;
- file_hdr.c_namesize = strlen (p) + 1;
- }
-#endif
- if ((archive_format == arf_tar || archive_format == arf_ustar)
- && is_tar_filename_too_long (file_hdr.c_name))
- {
- error (0, 0, "%s: file name too long", file_hdr.c_name);
- continue;
- }
-
- switch (check_rdev (&file_hdr))
- {
- case 1:
- error (0, 0, "%s not dumped: major number would be truncated",
- file_hdr.c_name);
- continue;
- case 2:
- error (0, 0, "%s not dumped: minor number would be truncated",
- file_hdr.c_name);
- continue;
- case 4:
- error (0, 0, "%s not dumped: device number would be truncated",
- file_hdr.c_name);
- continue;
- }
-
-
- /* Copy the named file to the output. */
- switch (file_hdr.c_mode & CP_IFMT)
- {
- case CP_IFREG:
-#ifndef __MSDOS__
- if (archive_format == arf_tar || archive_format == arf_ustar)
- {
- char *otherfile;
- if ((otherfile = find_inode_file (file_hdr.c_ino,
- file_hdr.c_dev_maj,
- file_hdr.c_dev_min)))
- {
- file_hdr.c_tar_linkname = otherfile;
- write_out_header (&file_hdr, out_file_des);
- break;
- }
- }
- if ( (archive_format == arf_newascii || archive_format == arf_crcascii)
- && (file_hdr.c_nlink > 1) )
- {
- if (last_link (&file_hdr) )
- {
- writeout_other_defers (&file_hdr, out_file_des);
- }
- else
- {
- add_link_defer (&file_hdr);
- break;
- }
- }
-#endif
- in_file_des = open (input_name.ds_string,
- O_RDONLY | O_BINARY, 0);
- if (in_file_des < 0)
- {
- error (0, errno, "%s", input_name.ds_string);
- continue;
- }
-
- if (archive_format == arf_crcascii)
- file_hdr.c_chksum = read_for_checksum (in_file_des,
- file_hdr.c_filesize,
- input_name.ds_string);
-
- write_out_header (&file_hdr, out_file_des);
- copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, input_name.ds_string);
-
-#ifndef __MSDOS__
- if (archive_format == arf_tar || archive_format == arf_ustar)
- add_inode (file_hdr.c_ino, file_hdr.c_name, file_hdr.c_dev_maj,
- file_hdr.c_dev_min);
-#endif
-
- tape_pad_output (out_file_des, file_hdr.c_filesize);
-
- if (close (in_file_des) < 0)
- error (0, errno, "%s", input_name.ds_string);
- if (reset_time_flag)
- {
- times.actime = file_stat.st_atime;
- times.modtime = file_stat.st_mtime;
- if (utime (file_hdr.c_name, &times) < 0)
- error (0, errno, "%s", file_hdr.c_name);
- }
- break;
-
- case CP_IFDIR:
- file_hdr.c_filesize = 0;
- write_out_header (&file_hdr, out_file_des);
- break;
-
-#ifndef __MSDOS__
- case CP_IFCHR:
- case CP_IFBLK:
-#ifdef CP_IFSOCK
- case CP_IFSOCK:
-#endif
-#ifdef CP_IFIFO
- case CP_IFIFO:
-#endif
- if (archive_format == arf_tar)
- {
- error (0, 0, "%s not dumped: not a regular file",
- file_hdr.c_name);
- continue;
- }
- else if (archive_format == arf_ustar)
- {
- char *otherfile;
- if ((otherfile = find_inode_file (file_hdr.c_ino,
- file_hdr.c_dev_maj,
- file_hdr.c_dev_min)))
- {
- /* This file is linked to another file already in the
- archive, so write it out as a hard link. */
- file_hdr.c_mode = (file_stat.st_mode & 07777);
- file_hdr.c_mode |= CP_IFREG;
- file_hdr.c_tar_linkname = otherfile;
- write_out_header (&file_hdr, out_file_des);
- break;
- }
- add_inode (file_hdr.c_ino, file_hdr.c_name,
- file_hdr.c_dev_maj, file_hdr.c_dev_min);
- }
- file_hdr.c_filesize = 0;
- write_out_header (&file_hdr, out_file_des);
- break;
-#endif
-
-#ifdef CP_IFLNK
- case CP_IFLNK:
- {
- char *link_name = (char *) xmalloc (file_stat.st_size + 1);
- int link_size;
-
- link_size = readlink (input_name.ds_string, link_name,
- file_stat.st_size);
- if (link_size < 0)
- {
- error (0, errno, "%s", input_name.ds_string);
- free (link_name);
- continue;
- }
- file_hdr.c_filesize = link_size;
- if (archive_format == arf_tar || archive_format == arf_ustar)
- {
- if (link_size + 1 > 100)
- {
- error (0, 0, "%s: symbolic link too long",
- file_hdr.c_name);
- }
- else
- {
- link_name[link_size] = '\0';
- file_hdr.c_tar_linkname = link_name;
- write_out_header (&file_hdr, out_file_des);
- }
- }
- else
- {
- write_out_header (&file_hdr, out_file_des);
- tape_buffered_write (link_name, out_file_des, link_size);
- tape_pad_output (out_file_des, link_size);
- }
- free (link_name);
- }
- break;
-#endif
-
- default:
- error (0, 0, "%s: unknown file type", input_name.ds_string);
- }
-
- if (verbose_flag)
- fprintf (stderr, "%s\n", input_name.ds_string);
- if (dot_flag)
- fputc ('.', stderr);
- }
- }
-
- writeout_final_defers(out_file_des);
- /* The collection is complete; append the trailer. */
- file_hdr.c_ino = 0;
- file_hdr.c_mode = 0;
- file_hdr.c_uid = 0;
- file_hdr.c_gid = 0;
- file_hdr.c_nlink = 1; /* Must be 1 for crc format. */
- file_hdr.c_dev_maj = 0;
- file_hdr.c_dev_min = 0;
- file_hdr.c_rdev_maj = 0;
- file_hdr.c_rdev_min = 0;
- file_hdr.c_mtime = 0;
- file_hdr.c_chksum = 0;
-
- file_hdr.c_filesize = 0;
- file_hdr.c_namesize = 11;
- file_hdr.c_name = "TRAILER!!!";
- if (archive_format != arf_tar && archive_format != arf_ustar)
- write_out_header (&file_hdr, out_file_des);
- else
- {
- tape_buffered_write (zeros_512, out_file_des, 512);
- tape_buffered_write (zeros_512, out_file_des, 512);
- }
-
- /* Fill up the output block. */
- tape_clear_rest_of_block (out_file_des);
- tape_empty_output_buffer (out_file_des);
- if (dot_flag)
- fputc ('\n', stderr);
- if (!quiet_flag)
- {
- res = (output_bytes + io_block_size - 1) / io_block_size;
- if (res == 1)
- fprintf (stderr, "1 block\n");
- else
- fprintf (stderr, "%d blocks\n", res);
- }
-}
-
-/* Read FILE_SIZE bytes of FILE_NAME from IN_FILE_DES and
- compute and return a checksum for them. */
-
-static unsigned long
-read_for_checksum (in_file_des, file_size, file_name)
- int in_file_des;
- int file_size;
- char *file_name;
-{
- unsigned long crc;
- char buf[BUFSIZ];
- int bytes_left;
- int bytes_read;
- int i;
-
- crc = 0;
-
- for (bytes_left = file_size; bytes_left > 0; bytes_left -= bytes_read)
- {
- bytes_read = read (in_file_des, buf, BUFSIZ);
- if (bytes_read < 0)
- error (1, errno, "cannot read checksum for %s", file_name);
- if (bytes_read == 0)
- break;
- for (i = 0; i < bytes_read; ++i)
- crc += buf[i] & 0xff;
- }
- if (lseek (in_file_des, 0L, SEEK_SET))
- error (1, errno, "cannot read checksum for %s", file_name);
-
- return crc;
-}
-
-/* Write out NULs to fill out the rest of the current block on
- OUT_FILE_DES. */
-
-static void
-tape_clear_rest_of_block (out_file_des)
- int out_file_des;
-{
- while (output_size < io_block_size)
- {
- if ((io_block_size - output_size) > 512)
- tape_buffered_write (zeros_512, out_file_des, 512);
- else
- tape_buffered_write (zeros_512, out_file_des, io_block_size - output_size);
- }
-}
-
-/* Write NULs on OUT_FILE_DES to move from OFFSET (the current location)
- to the end of the header. */
-
-static void
-tape_pad_output (out_file_des, offset)
- int out_file_des;
- int offset;
-{
- int pad;
-
- if (archive_format == arf_newascii || archive_format == arf_crcascii)
- pad = (4 - (offset % 4)) % 4;
- else if (archive_format == arf_tar || archive_format == arf_ustar)
- pad = (512 - (offset % 512)) % 512;
- else if (archive_format != arf_oldascii && archive_format != arf_hpoldascii)
- pad = (2 - (offset % 2)) % 2;
- else
- pad = 0;
-
- if (pad != 0)
- tape_buffered_write (zeros_512, out_file_des, pad);
-}
-
-
-/* When creating newc and crc archives if a file has multiple (hard)
- links, we don't put any of them into the archive until we have seen
- all of them (or until we get to the end of the list of files that
- are going into the archive and know that we have seen all of the links
- to the file that we will see). We keep these "defered" files on
- this list. */
-
-struct deferment *deferouts = NULL;
-
-
-/* Is this file_hdr the last (hard) link to a file? I.e., have
- we already seen and defered all of the other links? */
-
-static int
-last_link (file_hdr)
- struct new_cpio_header *file_hdr;
-{
- int other_files_sofar;
-
- other_files_sofar = count_defered_links_to_dev_ino (file_hdr);
- if (file_hdr->c_nlink == (other_files_sofar + 1) )
- {
- return 1;
- }
- return 0;
-}
-
-/* Count the number of other (hard) links to this file that have
- already been defered. */
-
-static int
-count_defered_links_to_dev_ino (file_hdr)
- struct new_cpio_header *file_hdr;
-{
- struct deferment *d;
- int ino;
- int maj;
- int min;
- int count;
- ino = file_hdr->c_ino;
- maj = file_hdr->c_dev_maj;
- min = file_hdr->c_dev_min;
- count = 0;
- for (d = deferouts; d != NULL; d = d->next)
- {
- if ( (d->header.c_ino == ino) && (d->header.c_dev_maj == maj)
- && (d->header.c_dev_min == min) )
- ++count;
- }
- return count;
-}
-
-/* Add the file header for a link that is being defered to the deferouts
- list. */
-
-static void
-add_link_defer (file_hdr)
- struct new_cpio_header *file_hdr;
-{
- struct deferment *d;
- d = create_deferment (file_hdr);
- d->next = deferouts;
- deferouts = d;
-}
-
-/* We are about to put a file into a newc or crc archive that is
- multiply linked. We have already seen and defered all of the
- other links to the file but haven't written them into the archive.
- Write the other links into the archive, and remove them from the
- deferouts list. */
-
-static void
-writeout_other_defers (file_hdr, out_des)
- struct new_cpio_header *file_hdr;
- int out_des;
-{
- struct deferment *d;
- struct deferment *d_prev;
- int ino;
- int maj;
- int min;
- ino = file_hdr->c_ino;
- maj = file_hdr->c_dev_maj;
- min = file_hdr->c_dev_min;
- d_prev = NULL;
- d = deferouts;
- while (d != NULL)
- {
- if ( (d->header.c_ino == ino) && (d->header.c_dev_maj == maj)
- && (d->header.c_dev_min == min) )
- {
- struct deferment *d_free;
- d->header.c_filesize = 0;
- write_out_header (&d->header, out_des);
- if (d_prev != NULL)
- d_prev->next = d->next;
- else
- deferouts = d->next;
- d_free = d;
- d = d->next;
- free_deferment (d_free);
- }
- else
- {
- d_prev = d;
- d = d->next;
- }
- }
- return;
-}
-/* When writing newc and crc format archives we defer multiply linked
- files until we have seen all of the links to the file. If a file
- has links to it that aren't going into the archive, then we will
- never see the "last" link to the file, so at the end we just write
- all of the leftover defered files into the archive. */
-
-static void
-writeout_final_defers(out_des)
- int out_des;
-{
- struct deferment *d;
- int other_count;
- while (deferouts != NULL)
- {
- d = deferouts;
- other_count = count_defered_links_to_dev_ino (&d->header);
- if (other_count == 1)
- {
- writeout_defered_file (&d->header, out_des);
- }
- else
- {
- struct new_cpio_header file_hdr;
- file_hdr = d->header;
- file_hdr.c_filesize = 0;
- write_out_header (&file_hdr, out_des);
- }
- deferouts = deferouts->next;
- }
-}
-
-/* Write a file into the archive. This code is the same as
- the code in process_copy_out(), but we need it here too
- for writeout_final_defers() to call. */
-
-static void
-writeout_defered_file (header, out_file_des)
- struct new_cpio_header *header;
- int out_file_des;
-{
- int in_file_des;
- struct new_cpio_header file_hdr;
- struct utimbuf times; /* For setting file times. */
- /* Initialize this in case it has members we don't know to set. */
- bzero (&times, sizeof (struct utimbuf));
-
- file_hdr = *header;
-
-
- in_file_des = open (header->c_name,
- O_RDONLY | O_BINARY, 0);
- if (in_file_des < 0)
- {
- error (0, errno, "%s", header->c_name);
- return;
- }
-
- if (archive_format == arf_crcascii)
- file_hdr.c_chksum = read_for_checksum (in_file_des,
- file_hdr.c_filesize,
- header->c_name);
-
- write_out_header (&file_hdr, out_file_des);
- copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, header->c_name);
-
-#ifndef __MSDOS__
- if (archive_format == arf_tar || archive_format == arf_ustar)
- add_inode (file_hdr.c_ino, file_hdr.c_name, file_hdr.c_dev_maj,
- file_hdr.c_dev_min);
-#endif
-
- tape_pad_output (out_file_des, file_hdr.c_filesize);
-
- if (close (in_file_des) < 0)
- error (0, errno, "%s", header->c_name);
- if (reset_time_flag)
- {
- times.actime = file_hdr.c_mtime;
- times.modtime = file_hdr.c_mtime;
- if (utime (file_hdr.c_name, &times) < 0)
- error (0, errno, "%s", file_hdr.c_name);
- }
- return;
-}
-
-
-static int
-check_rdev (file_hdr)
- struct new_cpio_header *file_hdr;
-{
- if (archive_format == arf_newascii || archive_format == arf_crcascii)
- {
- if ((file_hdr->c_rdev_maj & 0xFFFFFFFF) != file_hdr->c_rdev_maj)
- return 1;
- if ((file_hdr->c_rdev_min & 0xFFFFFFFF) != file_hdr->c_rdev_min)
- return 2;
- }
- else if (archive_format == arf_oldascii || archive_format == arf_hpoldascii)
- {
-#ifndef __MSDOS__
- dev_t rdev;
-
- rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
- if (archive_format == arf_oldascii)
- {
- if ((rdev & 0xFFFF) != rdev)
- return 4;
- }
- else
- {
- switch (file_hdr->c_mode & CP_IFMT)
- {
- case CP_IFCHR:
- case CP_IFBLK:
-#ifdef CP_IFSOCK
- case CP_IFSOCK:
-#endif
-#ifdef CP_IFIFO
- case CP_IFIFO:
-#endif
- /* We could handle one more bit if longs are >= 33 bits. */
- if ((rdev & 037777777777) != rdev)
- return 4;
- break;
- default:
- if ((rdev & 0xFFFF) != rdev)
- return 4;
- break;
- }
- }
-#endif
- }
- else if (archive_format == arf_tar || archive_format == arf_ustar)
- {
- /* The major and minor formats are limited to 7 octal digits in ustar
- format, and to_oct () adds a gratuitous trailing blank to further
- limit the format to 6 octal digits. */
- if ((file_hdr->c_rdev_maj & 0777777) != file_hdr->c_rdev_maj)
- return 1;
- if ((file_hdr->c_rdev_min & 0777777) != file_hdr->c_rdev_min)
- return 2;
- }
- else
- {
-#ifndef __MSDOS__
- dev_t rdev;
-
- rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
- if (archive_format != arf_hpbinary)
- {
- if ((rdev & 0xFFFF) != rdev)
- return 4;
- }
- else
- {
- switch (file_hdr->c_mode & CP_IFMT)
- {
- case CP_IFCHR:
- case CP_IFBLK:
-#ifdef CP_IFSOCK
- case CP_IFSOCK:
-#endif
-#ifdef CP_IFIFO
- case CP_IFIFO:
-#endif
- if ((rdev & 0xFFFFFFFF) != rdev)
- return 4;
- file_hdr->c_filesize = rdev;
- rdev = makedev (0, 1);
- break;
- default:
- if ((rdev & 0xFFFF) != rdev)
- return 4;
- break;
- }
- }
-#endif
- }
- return 0;
-}
diff --git a/contrib/cpio/cpio.1 b/contrib/cpio/cpio.1
deleted file mode 100644
index 2e24ee3600e4..000000000000
--- a/contrib/cpio/cpio.1
+++ /dev/null
@@ -1,328 +0,0 @@
-.TH CPIO 1L \" -*- nroff -*-
-.SH NAME
-cpio \- copy files to and from archives
-.SH SYNOPSIS
-.B cpio
-{\-o|\-\-create} [\-0acvABLV] [\-C bytes] [\-H format] [\-M message]
-[\-O [[user@]host:]archive] [\-F [[user@]host:]archive]
-[\-\-file=[[user@]host:]archive] [\-\-format=format] [\-\-message=message]
-[\-\-null] [\-\-reset-access-time] [\-\-verbose] [\-\-dot] [\-\-append]
-[\-\-block-size=blocks] [\-\-dereference] [\-\-io-size=bytes] [\-\-quiet]
-[\-\-force\-local] [\-\-help] [\-\-version] < name-list [> archive]
-
-.B cpio
-{\-i|\-\-extract} [\-bcdfmnrtsuvBSV] [\-C bytes] [\-E file] [\-H format]
-[\-M message] [\-R [user][:.][group]] [\-I [[user@]host:]archive]
-[\-F [[user@]host:]archive] [\-\-file=[[user@]host:]archive]
-[\-\-make-directories] [\-\-nonmatching] [\-\-preserve-modification-time]
-[\-\-numeric-uid-gid] [\-\-rename] [\-\-list] [\-\-swap-bytes] [\-\-swap] [\-\-dot]
-[\-\-unconditional] [\-\-verbose] [\-\-block-size=blocks] [\-\-swap-halfwords]
-[\-\-io-size=bytes] [\-\-pattern-file=file] [\-\-format=format]
-[\-\-owner=[user][:.][group]] [\-\-no-preserve-owner] [\-\-message=message]
-[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse] [\-\-only\-verify\-crc]
-[\-\-quiet] [\-\-help] [\-\-version] [pattern...] [< archive]
-
-.B cpio
-{\-p|\-\-pass-through} [\-0adlmuvLV] [\-R [user][:.][group]]
-[\-\-null] [\-\-reset-access-time] [\-\-make-directories] [\-\-link] [\-\-quiet]
-[\-\-preserve-modification-time] [\-\-unconditional] [\-\-verbose] [\-\-dot]
-[\-\-dereference] [\-\-owner=[user][:.][group]] [\-\-no-preserve-owner]
-[\-\-sparse] [\-\-help] [\-\-version] destination-directory < name-list
-.SH DESCRIPTION
-This manual page
-documents the GNU version of
-.BR cpio .
-.B cpio
-copies files into or out of a cpio or tar archive, which is a file that
-contains other files plus information about them, such as their
-file name, owner, timestamps, and access permissions. The archive can
-be another file on the disk, a magnetic tape, or a pipe.
-.B cpio
-has three operating modes.
-.PP
-In copy-out mode,
-.B cpio
-copies files into an archive. It reads a list of filenames, one per
-line, on the standard input, and writes the archive onto the standard
-output. A typical way to generate the list of filenames is with the
-.B find
-command; you should give
-.B find
-the \-d option to minimize problems with permissions on
-directories that are unwritable or not searchable.
-.PP
-In copy-in mode,
-.B cpio
-copies files out of an archive or lists the archive contents. It
-reads the archive from the standard input. Any non-option command
-line arguments are shell globbing patterns; only files in the archive
-whose names match one or more of those patterns are copied from the
-archive. Unlike in the shell, an initial `.' in a filename does
-match a wildcard at the start of a pattern, and a `/' in a filename
-can match wildcards. If no patterns are given, all files are
-extracted.
-.PP
-In copy-pass mode,
-.B cpio
-copies files from one directory tree to another, combining the
-copy-out and copy-in steps without actually using an archive.
-It reads the list of files to copy from the standard input; the
-directory into which it will copy them is given as a non-option
-argument.
-.PP
-.B cpio
-supports the following archive formats: binary, old ASCII, new
-ASCII, crc, HPUX binary, HPUX old ASCII, old tar, and POSIX.1 tar.
-The binary format
-is obsolete because it encodes information about the files in a way
-that is not portable between different machine architectures.
-The old ASCII format is portable between different machine architectures,
-but should not be used on file systems with more than 65536 i-nodes.
-The new ASCII format is portable between different machine architectures
-and can be used on any size file system, but is not supported by all
-versions of
-.BR cpio ;
-currently, it is only supported by GNU and Unix System V R4.
-The crc format is
-like the new ASCII format, but also contains a checksum for each file
-which
-.B cpio
-calculates when creating an archive
-and verifies when the file is extracted from the archive.
-The HPUX formats are provided for compatibility with HPUX's cpio which
-stores device files differently.
-.PP
-The tar format is provided for compatibility with
-the
-.B tar
-program. It can not be used to archive files with names
-longer than 100 characters, and can not be used to archive "special"
-(block or character devices) files.
-The POSIX.1 tar format can not be used to archive files with names longer
-than 255 characters (less unless they have a "/" in just the right place).
-.PP
-By default,
-.B cpio
-creates binary format archives, for compatibility with
-older
-.B cpio
-programs.
-When extracting from archives,
-.B cpio
-automatically recognizes which kind of archive it is reading and can
-read archives created on machines with a different byte-order.
-.PP
-Some of the options to
-.B cpio
-apply only to certain operating modes; see the SYNOPSIS section for a
-list of which options are allowed in which modes.
-.SS OPTIONS
-.TP
-.I "\-0, \-\-null"
-In copy-out and copy-pass modes, read a list of filenames terminated
-by a null character instead of a newline, so that files whose names
-contain newlines can be archived. GNU
-.B find
-is one way to produce a list of null-terminated filenames.
-.TP
-.I "\-a, \-\-reset-access-time"
-Reset the access times of files after reading them, so that it does
-not look like they have just been read.
-.TP
-.I "\-A, \-\-append"
-Append to an existing archive. Only works in copy-out mode. The
-archive must be a disk file specified with the
-.I \-O
-or
-.I "\-F (\-\-file)"
-option.
-.TP
-.I "\-b, \-\-swap"
-In copy-in mode, swap both halfwords of words and bytes of halfwords
-in the data. Equivalent to
-.IR "\-sS" .
-Use this option to convert 32-bit integers between big-endian and
-little-endian machines.
-.TP
-.I "\-B"
-Set the I/O block size to 5120 bytes. Initially the block size is 512
-bytes.
-.TP
-.I "\-\-block-size=BLOCK-SIZE"
-Set the I/O block size to BLOCK-SIZE * 512 bytes.
-.TP
-.I "\-c"
-Use the old portable (ASCII) archive format.
-.TP
-.I "\-C IO-SIZE, \-\-io-size=IO-SIZE"
-Set the I/O block size to IO-SIZE bytes.
-.TP
-.I "\-d, \-\-make-directories"
-Create leading directories where needed.
-.TP
-.I "\-E FILE, \-\-pattern-file=FILE"
-In copy-in mode, read additional patterns specifying filenames to
-extract or list from FILE. The lines of FILE are treated as if they
-had been non-option arguments to
-.BR cpio .
-.TP
-.I "\-f, \-\-nonmatching"
-Only copy files that do not match any of the given patterns.
-.TP
-.I "\-F, \-\-file=archive"
-Archive filename to use instead of standard input or output. To use a
-tape drive on another machine as the archive, use a filename that
-starts with `HOSTNAME:'. The hostname can be preceded by a
-username and an `@' to access the remote tape drive as that user, if
-you have permission to do so (typically an entry in that user's
-`~/.rhosts' file).
-.TP
-.I "\-\-force-local"
-With
-.IR \-F ,
-.IR \-I ,
-or
-.IR \-O ,
-take the archive file name to be a local file even if it contains a
-colon, which would ordinarily indicate a remote host name.
-.TP
-.I "\-H FORMAT, \-\-format=FORMAT"
-Use archive format FORMAT. The valid formats are listed below;
-the same names are also recognized in all-caps. The default in
-copy-in mode is to automatically detect the archive format, and in
-copy-out mode is "bin".
-.RS
-.IP bin
-The obsolete binary format.
-.IP odc
-The old (POSIX.1) portable format.
-.IP newc
-The new (SVR4) portable format, which supports file systems having
-more than 65536 i-nodes.
-.IP crc
-The new (SVR4) portable format with a checksum added.
-.IP tar
-The old tar format.
-.IP ustar
-The POSIX.1 tar format. Also recognizes GNU
-.B tar
-archives, which are similar but not identical.
-.IP hpbin
-The obsolete binary format used by HPUX's cpio (which stores device files
-differently).
-.IP hpodc
-The portable format used by HPUX's cpio (which stores device files differently).
-.RE
-.TP
-.I "\-i, \-\-extract"
-Run in copy-in mode.
-.TP
-.I "\-I archive"
-Archive filename to use instead of standard input. To use a
-tape drive on another machine as the archive, use a filename that
-starts with `HOSTNAME:'. The hostname can be preceded by a
-username and an `@' to access the remote tape drive as that user, if
-you have permission to do so (typically an entry in that user's
-`~/.rhosts' file).
-.TP
-.I \-k
-Ignored; for compatibility with other versions of
-.BR cpio .
-.TP
-.I "\-l, \-\-link"
-Link files instead of copying them, when possible (usable only with the
-.I \-p
-option).
-.TP
-.I "\-L, \-\-dereference"
-Dereference symbolic links (copy the files that they point to instead
-of copying the links).
-.TP
-.I "\-m, \-\-preserve-modification-time"
-Retain previous file modification times when creating files.
-.TP
-.I "\-M MESSAGE, \-\-message=MESSAGE"
-Print MESSAGE when the end of a volume of the backup media (such as a
-tape or a floppy disk) is reached, to prompt the user to insert a new
-volume. If MESSAGE contains the string "%d", it is replaced by the
-current volume number (starting at 1).
-.TP
-.I "\-n, \-\-numeric-uid-gid"
-In the verbose table of contents listing, show numeric UID and GID
-instead of translating them into names.
-.TP
-.I " \-\-no-absolute-filenames"
-In copy-in mode, create all files relative to the current directory,
-even if they have an absolute file name in the archive.
-.TP
-.I " \-\-no-preserve-owner"
-In copy-in mode and copy-pass mode, do not change the ownership of the
-files; leave them owned by the user extracting them. This is the
-default for non-root users, so that users on System V don't
-inadvertantly give away files.
-.TP
-.I "\-o, \-\-create"
-Run in copy-out mode.
-.TP
-.I "\-O archive"
-Archive filename to use instead of standard output. To use a tape
-drive on another machine as the archive, use a filename that starts
-with `HOSTNAME:'. The hostname can be preceded by a username and an
-`@' to access the remote tape drive as that user, if you have
-permission to do so (typically an entry in that user's `~/.rhosts'
-file).
-.TP
-.I " \-\-only-verify-crc"
-When reading a CRC format archive in copy-in mode, only verify the
-CRC's of each file in the archive, don't actually extract the files.
-.TP
-.I "\-p, \-\-pass-through"
-Run in copy-pass mode.
-.TP
-.I "\-\-quiet"
-Do not print the number of blocks copied.
-.TP
-.I "\-r, \-\-rename"
-Interactively rename files.
-.TP
-.I "\-R [user][:.][group], \-\-owner [user][:.][group]"
-In copy-out and copy-pass modes, set the ownership of all files created
-to the specified user and/or group. Either the user or the group, or
-both, must be present. If the group is omitted but the ":" or "."
-separator is given, use the given user's login group. Only the
-super-user can change files' ownership.
-.TP
-.I "\-\-sparse"
-In copy-out and copy-pass modes, write files with large blocks of zeros
-as sparse files.
-.TP
-.I "\-s, \-\-swap-bytes"
-In copy-in mode, swap the bytes of each halfword (pair of bytes) in the
-files.
-.TP
-.I "\-S, \-\-swap-halfwords"
-In copy-in mode, swap the halfwords of each word (4 bytes) in the
-files.
-.TP
-.I "\-t, \-\-list"
-Print a table of contents of the input.
-.TP
-.I "\-u, \-\-unconditional"
-Replace all files, without asking whether to replace existing newer
-files with older files.
-.TP
-.I "\-v, \-\-verbose"
-List the files processed, or with
-.IR \-t ,
-give an `ls \-l' style table of contents listing. In a verbose table
-of contents of a ustar archive, user and group names in the archive
-that do not exist on the local system are replaced by the names that
-correspond locally to the numeric UID and GID stored in the archive.
-.TP
-.I "\-V \-\-dot"
-Print a "." for each file processed.
-.TP
-.I "\-\-version"
-Print the
-.B cpio
-program version number and exit.
diff --git a/contrib/cpio/cpio.h b/contrib/cpio/cpio.h
deleted file mode 100644
index 537da72120f5..000000000000
--- a/contrib/cpio/cpio.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Extended cpio format from POSIX.1.
- Copyright (C) 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef _CPIO_H
-
-#define _CPIO_H 1
-
-/* A cpio archive consists of a sequence of files.
- Each file has a 76 byte header,
- a variable length, NUL terminated filename,
- and variable length file data.
- A header for a filename "TRAILER!!!" indicates the end of the archive. */
-
-/* All the fields in the header are ISO 646 (approximately ASCII) strings
- of octal numbers, left padded, not NUL terminated.
-
- Field Name Length in Bytes Notes
- c_magic 6 must be "070707"
- c_dev 6
- c_ino 6
- c_mode 6 see below for value
- c_uid 6
- c_gid 6
- c_nlink 6
- c_rdev 6 only valid for chr and blk special files
- c_mtime 11
- c_namesize 6 count includes terminating NUL in pathname
- c_filesize 11 must be 0 for FIFOs and directories */
-
-/* Values for c_mode, OR'd together: */
-
-#define C_IRUSR 000400
-#define C_IWUSR 000200
-#define C_IXUSR 000100
-#define C_IRGRP 000040
-#define C_IWGRP 000020
-#define C_IXGRP 000010
-#define C_IROTH 000004
-#define C_IWOTH 000002
-#define C_IXOTH 000001
-
-#define C_ISUID 004000
-#define C_ISGID 002000
-#define C_ISVTX 001000
-
-#define C_ISBLK 060000
-#define C_ISCHR 020000
-#define C_ISDIR 040000
-#define C_ISFIFO 010000
-#define C_ISSOCK 0140000
-#define C_ISLNK 0120000
-#define C_ISCTG 0110000
-#define C_ISREG 0100000
-
-#endif /* cpio.h */
diff --git a/contrib/cpio/cpio.texi b/contrib/cpio/cpio.texi
deleted file mode 100644
index 6b0fd45c519f..000000000000
--- a/contrib/cpio/cpio.texi
+++ /dev/null
@@ -1,558 +0,0 @@
-\input texinfo @c -*-texinfo-*-
-@c %**start of header
-@setfilename cpio.info
-@settitle cpio
-@setchapternewpage off
-@set VERSION GNU cpio 2.4
-@set RELEASEDATE November 1995
-@c %**end of header
-
-@ifinfo
-@format
-START-INFO-DIR-ENTRY
-* cpio: (cpio). Making tape (or disk) archives.
-END-INFO-DIR-ENTRY
-@end format
-@end ifinfo
-
-@ifinfo
-This file documents @value{VERSION}.
-
-Copyright (C) 1995 Free Software Foundation, Inc.
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-@ignore
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-
-
-@end ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the Foundation.
-@end ifinfo
-
-
-@titlepage
-@title GNU CPIO
-@subtitle @value{VERSION} @value{RELEASEDATE}
-@author by Robert Carleton
-@c copyright page
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 1995 Free Software Foundation, Inc.
-@sp 2
-This is the first edition of the GNU cpio documentation,@*
-and is consistent with @value{VERSION}.@*
-@sp 2
-Published by the Free Software Foundation @*
-59 Temple Place - Suite 330, @*
-Boston, MA 02111-1307, USA @*
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation
-approved by the Free Software Foundation.
-@end titlepage
-
-@ifinfo
-@node Top, Introduction, (dir), (dir)
-@comment node-name, next, previous, up
-@top
-
-GNU cpio is a tool for creating and extracting archives, or copying
-files from one place to another. It handles a number of cpio formats as
-well as reading and writing tar files. This is the first edition of the
-GNU cpio documentation and is consistant with @value{VERSION}.
-
-@menu
-* Introduction::
-* Tutorial:: Getting started.
-* Invoking `cpio':: How to invoke `cpio'.
-* Media:: Using tapes and other archive media.
-* Concept Index:: Concept index.
-
- --- The Detailed Node Listing ---
-
-Invoking cpio
-
-* Copy-out mode::
-* Copy-in mode::
-* Copy-pass mode::
-* Options::
-@end menu
-
-@end ifinfo
-
-@node Introduction, Tutorial, Top, Top
-@comment node-name, next, previous, up
-@chapter Introduction
-
-GNU cpio copies files into or out of a cpio or tar archive, The archive
-can be another file on the disk, a magnetic tape, or a pipe.
-
-GNU cpio supports the following archive formats: binary, old ASCII, new
-ASCII, crc, HPUX binary, HPUX old ASCII, old tar, and POSIX.1 tar. The
-tar format is provided for compatability with the tar program. By
-default, cpio creates binary format archives, for compatibility with
-older cpio programs. When extracting from archives, cpio automatically
-recognizes which kind of archive it is reading and can read archives
-created on machines with a different byte-order.
-
-@node Tutorial, Invoking `cpio', Introduction, Top
-@comment node-name, next, previous, up
-@chapter Tutorial
-@cindex creating a cpio archive
-@cindex extracting a cpio archive
-@cindex copying directory structures
-@cindex passing directory structures
-
-
-GNU cpio performs three primary functions. Copying files to an
-archive, Extracting files from an archive, and passing files to another
-directory tree. An archive can be a file on disk, one or more floppy
-disks, or one or more tapes.
-
-When creating an archive, cpio takes the list of files to be processed
-from the standard input, and then sends the archive to the standard
-output, or to the device defined by the @samp{-F} option.
-@xref{Copy-out mode}. Usually find or ls is used to provide this list
-to the standard input. In the following example you can see the
-possibilities for archiving the contents of a single directory.
-
-
-@example
-@cartouche
-% ls | cpio -ov > directory.cpio
-@end cartouche
-@end example
-
-The @samp{-o} option creates the archive, and the @samp{-v} option
-prints the names of the files archived as they are added. Notice that
-the options can be put together after a single @samp{-} or can be placed
-separately on the command line. The @samp{>} redirects the cpio output
-to the file @samp{directory.cpio}.
-
-
-If you wanted to archive an entire directory tree, the find command can
-provide the file list to cpio:
-
-
-@example
-@cartouche
-% find . -print -depth | cpio -ov > tree.cpio
-@end cartouche
-@end example
-
-
-This will take all the files in the current directory, the directories
-below and place them in the archive tree.cpio. Again the @samp{-o}
-creates an archive, and the @samp{-v} option shows you the name of the
-files as they are archived. @xref{Copy-out mode}. Using the `.' in the
-find statement will give you more flexibility when doing restores, as it
-will save file names with a relative path vice a hard wired, absolute
-path. The @samp{-depth} option forces @samp{find} to print of the
-entries in a directory before printing the directory itself. This
-limits the effects of restrictive directory permissions by printing the
-directory entries in a directory before the directory name itself.
-
-
-
-
-Extracting an archive requires a bit more thought because cpio will not
-create directories by default. Another characteristic, is it will not
-overwrite existing files unless you tell it to.
-
-
-@example
-@cartouche
-% cpio -iv < directory.cpio
-@end cartouche
-@end example
-
-This will retrieve the files archived in the file directory.cpio and
-place them in the present directory. The @samp{-i} option extracts the
-archive and the @samp{-v} shows the file names as they are extracted.
-If you are dealing with an archived directory tree, you need to use the
-@samp{-d} option to create directories as necessary, something like:
-
-@example
-@cartouche
-% cpio -idv < tree.cpio
-@end cartouche
-@end example
-
-This will take the contents of the archive tree.cpio and extract it to
-the current directory. If you try to extract the files on top of files
-of the same name that already exist (and have the same or later
-modification time) cpio will not extract the file unless told to do so
-by the -u option. @xref{Copy-in mode}.
-
-
-In copy-pass mode, cpio copies files from one directory tree to another,
-combining the copy-out and copy-in steps without actually using an
-archive. It reads the list of files to copy from the standard input;
-the directory into which it will copy them is given as a non-option
-argument. @xref{Copy-pass mode}.
-
-@example
-@cartouche
-% find . -depth -print0 | cpio --null -pvd new-dir
-@end cartouche
-@end example
-
-
-The example shows copying the files of the present directory, and
-sub-directories to a new directory called new-dir. Some new options are
-the @samp{-print0} available with GNU find, combined with the
-@samp{--null} option of cpio. These two options act together to send
-file names between find and cpio, even if special characters are
-embedded in the file names. Another is @samp{-p}, which tells cpio to
-pass the files it finds to the directory @samp{new-dir}.
-
-@node Invoking `cpio', Media, Tutorial, Top
-@comment node-name, next, previous, up
-@chapter Invoking cpio
-@cindex invoking cpio
-@cindex command line options
-
-@menu
-* Copy-out mode::
-* Copy-in mode::
-* Copy-pass mode::
-* Options::
-@end menu
-
-@node Copy-out mode, Copy-in mode, Invoking `cpio', Invoking `cpio'
-@comment node-name, next, previous, up
-@section Copy-out mode
-
-In copy-out mode, cpio copies files into an archive. It reads a list
-of filenames, one per line, on the standard input, and writes the
-archive onto the standard output. A typical way to generate the list
-of filenames is with the find command; you should give find the -depth
-option to minimize problems with permissions on directories that are
-unreadable.
-@xref{Options}.
-
-@example
-cpio @{-o|--create@} [-0acvABLV] [-C bytes] [-H format]
-[-M message] [-O [[user@@]host:]archive] [-F [[user@@]host:]archive]
-[--file=[[user@@]host:]archive] [--format=format] [--sparse]
-[--message=message][--null] [--reset-access-time] [--verbose]
-[--dot] [--append] [--block-size=blocks] [--dereference]
-[--io-size=bytes] [--help] [--version] < name-list [> archive]
-@end example
-
-@node Copy-in mode, Copy-pass mode, Copy-out mode, Invoking `cpio'
-@comment node-name, next, previous, up
-@section Copy-in mode
-
-In copy-in mode, cpio copies files out of an archive or lists the
-archive contents. It reads the archive from the standard input. Any
-non-option command line arguments are shell globbing patterns; only
-files in the archive whose names match one or more of those patterns are
-copied from the archive. Unlike in the shell, an initial `.' in a
-filename does match a wildcard at the start of a pattern, and a `/' in a
-filename can match wildcards. If no patterns are given, all files are
-extracted. @xref{Options}.
-
-@example
-cpio @{-i|--extract@} [-bcdfmnrtsuvBSV] [-C bytes] [-E file]
-[-H format] [-M message] [-R [user][:.][group]]
-[-I [[user@@]host:]archive] [-F [[user@@]host:]archive]
-[--file=[[user@@]host:]archive] [--make-directories]
-[--nonmatching] [--preserve-modification-time]
-[--numeric-uid-gid] [--rename] [--list] [--swap-bytes] [--swap]
-[--dot] [--unconditional] [--verbose] [--block-size=blocks]
-[--swap-halfwords] [--io-size=bytes] [--pattern-file=file]
-[--format=format] [--owner=[user][:.][group]]
-[--no- preserve-owner] [--message=message] [--help] [--version]
-[-no-abosolute-filenames] [-only-verify-crc] [-quiet]
-[pattern...] [< archive]
-@end example
-
-@node Copy-pass mode, Options, Copy-in mode, Invoking `cpio'
-@comment node-name, next, previous, up
-@section Copy-pass mode
-
-In copy-pass mode, cpio copies files from one directory tree to
-another, combining the copy-out and copy-in steps without actually
-using an archive. It reads the list of files to copy from the
-standard input; the directory into which it will copy them is given as
-a non-option argument.
-@xref{Options}.
-
-@example
-cpio @{-p|--pass-through@} [-0adlmuvLV] [-R [user][:.][group]]
-[--null] [--reset-access-time] [--make-directories] [--link]
-[--preserve-modification-time] [--unconditional] [--verbose]
-[--dot] [--dereference] [--owner=[user][:.][group]] [--sparse]
-[--no-preserve-owner] [--help] [--version] destination-directory
-< name-list
-@end example
-
-
-
-@node Options, , Copy-pass mode, Invoking `cpio'
-@comment node-name, next, previous, up
-@section Options
-
-
-@table @code
-
-
-@item -0, --null
-Read a list of filenames terminated by a null character, instead of a
-newline, so that files whose names contain newlines can be archived.
-GNU find is one way to produce a list of null-terminated filenames.
-This option may be used in copy-out and copy-pass modes.
-
-@item -a, --reset-access-time
-Reset the access times of files after reading them, so
-that it does not look like they have just been read.
-
-@item -A, --append
-Append to an existing archive. Only works in copy-out
-mode. The archive must be a disk file specified with
-the -O or -F (--file) option.
-
-@item -b, --swap
-Swap both halfwords of words and bytes of halfwords in the data.
-Equivalent to -sS. This option may be used in copy-in mode. Use this
-option to convert 32-bit integers between big-endian and little-endian
-machines.
-
-@item -B
-Set the I/O block size to 5120 bytes. Initially the
-block size is 512 bytes.
-
-@item --block-size=BLOCK-SIZE
-Set the I/O block size to BLOCK-SIZE * 512 bytes.
-
-@item -c
-Use the old portable (ASCII) archive format.
-
-@item -C IO-SIZE, --io-size=IO-SIZE
-Set the I/O block size to IO-SIZE bytes.
-
-@item -d, --make-directories
-Create leading directories where needed.
-
-@item -E FILE, --pattern-file=FILE
-Read additional patterns specifying filenames to extract or list from
-FILE. The lines of FILE are treated as if they had been non-option
-arguments to cpio. This option is used in copy-in mode,
-
-@item -f, --nonmatching
-Only copy files that do not match any of the given
-patterns.
-
-@item -F, --file=archive
-Archive filename to use instead of standard input or output. To use a
-tape drive on another machine as the archive, use a filename that starts
-with `HOSTNAME:'. The hostname can be preceded by a username and an
-`@@' to access the remote tape drive as that user, if you have
-permission to do so (typically an entry in that user's `~/.rhosts'
-file).
-
-@item --force-local
-With -F, -I, or -O, take the archive file name to be a
-local file even if it contains a colon, which would
-ordinarily indicate a remote host name.
-
-@item -H FORMAT, --format=FORMAT
-Use archive format FORMAT. The valid formats are listed below; the same
-names are also recognized in all-caps. The default in copy-in mode is
-to automatically detect the archive format, and in copy-out mode is
-@samp{bin}.
-
-@table @samp
-@item bin
-The obsolete binary format.
-
-@item odc
-The old (POSIX.1) portable format.
-
-@item newc
-The new (SVR4) portable format, which supports file systems having more
-than 65536 i-nodes.
-
-@item crc
-The new (SVR4) portable format with a checksum added.
-
-@item tar
-The old tar format.
-
-@item ustar
-The POSIX.1 tar format. Also recognizes GNU tar archives, which are
-similar but not identical.
-
-@item hpbin
-The obsolete binary format used by HPUX's cpio (which stores device
-files differently).
-
-@item hpodc
-The portable format used by HPUX's cpio (which stores device files
-differently).
-@end table
-
-@item -i, --extract
-Run in copy-in mode.
-@xref{Copy-in mode}.
-
-@item -I archive
-Archive filename to use instead of standard input. To use a tape drive
-on another machine as the archive, use a filename that starts with
-`HOSTNAME:'. The hostname can be preceded by a username and an `@@' to
-access the remote tape drive as that user, if you have permission to do
-so (typically an entry in that user's `~/.rhosts' file).
-
-@item -k
-Ignored; for compatibility with other versions of cpio.
-
-@item -l, --link
-Link files instead of copying them, when possible.
-
-@item -L, --dereference
-Copy the file that a symbolic link points to, rather than the symbolic
-link itself.
-
-@item -m, --preserve-modification-time
-Retain previous file modification times when creating files.
-
-@item -M MESSAGE, --message=MESSAGE
-Print MESSAGE when the end of a volume of the backup media (such as a
-tape or a floppy disk) is reached, to prompt the user to insert a new
-volume. If MESSAGE contains the string "%d", it is replaced by the
-current volume number (starting at 1).
-
-@item -n, --numeric-uid-gid
-Show numeric UID and GID instead of translating them into names when using the
-@samp{--verbose option}.
-
-@item --no-absolute-filenames
-Create all files relative to the current directory in copy-in mode, even
-if they have an absolute file name in the archive.
-
-@item --no-preserve-owner
-Do not change the ownership of the files; leave them owned by the user
-extracting them. This is the default for non-root users, so that users
-on System V don't inadvertantly give away files. This option can be
-used in copy-in mode and copy-pass mode
-
-@item -o, --create
-Run in copy-out mode.
-@xref{Copy-out mode}.
-
-@item -O archive
-Archive filename to use instead of standard output. To use a tape drive
-on another machine as the archive, use a filename that starts with
-`HOSTNAME:'. The hostname can be preceded by a username and an `@@' to
-access the remote tape drive as that user, if you have permission to do
-so (typically an entry in that user's `~/.rhosts' file).
-
-@item --only-verify-crc
-Verify the CRC's of each file in the archive, when reading a CRC format
-archive. Don't actually extract the files.
-
-@item -p, --pass-through
-Run in copy-pass mode.
-@xref{Copy-pass mode}.
-
-@item --quiet
-Do not print the number of blocks copied.
-
-@item -r, --rename
-Interactively rename files.
-
-@item -R [user][:.][group], --owner [user][:.][group]
-Set the ownership of all files created to the specified user and/or
-group in copy-out and copy-pass modes. Either the user, the group, or
-both, must be present. If the group is omitted but the ":" or "."
-separator is given, use the given user's login group. Only the
-super-user can change files' ownership.
-
-@item -s, --swap-bytes
-Swap the bytes of each halfword (pair of bytes) in the files.This option
-can be used in copy-in mode.
-
-@item -S, --swap-halfwords
-Swap the halfwords of each word (4 bytes) in the files. This option may
-be used in copy-in mode.
-
-@item --sparse
-Write files with large blocks of zeros as sparse files. This option is
-used in copy-out and copy-pass modes.
-
-@item -t, --list
-Print a table of contents of the input.
-
-@item -u, --unconditional
-Replace all files, without asking whether to replace
-existing newer files with older files.
-
-@item -v, --verbose
-List the files processed, or with @samp{-t}, give an @samp{ls -l} style
-table of contents listing. In a verbose table of contents of a ustar
-archive, user and group names in the archive that do not exist on the
-local system are replaced by the names that correspond locally to the
-numeric UID and GID stored in the archive.
-
-@item -V --dot
-Print a @kbd{.} for each file processed.
-
-@item --version
-Print the cpio program version number and exit.
-@end table
-
-
-@node Media, Concept Index, Invoking `cpio', Top
-@comment node-name, next, previous, up
-@chapter Magnetic Media
-@cindex magnetic media
-
-Archives are usually written on removable media--tape cartridges, mag
-tapes, or floppy disks.
-
-The amount of data a tape or disk holds depends not only on its size,
-but also on how it is formatted. A 2400 foot long reel of mag tape
-holds 40 megabytes of data when formated at 1600 bits per inch. The
-physically smaller EXABYTE tape cartridge holds 2.3 gigabytes.
-
-Magnetic media are re-usable--once the archive on a tape is no longer
-needed, the archive can be erased and the tape or disk used over. Media
-quality does deteriorate with use, however. Most tapes or disks should
-be disgarded when they begin to produce data errors.
-
-Magnetic media are written and erased using magnetic fields, and should
-be protected from such fields to avoid damage to stored data. Sticking
-a floppy disk to a filing cabinet using a magnet is probably not a good
-idea.
-
-
-@node Concept Index, , Media, Top
-@comment node-name, next, previous, up
-@unnumbered Concept Index
-@printindex cp
-@contents
-@bye
diff --git a/contrib/cpio/cpiohdr.h b/contrib/cpio/cpiohdr.h
deleted file mode 100644
index 9694af69baec..000000000000
--- a/contrib/cpio/cpiohdr.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Extended cpio header from POSIX.1.
- Copyright (C) 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef _CPIOHDR_H
-
-#define _CPIOHDR_H 1
-
-#include <cpio.h>
-
-struct old_cpio_header
-{
- unsigned short c_magic;
- short c_dev;
- unsigned short c_ino;
- unsigned short c_mode;
- unsigned short c_uid;
- unsigned short c_gid;
- unsigned short c_nlink;
- short c_rdev;
- unsigned short c_mtimes[2];
- unsigned short c_namesize;
- unsigned short c_filesizes[2];
- unsigned long c_mtime; /* Long-aligned copy of `c_mtimes'. */
- unsigned long c_filesize; /* Long-aligned copy of `c_filesizes'. */
- char *c_name;
-};
-
-/* "New" portable format and CRC format:
-
- Each file has a 110 byte header,
- a variable length, NUL terminated filename,
- and variable length file data.
- A header for a filename "TRAILER!!!" indicates the end of the archive. */
-
-/* All the fields in the header are ISO 646 (approximately ASCII) strings
- of hexadecimal numbers, left padded, not NUL terminated.
-
- Field Name Length in Bytes Notes
- c_magic 6 "070701" for "new" portable format
- "070702" for CRC format
- c_ino 8
- c_mode 8
- c_uid 8
- c_gid 8
- c_nlink 8
- c_mtime 8
- c_filesize 8 must be 0 for FIFOs and directories
- c_maj 8
- c_min 8
- c_rmaj 8 only valid for chr and blk special files
- c_rmin 8 only valid for chr and blk special files
- c_namesize 8 count includes terminating NUL in pathname
- c_chksum 8 0 for "new" portable format; for CRC format
- the sum of all the bytes in the file */
-
-struct new_cpio_header
-{
- unsigned short c_magic;
- unsigned long c_ino;
- unsigned long c_mode;
- unsigned long c_uid;
- unsigned long c_gid;
- unsigned long c_nlink;
- unsigned long c_mtime;
- unsigned long c_filesize;
- long c_dev_maj;
- long c_dev_min;
- long c_rdev_maj;
- long c_rdev_min;
- unsigned long c_namesize;
- unsigned long c_chksum;
- char *c_name;
- char *c_tar_linkname;
-};
-
-#endif /* cpiohdr.h */
diff --git a/contrib/cpio/defer.c b/contrib/cpio/defer.c
deleted file mode 100644
index efe60e0dd118..000000000000
--- a/contrib/cpio/defer.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* defer.c - handle "defered" links in newc and crc archives
- Copyright (C) 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include "system.h"
-#include "cpiohdr.h"
-#include "extern.h"
-#include "defer.h"
-
-struct deferment *
-create_deferment (file_hdr)
- struct new_cpio_header *file_hdr;
-{
- struct deferment *d;
- d = (struct deferment *) xmalloc (sizeof (struct deferment) );
- d->header = *file_hdr;
- d->header.c_name = (char *) xmalloc (strlen (file_hdr->c_name) + 1);
- strcpy (d->header.c_name, file_hdr->c_name);
- return d;
-}
-
-void
-free_deferment (d)
- struct deferment *d;
-{
- free (d->header.c_name);
- free (d);
-}
diff --git a/contrib/cpio/defer.h b/contrib/cpio/defer.h
deleted file mode 100644
index 89abffec03c8..000000000000
--- a/contrib/cpio/defer.h
+++ /dev/null
@@ -1,8 +0,0 @@
-struct deferment
- {
- struct deferment *next;
- struct new_cpio_header header;
- };
-
-struct deferment *create_deferment P_((struct new_cpio_header *file_hdr));
-void free_deferment P_((struct deferment *d));
diff --git a/contrib/cpio/dirname.c b/contrib/cpio/dirname.c
deleted file mode 100644
index 15d25967afe8..000000000000
--- a/contrib/cpio/dirname.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* dirname.c -- return all but the last element in a path
- Copyright (C) 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-char *malloc ();
-#endif
-#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#else
-#include <strings.h>
-#ifndef strrchr
-#define strrchr rindex
-#endif
-#endif
-
-/* Return the leading directories part of PATH,
- allocated with malloc. If out of memory, return 0.
- Assumes that trailing slashes have already been
- removed. */
-
-char *
-dirname (path)
- char *path;
-{
- char *newpath;
- char *slash;
- int length; /* Length of result, not including NUL. */
-
- slash = strrchr (path, '/');
- if (slash == 0)
- {
- /* File is in the current directory. */
- path = ".";
- length = 1;
- }
- else
- {
- /* Remove any trailing slashes from the result. */
- while (slash > path && *slash == '/')
- --slash;
-
- length = slash - path + 1;
- }
- newpath = (char *) malloc (length + 1);
- if (newpath == 0)
- return 0;
- strncpy (newpath, path, length);
- newpath[length] = 0;
- return newpath;
-}
diff --git a/contrib/cpio/dstring.c b/contrib/cpio/dstring.c
deleted file mode 100644
index 26d6bbcc1dcf..000000000000
--- a/contrib/cpio/dstring.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* dstring.c - The dynamic string handling routines used by cpio.
- Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#include "dstring.h"
-
-#if __STDC__
-# define P_(s) s
-#else
-# define P_(s) ()
-#endif
-char *xmalloc P_((unsigned n));
-char *xrealloc P_((char *p, unsigned n));
-
-/* Initialiaze dynamic string STRING with space for SIZE characters. */
-
-void
-ds_init (string, size)
- dynamic_string *string;
- int size;
-{
- string->ds_length = size;
- string->ds_string = (char *) xmalloc (size);
-}
-
-/* Expand dynamic string STRING, if necessary, to hold SIZE characters. */
-
-void
-ds_resize (string, size)
- dynamic_string *string;
- int size;
-{
- if (size > string->ds_length)
- {
- string->ds_length = size;
- string->ds_string = (char *) xrealloc ((char *) string->ds_string, size);
- }
-}
-
-/* Dynamic string S gets a string terminated by the EOS character
- (which is removed) from file F. S will increase
- in size during the function if the string from F is longer than
- the current size of S.
- Return NULL if end of file is detected. Otherwise,
- Return a pointer to the null-terminated string in S. */
-
-char *
-ds_fgetstr (f, s, eos)
- FILE *f;
- dynamic_string *s;
- char eos;
-{
- int insize; /* Amount needed for line. */
- int strsize; /* Amount allocated for S. */
- int next_ch;
-
- /* Initialize. */
- insize = 0;
- strsize = s->ds_length;
-
- /* Read the input string. */
- next_ch = getc (f);
- while (next_ch != eos && next_ch != EOF)
- {
- if (insize >= strsize - 1)
- {
- ds_resize (s, strsize * 2 + 2);
- strsize = s->ds_length;
- }
- s->ds_string[insize++] = next_ch;
- next_ch = getc (f);
- }
- s->ds_string[insize++] = '\0';
-
- if (insize == 1 && next_ch == EOF)
- return NULL;
- else
- return s->ds_string;
-}
-
-char *
-ds_fgets (f, s)
- FILE *f;
- dynamic_string *s;
-{
- return ds_fgetstr (f, s, '\n');
-}
-
-char *
-ds_fgetname (f, s)
- FILE *f;
- dynamic_string *s;
-{
- return ds_fgetstr (f, s, '\0');
-}
diff --git a/contrib/cpio/dstring.h b/contrib/cpio/dstring.h
deleted file mode 100644
index 369da0bcbe7a..000000000000
--- a/contrib/cpio/dstring.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* dstring.h - Dynamic string handling include file. Requires strings.h.
- Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* A dynamic string consists of record that records the size of an
- allocated string and the pointer to that string. The actual string
- is a normal zero byte terminated string that can be used with the
- usual string functions. The major difference is that the
- dynamic_string routines know how to get more space if it is needed
- by allocating new space and copying the current string. */
-
-typedef struct
-{
- int ds_length; /* Actual amount of storage allocated. */
- char *ds_string; /* String. */
-} dynamic_string;
-
-
-/* Macros that look similar to the original string functions.
- WARNING: These macros work only on pointers to dynamic string records.
- If used with a real record, an "&" must be used to get the pointer. */
-#define ds_strlen(s) strlen ((s)->ds_string)
-#define ds_strcmp(s1, s2) strcmp ((s1)->ds_string, (s2)->ds_string)
-#define ds_strncmp(s1, s2, n) strncmp ((s1)->ds_string, (s2)->ds_string, n)
-#define ds_index(s, c) index ((s)->ds_string, c)
-#define ds_rindex(s, c) rindex ((s)->ds_string, c)
-
-void ds_init ();
-void ds_resize ();
-char *ds_fgetname ();
-char *ds_fgets ();
-char *ds_fgetstr ();
diff --git a/contrib/cpio/error.c b/contrib/cpio/error.c
deleted file mode 100644
index a36198b6b6e8..000000000000
--- a/contrib/cpio/error.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* error.c -- error handler for noninteractive utilities
- Copyright (C) 1990, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC
-# if __STDC__
-# include <stdarg.h>
-# define VA_START(args, lastarg) va_start(args, lastarg)
-# else
-# include <varargs.h>
-# define VA_START(args, lastarg) va_start(args)
-# endif
-#else
-# define va_alist a1, a2, a3, a4, a5, a6, a7, a8
-# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
-#endif
-
-#if STDC_HEADERS || _LIBC
-# include <stdlib.h>
-# include <string.h>
-#else
-void exit ();
-#endif
-
-/* This variable is incremented each time `error' is called. */
-unsigned int error_message_count;
-
-/* If NULL, error will flush stdout, then print on stderr the program
- name, a colon and a space. Otherwise, error will call this
- function without parameters instead. */
-void (*error_print_progname) () = NULL;
-
-#ifdef _LIBC
-#define program_name program_invocation_name
-#endif
-
-/* The calling program should define program_name and set it to the
- name of the executing program. */
-extern char *program_name;
-
-#if HAVE_STRERROR || _LIBC
-# ifndef strerror /* On some systems, strerror is a macro */
-char *strerror ();
-# endif
-#else
-static char *
-private_strerror (errnum)
- int errnum;
-{
- extern char *sys_errlist[];
- extern int sys_nerr;
-
- if (errnum > 0 && errnum <= sys_nerr)
- return sys_errlist[errnum];
- return "Unknown system error";
-}
-#define strerror private_strerror
-#endif
-
-/* Print the program name and error message MESSAGE, which is a printf-style
- format string with optional args.
- If ERRNUM is nonzero, print its corresponding system error message.
- Exit with status STATUS if it is nonzero. */
-/* VARARGS */
-
-void
-#if defined(VA_START) && __STDC__
-error (int status, int errnum, const char *message, ...)
-#else
-error (status, errnum, message, va_alist)
- int status;
- int errnum;
- char *message;
- va_dcl
-#endif
-{
-#ifdef VA_START
- va_list args;
-#endif
-
- if (error_print_progname)
- (*error_print_progname) ();
- else
- {
- fflush (stdout);
- fprintf (stderr, "%s: ", program_name);
- }
-
-#ifdef VA_START
- VA_START (args, message);
-# if HAVE_VPRINTF || _LIBC
- vfprintf (stderr, message, args);
-# else
- _doprnt (message, args, stderr);
-# endif
- va_end (args);
-#else
- fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8);
-#endif
-
- ++error_message_count;
-
- if (errnum)
- fprintf (stderr, ": %s", strerror (errnum));
- putc ('\n', stderr);
- fflush (stderr);
- if (status)
- exit (status);
-}
diff --git a/contrib/cpio/extern.h b/contrib/cpio/extern.h
deleted file mode 100644
index 0e1344f64e27..000000000000
--- a/contrib/cpio/extern.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/* extern.h - External declarations for cpio. Requires system.h.
- Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-enum archive_format
-{
- arf_unknown, arf_binary, arf_oldascii, arf_newascii, arf_crcascii,
- arf_tar, arf_ustar, arf_hpoldascii, arf_hpbinary
-};
-extern enum archive_format archive_format;
-extern int reset_time_flag;
-extern int io_block_size;
-extern int create_dir_flag;
-extern int rename_flag;
-extern char *rename_batch_file;
-extern int table_flag;
-extern int unconditional_flag;
-extern int verbose_flag;
-extern int dot_flag;
-extern int link_flag;
-extern int retain_time_flag;
-extern int crc_i_flag;
-extern int append_flag;
-extern int swap_bytes_flag;
-extern int swap_halfwords_flag;
-extern int swapping_bytes;
-extern int swapping_halfwords;
-extern int set_owner_flag;
-extern uid_t set_owner;
-extern int set_group_flag;
-extern gid_t set_group;
-extern int no_chown_flag;
-extern int sparse_flag;
-extern int quiet_flag;
-extern int only_verify_crc_flag;
-extern int no_abs_paths_flag;
-
-extern int last_header_start;
-extern int copy_matching_files;
-extern int numeric_uid;
-extern char *pattern_file_name;
-extern char *new_media_message;
-extern char *new_media_message_with_number;
-extern char *new_media_message_after_number;
-extern int archive_des;
-extern char *archive_name;
-extern unsigned long crc;
-#ifdef DEBUG_CPIO
-extern int debug_flag;
-#endif
-
-extern char *input_buffer, *output_buffer;
-extern char *in_buff, *out_buff;
-extern long input_buffer_size;
-extern long input_size, output_size;
-#ifdef __GNUC__
-extern long long input_bytes, output_bytes;
-#else
-extern long input_bytes, output_bytes;
-#endif
-extern char zeros_512[];
-extern char *directory_name;
-extern char **save_patterns;
-extern int num_patterns;
-extern char name_end;
-extern char input_is_special;
-extern char output_is_special;
-extern char input_is_seekable;
-extern char output_is_seekable;
-extern int f_force_local;
-extern char *program_name;
-extern int (*xstat) ();
-extern void (*copy_function) ();
-
-#if __STDC__ || defined(__MSDOS__)
-# define P_(s) s
-#else
-# define P_(s) ()
-#endif
-
-/* copyin.c */
-void read_in_header P_((struct new_cpio_header *file_hdr, int in_des));
-void read_in_old_ascii P_((struct new_cpio_header *file_hdr, int in_des));
-void read_in_new_ascii P_((struct new_cpio_header *file_hdr, int in_des));
-void read_in_binary P_((struct new_cpio_header *file_hdr, int in_des));
-void swab_array P_((char *arg, int count));
-void process_copy_in P_((void));
-void long_format P_((struct new_cpio_header *file_hdr, char *link_name));
-void print_name_with_quoting P_((char *p));
-
-/* copyout.c */
-void write_out_header P_((struct new_cpio_header *file_hdr, int out_des));
-void process_copy_out P_((void));
-
-/* copypass.c */
-void process_copy_pass P_((void));
-int link_to_maj_min_ino P_((char *file_name, int st_dev_maj,
- int st_dev_min, int st_ino));
-int link_to_name P_((char *link_name, char *link_target));
-
-/* dirname.c */
-char *dirname P_((char *path));
-
-/* error.c */
-void error P_((int status, int errnum, char *message, ...));
-
-/* filemode.c */
-void mode_string P_((unsigned int mode, char *str));
-
-/* idcache.c */
-#ifndef __MSDOS__
-char *getgroup ();
-char *getuser ();
-uid_t *getuidbyname ();
-gid_t *getgidbyname ();
-#endif
-
-/* lchown.c */
-#ifdef HAVE_LCHOWN
-int lchown P_((const char *path, uid_t owner, gid_t group));
-#endif
-
-/* main.c */
-void process_args P_((int argc, char *argv[]));
-void initialize_buffers P_((void));
-
-/* makepath.c */
-int make_path P_((char *argpath, int mode, int parent_mode,
- uid_t owner, gid_t group, char *verbose_fmt_string));
-
-/* stripslash.c */
-void strip_trailing_slashes P_((char *path));
-
-/* tar.c */
-void write_out_tar_header P_((struct new_cpio_header *file_hdr, int out_des));
-int null_block P_((long *block, int size));
-void read_in_tar_header P_((struct new_cpio_header *file_hdr, int in_des));
-int otoa P_((char *s, unsigned long *n));
-int is_tar_header P_((char *buf));
-int is_tar_filename_too_long P_((char *name));
-
-/* userspec.c */
-#ifndef __MSDOS__
-char *parse_user_spec P_((char *name, uid_t *uid, gid_t *gid,
- char **username, char **groupname));
-#endif
-
-/* util.c */
-void tape_empty_output_buffer P_((int out_des));
-void disk_empty_output_buffer P_((int out_des));
-void swahw_array P_((char *ptr, int count));
-void tape_buffered_write P_((char *in_buf, int out_des, long num_bytes));
-void tape_buffered_read P_((char *in_buf, int in_des, long num_bytes));
-int tape_buffered_peek P_((char *peek_buf, int in_des, int num_bytes));
-void tape_toss_input P_((int in_des, long num_bytes));
-void copy_files_tape_to_disk P_((int in_des, int out_des, long num_bytes));
-void copy_files_disk_to_tape P_((int in_des, int out_des, long num_bytes, char *filename));
-void copy_files_disk_to_disk P_((int in_des, int out_des, long num_bytes, char *filename));
-void create_all_directories P_((char *name));
-void prepare_append P_((int out_file_des));
-char *find_inode_file P_((unsigned long node_num,
- unsigned long major_num, unsigned long minor_num));
-void add_inode P_((unsigned long node_num, char *file_name,
- unsigned long major_num, unsigned long minor_num));
-int open_archive P_((char *file));
-void tape_offline P_((int tape_des));
-void get_next_reel P_((int tape_des));
-void set_new_media_message P_((char *message));
-#if defined(__MSDOS__) && !defined(__GNUC__)
-int chown P_((char *path, int owner, int group));
-#endif
-#ifdef __TURBOC__
-int utime P_((char *filename, struct utimbuf *utb));
-#endif
-#ifdef HPUX_CDF
-char *add_cdf_double_slashes P_((char *filename));
-#endif
-
-/* xmalloc.c */
-char *xmalloc P_((unsigned n));
-char *xrealloc P_((char *p, unsigned n));
-
-/* xstrdup.c */
-char *xstrdup P_((char *string));
-
-#define DISK_IO_BLOCK_SIZE (512)
diff --git a/contrib/cpio/filemode.c b/contrib/cpio/filemode.c
deleted file mode 100644
index 20c65c4b06e2..000000000000
--- a/contrib/cpio/filemode.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* filemode.c -- make a string describing file modes
- Copyright (C) 1985, 1990, 1993 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#if !S_IRUSR
-# if S_IREAD
-# define S_IRUSR S_IREAD
-# else
-# define S_IRUSR 00400
-# endif
-#endif
-
-#if !S_IWUSR
-# if S_IWRITE
-# define S_IWUSR S_IWRITE
-# else
-# define S_IWUSR 00200
-# endif
-#endif
-
-#if !S_IXUSR
-# if S_IEXEC
-# define S_IXUSR S_IEXEC
-# else
-# define S_IXUSR 00100
-# endif
-#endif
-
-#ifdef STAT_MACROS_BROKEN
-#undef S_ISBLK
-#undef S_ISCHR
-#undef S_ISDIR
-#undef S_ISFIFO
-#undef S_ISLNK
-#undef S_ISMPB
-#undef S_ISMPC
-#undef S_ISNWK
-#undef S_ISREG
-#undef S_ISSOCK
-#endif /* STAT_MACROS_BROKEN. */
-
-#if !defined(S_ISBLK) && defined(S_IFBLK)
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if !defined(S_ISCHR) && defined(S_IFCHR)
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISREG) && defined(S_IFREG)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#if !defined(S_ISFIFO) && defined(S_IFIFO)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#if !defined(S_ISSOCK) && defined(S_IFSOCK)
-#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#endif
-#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
-#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-#endif
-#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
-#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#endif
-
-void mode_string ();
-static char ftypelet ();
-static void rwx ();
-static void setst ();
-
-/* filemodestring - fill in string STR with an ls-style ASCII
- representation of the st_mode field of file stats block STATP.
- 10 characters are stored in STR; no terminating null is added.
- The characters stored in STR are:
-
- 0 File type. 'd' for directory, 'c' for character
- special, 'b' for block special, 'm' for multiplex,
- 'l' for symbolic link, 's' for socket, 'p' for fifo,
- '-' for regular, '?' for any other file type
-
- 1 'r' if the owner may read, '-' otherwise.
-
- 2 'w' if the owner may write, '-' otherwise.
-
- 3 'x' if the owner may execute, 's' if the file is
- set-user-id, '-' otherwise.
- 'S' if the file is set-user-id, but the execute
- bit isn't set.
-
- 4 'r' if group members may read, '-' otherwise.
-
- 5 'w' if group members may write, '-' otherwise.
-
- 6 'x' if group members may execute, 's' if the file is
- set-group-id, '-' otherwise.
- 'S' if it is set-group-id but not executable.
-
- 7 'r' if any user may read, '-' otherwise.
-
- 8 'w' if any user may write, '-' otherwise.
-
- 9 'x' if any user may execute, 't' if the file is "sticky"
- (will be retained in swap space after execution), '-'
- otherwise.
- 'T' if the file is sticky but not executable. */
-
-void
-filemodestring (statp, str)
- struct stat *statp;
- char *str;
-{
- mode_string (statp->st_mode, str);
-}
-
-/* Like filemodestring, but only the relevant part of the `struct stat'
- is given as an argument. */
-
-void
-mode_string (mode, str)
- unsigned short mode;
- char *str;
-{
- str[0] = ftypelet ((long) mode);
- rwx ((mode & 0700) << 0, &str[1]);
- rwx ((mode & 0070) << 3, &str[4]);
- rwx ((mode & 0007) << 6, &str[7]);
- setst (mode, str);
-}
-
-/* Return a character indicating the type of file described by
- file mode BITS:
- 'd' for directories
- 'b' for block special files
- 'c' for character special files
- 'm' for multiplexor files
- 'l' for symbolic links
- 's' for sockets
- 'p' for fifos
- '-' for regular files
- '?' for any other file type. */
-
-static char
-ftypelet (bits)
- long bits;
-{
-#ifdef S_ISBLK
- if (S_ISBLK (bits))
- return 'b';
-#endif
- if (S_ISCHR (bits))
- return 'c';
- if (S_ISDIR (bits))
- return 'd';
- if (S_ISREG (bits))
- return '-';
-#ifdef S_ISFIFO
- if (S_ISFIFO (bits))
- return 'p';
-#endif
-#ifdef S_ISLNK
- if (S_ISLNK (bits))
- return 'l';
-#endif
-#ifdef S_ISSOCK
- if (S_ISSOCK (bits))
- return 's';
-#endif
-#ifdef S_ISMPC
- if (S_ISMPC (bits))
- return 'm';
-#endif
-#ifdef S_ISNWK
- if (S_ISNWK (bits))
- return 'n';
-#endif
- return '?';
-}
-
-/* Look at read, write, and execute bits in BITS and set
- flags in CHARS accordingly. */
-
-static void
-rwx (bits, chars)
- unsigned short bits;
- char *chars;
-{
- chars[0] = (bits & S_IRUSR) ? 'r' : '-';
- chars[1] = (bits & S_IWUSR) ? 'w' : '-';
- chars[2] = (bits & S_IXUSR) ? 'x' : '-';
-}
-
-/* Set the 's' and 't' flags in file attributes string CHARS,
- according to the file mode BITS. */
-
-static void
-setst (bits, chars)
- unsigned short bits;
- char *chars;
-{
-#ifdef S_ISUID
- if (bits & S_ISUID)
- {
- if (chars[3] != 'x')
- /* Set-uid, but not executable by owner. */
- chars[3] = 'S';
- else
- chars[3] = 's';
- }
-#endif
-#ifdef S_ISGID
- if (bits & S_ISGID)
- {
- if (chars[6] != 'x')
- /* Set-gid, but not executable by group. */
- chars[6] = 'S';
- else
- chars[6] = 's';
- }
-#endif
-#ifdef S_ISVTX
- if (bits & S_ISVTX)
- {
- if (chars[9] != 'x')
- /* Sticky, but not executable by others. */
- chars[9] = 'T';
- else
- chars[9] = 't';
- }
-#endif
-}
diff --git a/contrib/cpio/filetypes.h b/contrib/cpio/filetypes.h
deleted file mode 100644
index 46a79a9c3b4a..000000000000
--- a/contrib/cpio/filetypes.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* filetypes.h - deal with POSIX annoyances
- Copyright (C) 1991 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Include sys/types.h and sys/stat.h before this file. */
-
-#ifndef S_ISREG /* Doesn't have POSIX.1 stat stuff. */
-#define mode_t unsigned short
-#endif
-
-/* Define the POSIX macros for systems that lack them. */
-#if !defined(S_ISBLK) && defined(S_IFBLK)
-#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-#endif
-#if !defined(S_ISCHR) && defined(S_IFCHR)
-#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-#endif
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISREG) && defined(S_IFREG)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
-#if !defined(S_ISFIFO) && defined(S_IFIFO)
-#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-#endif
-#if !defined(S_ISSOCK) && defined(S_IFSOCK)
-#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-#endif
-#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX network special */
-#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-#endif
-
-/* Define the file type bits used in cpio archives.
- They have the same values as the S_IF bits in traditional Unix. */
-
-#define CP_IFMT 0170000 /* Mask for all file type bits. */
-
-#if defined(S_ISBLK)
-#define CP_IFBLK 0060000
-#endif
-#if defined(S_ISCHR)
-#define CP_IFCHR 0020000
-#endif
-#if defined(S_ISDIR)
-#define CP_IFDIR 0040000
-#endif
-#if defined(S_ISREG)
-#define CP_IFREG 0100000
-#endif
-#if defined(S_ISFIFO)
-#define CP_IFIFO 0010000
-#endif
-#if defined(S_ISLNK)
-#define CP_IFLNK 0120000
-#endif
-#if defined(S_ISSOCK)
-#define CP_IFSOCK 0140000
-#endif
-#if defined(S_ISNWK)
-#define CP_IFNWK 0110000
-#endif
-
-#ifndef S_ISLNK
-#define lstat stat
-#endif
-int lstat ();
-int stat ();
diff --git a/contrib/cpio/getopt.c b/contrib/cpio/getopt.c
deleted file mode 100644
index beb7450dd9ce..000000000000
--- a/contrib/cpio/getopt.c
+++ /dev/null
@@ -1,765 +0,0 @@
-/* Getopt for GNU.
- NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
- before changing it!
-
- Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95
- Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
- Ditto for AIX 3.2 and <stdlib.h>. */
-#ifndef _NO_PROTO
-#define _NO_PROTO
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#if !defined (__STDC__) || !__STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-/* Don't include stdlib.h for non-GNU C libraries because some of them
- contain conflicting prototypes for getopt. */
-#include <stdlib.h>
-#endif /* GNU C library. */
-
-#ifndef _
-/* This is for other GNU distributions with internationalized messages.
- When compiling libc, the _ macro is predefined. */
-#ifdef HAVE_LIBINTL_H
-# include <libintl.h>
-# define _(msgid) gettext (msgid)
-#else
-# define _(msgid) (msgid)
-#endif
-#endif
-
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
- but it behaves differently for the user, since it allows the user
- to intersperse the options with the other arguments.
-
- As `getopt' works, it permutes the elements of ARGV so that,
- when it is done, all the options precede everything else. Thus
- all application programs are extended to handle flexible argument order.
-
- Setting the environment variable POSIXLY_CORRECT disables permutation.
- Then the behavior is completely standard.
-
- GNU application programs can use a third alternative mode in which
- they can distinguish the relative order of options and other arguments. */
-
-#include "getopt.h"
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-char *optarg = NULL;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns EOF, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-/* XXX 1003.2 says this must be 1 before any call. */
-int optind = 0;
-
-/* The next char to be scanned in the option-element
- in which the last option character we returned was found.
- This allows us to pick up the scan where we left off.
-
- If this is zero, or a null string, it means resume the scan
- by advancing to the next ARGV-element. */
-
-static char *nextchar;
-
-/* Callers store zero here to inhibit the error message
- for unrecognized options. */
-
-int opterr = 1;
-
-/* Set to an option character which was unrecognized.
- This must be initialized on some systems to avoid linking in the
- system's own getopt implementation. */
-
-int optopt = '?';
-
-/* Describe how to deal with options that follow non-option ARGV-elements.
-
- If the caller did not specify anything,
- the default is REQUIRE_ORDER if the environment variable
- POSIXLY_CORRECT is defined, PERMUTE otherwise.
-
- REQUIRE_ORDER means don't recognize them as options;
- stop option processing when the first non-option is seen.
- This is what Unix does.
- This mode of operation is selected by either setting the environment
- variable POSIXLY_CORRECT, or using `+' as the first character
- of the list of option characters.
-
- PERMUTE is the default. We permute the contents of ARGV as we scan,
- so that eventually all the non-options are at the end. This allows options
- to be given in any order, even with programs that were not written to
- expect this.
-
- RETURN_IN_ORDER is an option available to programs that were written
- to expect options and other ARGV-elements in any order and that care about
- the ordering of the two. We describe each non-option ARGV-element
- as if it were the argument of an option with character code 1.
- Using `-' as the first character of the list of option characters
- selects this mode of operation.
-
- The special argument `--' forces an end of option-scanning regardless
- of the value of `ordering'. In the case of RETURN_IN_ORDER, only
- `--' can cause `getopt' to return EOF with `optind' != ARGC. */
-
-static enum
-{
- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-} ordering;
-
-/* Value of POSIXLY_CORRECT environment variable. */
-static char *posixly_correct;
-
-#ifdef __GNU_LIBRARY__
-/* We want to avoid inclusion of string.h with non-GNU libraries
- because there are many ways it can cause trouble.
- On some systems, it contains special magic macros that don't work
- in GCC. */
-#include <string.h>
-#define my_index strchr
-#else
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-char *getenv ();
-
-static char *
-my_index (str, chr)
- const char *str;
- int chr;
-{
- while (*str)
- {
- if (*str == chr)
- return (char *) str;
- str++;
- }
- return 0;
-}
-
-/* If using GCC, we can safely declare strlen this way.
- If not using GCC, it is ok not to declare it. */
-#ifdef __GNUC__
-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
- That was relevant to code that was here before. */
-#if !defined (__STDC__) || !__STDC__
-/* gcc with -traditional declares the built-in strlen to return int,
- and has done so at least since version 2.4.5. -- rms. */
-extern int strlen (const char *);
-#endif /* not __STDC__ */
-#endif /* __GNUC__ */
-
-#endif /* not __GNU_LIBRARY__ */
-
-/* Handle permutation of arguments. */
-
-/* Describe the part of ARGV that contains non-options that have
- been skipped. `first_nonopt' is the index in ARGV of the first of them;
- `last_nonopt' is the index after the last of them. */
-
-static int first_nonopt;
-static int last_nonopt;
-
-/* Exchange two adjacent subsequences of ARGV.
- One subsequence is elements [first_nonopt,last_nonopt)
- which contains all the non-options that have been skipped so far.
- The other is elements [last_nonopt,optind), which contains all
- the options processed since those non-options were skipped.
-
- `first_nonopt' and `last_nonopt' are relocated so that they describe
- the new indices of the non-options in ARGV after they are moved. */
-
-static void
-exchange (argv)
- char **argv;
-{
- int bottom = first_nonopt;
- int middle = last_nonopt;
- int top = optind;
- char *tem;
-
- /* Exchange the shorter segment with the far end of the longer segment.
- That puts the shorter segment into the right place.
- It leaves the longer segment in the right place overall,
- but it consists of two parts that need to be swapped next. */
-
- while (top > middle && middle > bottom)
- {
- if (top - middle > middle - bottom)
- {
- /* Bottom segment is the short one. */
- int len = middle - bottom;
- register int i;
-
- /* Swap it with the top part of the top segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[top - (middle - bottom) + i];
- argv[top - (middle - bottom) + i] = tem;
- }
- /* Exclude the moved bottom segment from further swapping. */
- top -= len;
- }
- else
- {
- /* Top segment is the short one. */
- int len = top - middle;
- register int i;
-
- /* Swap it with the bottom part of the bottom segment. */
- for (i = 0; i < len; i++)
- {
- tem = argv[bottom + i];
- argv[bottom + i] = argv[middle + i];
- argv[middle + i] = tem;
- }
- /* Exclude the moved top segment from further swapping. */
- bottom += len;
- }
- }
-
- /* Update records for the slots the non-options now occupy. */
-
- first_nonopt += (optind - last_nonopt);
- last_nonopt = optind;
-}
-
-/* Initialize the internal data when the first call is made. */
-
-static const char *
-_getopt_initialize (optstring)
- const char *optstring;
-{
- /* Start processing options with ARGV-element 1 (since ARGV-element 0
- is the program name); the sequence of previously skipped
- non-option ARGV-elements is empty. */
-
- first_nonopt = last_nonopt = optind = 1;
-
- nextchar = NULL;
-
- posixly_correct = getenv ("POSIXLY_CORRECT");
-
- /* Determine how to handle the ordering of options and nonoptions. */
-
- if (optstring[0] == '-')
- {
- ordering = RETURN_IN_ORDER;
- ++optstring;
- }
- else if (optstring[0] == '+')
- {
- ordering = REQUIRE_ORDER;
- ++optstring;
- }
- else if (posixly_correct != NULL)
- ordering = REQUIRE_ORDER;
- else
- ordering = PERMUTE;
-
- return optstring;
-}
-
-/* Scan elements of ARGV (whose length is ARGC) for option characters
- given in OPTSTRING.
-
- If an element of ARGV starts with '-', and is not exactly "-" or "--",
- then it is an option element. The characters of this element
- (aside from the initial '-') are option characters. If `getopt'
- is called repeatedly, it returns successively each of the option characters
- from each of the option elements.
-
- If `getopt' finds another option character, it returns that character,
- updating `optind' and `nextchar' so that the next call to `getopt' can
- resume the scan with the following option character or ARGV-element.
-
- If there are no more option characters, `getopt' returns `EOF'.
- Then `optind' is the index in ARGV of the first ARGV-element
- that is not an option. (The ARGV-elements have been permuted
- so that those that are not options now come last.)
-
- OPTSTRING is a string containing the legitimate option characters.
- If an option character is seen that is not listed in OPTSTRING,
- return '?' after printing an error message. If you set `opterr' to
- zero, the error message is suppressed but we still return '?'.
-
- If a char in OPTSTRING is followed by a colon, that means it wants an arg,
- so the following text in the same ARGV-element, or the text of the following
- ARGV-element, is returned in `optarg'. Two colons mean an option that
- wants an optional arg; if there is text in the current ARGV-element,
- it is returned in `optarg', otherwise `optarg' is set to zero.
-
- If OPTSTRING starts with `-' or `+', it requests different methods of
- handling the non-option ARGV-elements.
- See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
-
- Long-named options begin with `--' instead of `-'.
- Their names may be abbreviated as long as the abbreviation is unique
- or is an exact match for some defined option. If they have an
- argument, it follows the option name in the same ARGV-element, separated
- from the option name by a `=', or else the in next ARGV-element.
- When `getopt' finds a long-named option, it returns 0 if that option's
- `flag' field is nonzero, the value of the option's `val' field
- if the `flag' field is zero.
-
- The elements of ARGV aren't really const, because we permute them.
- But we pretend they're const in the prototype to be compatible
- with other systems.
-
- LONGOPTS is a vector of `struct option' terminated by an
- element containing a name which is zero.
-
- LONGIND returns the index in LONGOPT of the long-named option found.
- It is only valid when a long-named option has been found by the most
- recent call.
-
- If LONG_ONLY is nonzero, '-' as well as '--' can introduce
- long-named options. */
-
-int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct option *longopts;
- int *longind;
- int long_only;
-{
- optarg = NULL;
-
- if (optind == 0)
- {
- optstring = _getopt_initialize (optstring);
- optind = 1; /* Don't scan ARGV[0], the program name. */
- }
-
- if (nextchar == NULL || *nextchar == '\0')
- {
- /* Advance to the next ARGV-element. */
-
- if (ordering == PERMUTE)
- {
- /* If we have just processed some options following some non-options,
- exchange them so that the options come first. */
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (last_nonopt != optind)
- first_nonopt = optind;
-
- /* Skip any additional non-options
- and extend the range of non-options previously skipped. */
-
- while (optind < argc
- && (argv[optind][0] != '-' || argv[optind][1] == '\0'))
- optind++;
- last_nonopt = optind;
- }
-
- /* The special ARGV-element `--' means premature end of options.
- Skip it like a null option,
- then exchange with previous non-options as if it were an option,
- then skip everything else like a non-option. */
-
- if (optind != argc && !strcmp (argv[optind], "--"))
- {
- optind++;
-
- if (first_nonopt != last_nonopt && last_nonopt != optind)
- exchange ((char **) argv);
- else if (first_nonopt == last_nonopt)
- first_nonopt = optind;
- last_nonopt = argc;
-
- optind = argc;
- }
-
- /* If we have done all the ARGV-elements, stop the scan
- and back over any non-options that we skipped and permuted. */
-
- if (optind == argc)
- {
- /* Set the next-arg-index to point at the non-options
- that we previously skipped, so the caller will digest them. */
- if (first_nonopt != last_nonopt)
- optind = first_nonopt;
- return EOF;
- }
-
- /* If we have come to a non-option and did not permute it,
- either stop the scan or describe it to the caller and pass it by. */
-
- if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
- {
- if (ordering == REQUIRE_ORDER)
- return EOF;
- optarg = argv[optind++];
- return 1;
- }
-
- /* We have found another option-ARGV-element.
- Skip the initial punctuation. */
-
- nextchar = (argv[optind] + 1
- + (longopts != NULL && argv[optind][1] == '-'));
- }
-
- /* Decode the current option-ARGV-element. */
-
- /* Check whether the ARGV-element is a long option.
-
- If long_only and the ARGV-element has the form "-f", where f is
- a valid short option, don't consider it an abbreviated form of
- a long option that starts with f. Otherwise there would be no
- way to give the -f short option.
-
- On the other hand, if there's a long option "fubar" and
- the ARGV-element is "-fu", do consider that an abbreviation of
- the long option, just like "--fu", and not "-f" with arg "u".
-
- This distinction seems to be the most useful approach. */
-
- if (longopts != NULL
- && (argv[optind][1] == '-'
- || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
- {
- char *nameend;
- const struct option *p;
- const struct option *pfound = NULL;
- int exact = 0;
- int ambig = 0;
- int indfound;
- int option_index;
-
- for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
- /* Do nothing. */ ;
-
- /* Test all long options for either exact match
- or abbreviated matches. */
- for (p = longopts, option_index = 0; p->name; p++, option_index++)
- if (!strncmp (p->name, nextchar, nameend - nextchar))
- {
- if (nameend - nextchar == strlen (p->name))
- {
- /* Exact match found. */
- pfound = p;
- indfound = option_index;
- exact = 1;
- break;
- }
- else if (pfound == NULL)
- {
- /* First nonexact match found. */
- pfound = p;
- indfound = option_index;
- }
- else
- /* Second or later nonexact match found. */
- ambig = 1;
- }
-
- if (ambig && !exact)
- {
- if (opterr)
- fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
- argv[0], argv[optind]);
- nextchar += strlen (nextchar);
- optind++;
- return '?';
- }
-
- if (pfound != NULL)
- {
- option_index = indfound;
- optind++;
- if (*nameend)
- {
- /* Don't test has_arg with >, because some C compilers don't
- allow it to be used on enums. */
- if (pfound->has_arg)
- optarg = nameend + 1;
- else
- {
- if (opterr)
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
-
- nextchar += strlen (nextchar);
- return '?';
- }
- }
- else if (pfound->has_arg == 1)
- {
- if (optind < argc)
- optarg = argv[optind++];
- else
- {
- if (opterr)
- fprintf (stderr,
- _("%s: option `%s' requires an argument\n"),
- argv[0], argv[optind - 1]);
- nextchar += strlen (nextchar);
- return optstring[0] == ':' ? ':' : '?';
- }
- }
- nextchar += strlen (nextchar);
- if (longind != NULL)
- *longind = option_index;
- if (pfound->flag)
- {
- *(pfound->flag) = pfound->val;
- return 0;
- }
- return pfound->val;
- }
-
- /* Can't find it as a long option. If this is not getopt_long_only,
- or the option starts with '--' or is not a valid short
- option, then it's an error.
- Otherwise interpret it as a short option. */
- if (!long_only || argv[optind][1] == '-'
- || my_index (optstring, *nextchar) == NULL)
- {
- if (opterr)
- {
- if (argv[optind][1] == '-')
- /* --option */
- fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
- argv[0], nextchar);
- else
- /* +option or -option */
- fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
- argv[0], argv[optind][0], nextchar);
- }
- nextchar = (char *) "";
- optind++;
- return '?';
- }
- }
-
- /* Look at and handle the next short option-character. */
-
- {
- char c = *nextchar++;
- char *temp = my_index (optstring, c);
-
- /* Increment `optind' when we start to process its last character. */
- if (*nextchar == '\0')
- ++optind;
-
- if (temp == NULL || c == ':')
- {
- if (opterr)
- {
- if (posixly_correct)
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr, _("%s: illegal option -- %c\n"),
- argv[0], c);
- else
- fprintf (stderr, _("%s: invalid option -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- return '?';
- }
- if (temp[1] == ':')
- {
- if (temp[2] == ':')
- {
- /* This is an option that accepts an argument optionally. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- optind++;
- }
- else
- optarg = NULL;
- nextchar = NULL;
- }
- else
- {
- /* This is an option that requires an argument. */
- if (*nextchar != '\0')
- {
- optarg = nextchar;
- /* If we end this ARGV-element by taking the rest as an arg,
- we must advance to the next element now. */
- optind++;
- }
- else if (optind == argc)
- {
- if (opterr)
- {
- /* 1003.2 specifies the format of this message. */
- fprintf (stderr,
- _("%s: option requires an argument -- %c\n"),
- argv[0], c);
- }
- optopt = c;
- if (optstring[0] == ':')
- c = ':';
- else
- c = '?';
- }
- else
- /* We already incremented `optind' once;
- increment it again when taking next ARGV-elt as argument. */
- optarg = argv[optind++];
- nextchar = NULL;
- }
- }
- return c;
- }
-}
-
-int
-getopt (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
-{
- return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
-}
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
-
-#ifdef TEST
-
-/* Compile with -DTEST to make an executable for use in testing
- the above definition of `getopt'. */
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
-
- c = getopt (argc, argv, "abc:d:0123456789");
- if (c == EOF)
- break;
-
- switch (c)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/contrib/cpio/getopt.h b/contrib/cpio/getopt.h
deleted file mode 100644
index 4ac33b71824d..000000000000
--- a/contrib/cpio/getopt.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Declarations for getopt.
- Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef _GETOPT_H
-#define _GETOPT_H 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* For communication from `getopt' to the caller.
- When `getopt' finds an option that takes an argument,
- the argument value is returned here.
- Also, when `ordering' is RETURN_IN_ORDER,
- each non-option ARGV-element is returned here. */
-
-extern char *optarg;
-
-/* Index in ARGV of the next element to be scanned.
- This is used for communication to and from the caller
- and for communication between successive calls to `getopt'.
-
- On entry to `getopt', zero means this is the first call; initialize.
-
- When `getopt' returns EOF, this is the index of the first of the
- non-option elements that the caller should itself scan.
-
- Otherwise, `optind' communicates from one call to the next
- how much of ARGV has been scanned so far. */
-
-extern int optind;
-
-/* Callers store zero here to inhibit the error message `getopt' prints
- for unrecognized options. */
-
-extern int opterr;
-
-/* Set to an option character which was unrecognized. */
-
-extern int optopt;
-
-/* Describe the long-named options requested by the application.
- The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
- of `struct option' terminated by an element containing a name which is
- zero.
-
- The field `has_arg' is:
- no_argument (or 0) if the option does not take an argument,
- required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
-
- If the field `flag' is not NULL, it points to a variable that is set
- to the value given in the field `val' when the option is found, but
- left unchanged if the option is not found.
-
- To have a long-named option do something other than set an `int' to
- a compiled-in constant, such as set a value from `optarg', set the
- option's `flag' field to zero and its `val' field to a nonzero
- value (the equivalent single-letter option character, if there is
- one). For long options that have a zero `flag' field, `getopt'
- returns the contents of the `val' field. */
-
-struct option
-{
-#if defined (__STDC__) && __STDC__
- const char *name;
-#else
- char *name;
-#endif
- /* has_arg can't be an enum because some compilers complain about
- type mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
-};
-
-/* Names for the values of the `has_arg' field of `struct option'. */
-
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
-
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
-/* Many other libraries have conflicting prototypes for getopt, with
- differences in the consts, in stdlib.h. To avoid compilation
- errors, only prototype getopt for the GNU C library. */
-extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
-#endif /* __GNU_LIBRARY__ */
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind);
-
-/* Internal only. Users should not call this directly. */
-extern int _getopt_internal (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
-#else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-#endif /* __STDC__ */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GETOPT_H */
diff --git a/contrib/cpio/getopt1.c b/contrib/cpio/getopt1.c
deleted file mode 100644
index 4580211cfac3..000000000000
--- a/contrib/cpio/getopt1.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
- Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 2, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "getopt.h"
-
-#if !defined (__STDC__) || !__STDC__
-/* This is a separate conditional since some stdc systems
- reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
-#endif
-
-#include <stdio.h>
-
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
-
-
-/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
-#include <stdlib.h>
-#else
-char *getenv ();
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-int
-getopt_long (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
-}
-
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
- If an option that starts with '-' (not '--') doesn't match a long option,
- but does match a short option, it is parsed as a short option
- instead. */
-
-int
-getopt_long_only (argc, argv, options, long_options, opt_index)
- int argc;
- char *const *argv;
- const char *options;
- const struct option *long_options;
- int *opt_index;
-{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
-}
-
-
-#endif /* _LIBC or not __GNU_LIBRARY__. */
-
-#ifdef TEST
-
-#include <stdio.h>
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- int c;
- int digit_optind = 0;
-
- while (1)
- {
- int this_option_optind = optind ? optind : 1;
- int option_index = 0;
- static struct option long_options[] =
- {
- {"add", 1, 0, 0},
- {"append", 0, 0, 0},
- {"delete", 1, 0, 0},
- {"verbose", 0, 0, 0},
- {"create", 0, 0, 0},
- {"file", 1, 0, 0},
- {0, 0, 0, 0}
- };
-
- c = getopt_long (argc, argv, "abc:d:0123456789",
- long_options, &option_index);
- if (c == EOF)
- break;
-
- switch (c)
- {
- case 0:
- printf ("option %s", long_options[option_index].name);
- if (optarg)
- printf (" with arg %s", optarg);
- printf ("\n");
- break;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (digit_optind != 0 && digit_optind != this_option_optind)
- printf ("digits occur in two different argv-elements.\n");
- digit_optind = this_option_optind;
- printf ("option %c\n", c);
- break;
-
- case 'a':
- printf ("option a\n");
- break;
-
- case 'b':
- printf ("option b\n");
- break;
-
- case 'c':
- printf ("option c with value `%s'\n", optarg);
- break;
-
- case 'd':
- printf ("option d with value `%s'\n", optarg);
- break;
-
- case '?':
- break;
-
- default:
- printf ("?? getopt returned character code 0%o ??\n", c);
- }
- }
-
- if (optind < argc)
- {
- printf ("non-option ARGV-elements: ");
- while (optind < argc)
- printf ("%s ", argv[optind++]);
- printf ("\n");
- }
-
- exit (0);
-}
-
-#endif /* TEST */
diff --git a/contrib/cpio/global.c b/contrib/cpio/global.c
deleted file mode 100644
index 7fb66b2fa698..000000000000
--- a/contrib/cpio/global.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* global.c - global variables and initial values for cpio.
- Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <sys/types.h>
-#include "cpiohdr.h"
-#include "dstring.h"
-#include "system.h"
-#include "extern.h"
-
-/* If TRUE, reset access times after reading files (-a). */
-int reset_time_flag = FALSE;
-
-/* Block size value, initially 512. -B sets to 5120. */
-int io_block_size = 512;
-
-/* The header format to recognize and produce. */
-enum archive_format archive_format = arf_unknown;
-
-/* If TRUE, create directories as needed. (-d with -i or -p) */
-int create_dir_flag = FALSE;
-
-/* If TRUE, interactively rename files. (-r) */
-int rename_flag = FALSE;
-
-/* If non-NULL, the name of a file that will be read to
- rename all of the files in the archive. --rename-batch-file. */
-char *rename_batch_file = NULL;
-
-/* If TRUE, print a table of contents of input. (-t) */
-int table_flag = FALSE;
-
-/* If TRUE, copy unconditionally (older replaces newer). (-u) */
-int unconditional_flag = FALSE;
-
-/* If TRUE, list the files processed, or ls -l style output with -t. (-v) */
-int verbose_flag = FALSE;
-
-/* If TRUE, print a . for each file processed. (-V) */
-int dot_flag = FALSE;
-
-/* If TRUE, link files whenever possible. Used with -p option. (-l) */
-int link_flag = FALSE;
-
-/* If TRUE, retain previous file modification time. (-m) */
-int retain_time_flag = FALSE;
-
-/* Set TRUE if crc_flag is TRUE and we are doing a cpio -i. Used
- by copy_files so it knows whether to compute the crc. */
-int crc_i_flag = FALSE;
-
-/* If TRUE, append to end of archive. (-A) */
-int append_flag = FALSE;
-
-/* If TRUE, swap bytes of each file during cpio -i. */
-int swap_bytes_flag = FALSE;
-
-/* If TRUE, swap halfwords of each file during cpio -i. */
-int swap_halfwords_flag = FALSE;
-
-/* If TRUE, we are swapping halfwords on the current file. */
-int swapping_halfwords = FALSE;
-
-/* If TRUE, we are swapping bytes on the current file. */
-int swapping_bytes = FALSE;
-
-/* If TRUE, set ownership of all files to UID `set_owner'. */
-int set_owner_flag = FALSE;
-uid_t set_owner;
-
-/* If TRUE, set group ownership of all files to GID `set_group'. */
-int set_group_flag = FALSE;
-gid_t set_group;
-
-/* If TRUE, do not chown the files. */
-int no_chown_flag = FALSE;
-
-/* If TRUE, try to write sparse ("holey") files. */
-int sparse_flag = FALSE;
-
-/* If TRUE, don't report number of blocks copied. */
-int quiet_flag = FALSE;
-
-/* If TRUE, only read the archive and verify the files' CRC's, don't
- actually extract the files. */
-int only_verify_crc_flag = FALSE;
-
-/* If TRUE, don't use any absolute paths, prefix them by `./'. */
-int no_abs_paths_flag = FALSE;
-
-#ifdef DEBUG_CPIO
-/* If TRUE, print debugging information. */
-int debug_flag = FALSE;
-#endif
-
-/* File position of last header read. Only used during -A to determine
- where the old TRAILER!!! record started. */
-int last_header_start = 0;
-
-/* With -i; if TRUE, copy only files that match any of the given patterns;
- if FALSE, copy only files that do not match any of the patterns. (-f) */
-int copy_matching_files = TRUE;
-
-/* With -itv; if TRUE, list numeric uid and gid instead of translating them
- into names. */
-int numeric_uid = FALSE;
-
-/* Name of file containing additional patterns (-E). */
-char *pattern_file_name = NULL;
-
-/* Message to print when end of medium is reached (-M). */
-char *new_media_message = NULL;
-
-/* With -M with %d, message to print when end of medium is reached. */
-char *new_media_message_with_number = NULL;
-char *new_media_message_after_number = NULL;
-
-/* File descriptor containing the archive. */
-int archive_des;
-
-/* Name of file containing the archive, if known; NULL if stdin/out. */
-char *archive_name = NULL;
-
-/* CRC checksum. */
-unsigned long crc;
-
-/* Input and output buffers. */
-char *input_buffer, *output_buffer;
-
-/* The size of the input buffer. */
-long input_buffer_size;
-
-/* Current locations in `input_buffer' and `output_buffer'. */
-char *in_buff, *out_buff;
-
-/* Current number of bytes stored at `input_buff' and `output_buff'. */
-long input_size, output_size;
-
-/* Total number of bytes read and written for all files.
- Now that many tape drives hold more than 4Gb we need more than 32
- bits to hold input_bytes and output_bytes. But it's not worth
- the trouble of adding special multi-precision arithmetic if the
- compiler doesn't support 64 bit ints since input_bytes and
- output_bytes are only used to print the number of blocks copied. */
-#ifdef __GNUC__
-long long input_bytes, output_bytes;
-#else
-long input_bytes, output_bytes;
-#endif
-
-/* 512 bytes of 0; used for various padding operations. */
-char zeros_512[512];
-
-/* Saving of argument values for later reference. */
-char *directory_name = NULL;
-char **save_patterns;
-int num_patterns;
-
-/* Character that terminates file names read from stdin. */
-char name_end = '\n';
-
-/* TRUE if input (cpio -i) or output (cpio -o) is a device node. */
-char input_is_special = FALSE;
-char output_is_special = FALSE;
-
-/* TRUE if lseek works on the input. */
-char input_is_seekable = FALSE;
-
-/* TRUE if lseek works on the output. */
-char output_is_seekable = FALSE;
-
-/* If nonzero, don't consider file names that contain a `:' to be
- on remote hosts; all files are local. */
-int f_force_local = 0;
-
-/* The name this program was run with. */
-char *program_name;
-
-/* A pointer to either lstat or stat, depending on whether
- dereferencing of symlinks is done for input files. */
-int (*xstat) ();
-
-/* Which copy operation to perform. (-i, -o, -p) */
-void (*copy_function) () = 0;
diff --git a/contrib/cpio/idcache.c b/contrib/cpio/idcache.c
deleted file mode 100644
index 34dcc07c56a8..000000000000
--- a/contrib/cpio/idcache.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* idcache.c -- map user and group IDs, cached for speed
- Copyright (C) 1985, 1988, 1989, 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
-
-#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifndef _POSIX_VERSION
-struct passwd *getpwuid ();
-struct passwd *getpwnam ();
-struct group *getgrgid ();
-struct group *getgrnam ();
-#endif
-
-char *xmalloc ();
-char *xstrdup ();
-
-struct userid
-{
- union
- {
- uid_t u;
- gid_t g;
- } id;
- char *name;
- struct userid *next;
-};
-
-static struct userid *user_alist;
-
-/* The members of this list have names not in the local passwd file. */
-static struct userid *nouser_alist;
-
-/* Translate UID to a login name or a stringified number,
- with cache. */
-
-char *
-getuser (uid)
- uid_t uid;
-{
- register struct userid *tail;
- struct passwd *pwent;
- char usernum_string[20];
-
- for (tail = user_alist; tail; tail = tail->next)
- if (tail->id.u == uid)
- return tail->name;
-
- pwent = getpwuid (uid);
- tail = (struct userid *) xmalloc (sizeof (struct userid));
- tail->id.u = uid;
- if (pwent == 0)
- {
- sprintf (usernum_string, "%u", (unsigned) uid);
- tail->name = xstrdup (usernum_string);
- }
- else
- tail->name = xstrdup (pwent->pw_name);
-
- /* Add to the head of the list, so most recently used is first. */
- tail->next = user_alist;
- user_alist = tail;
- return tail->name;
-}
-
-/* Translate USER to a UID, with cache.
- Return NULL if there is no such user.
- (We also cache which user names have no passwd entry,
- so we don't keep looking them up.) */
-
-uid_t *
-getuidbyname (user)
- char *user;
-{
- register struct userid *tail;
- struct passwd *pwent;
-
- for (tail = user_alist; tail; tail = tail->next)
- /* Avoid a function call for the most common case. */
- if (*tail->name == *user && !strcmp (tail->name, user))
- return &tail->id.u;
-
- for (tail = nouser_alist; tail; tail = tail->next)
- /* Avoid a function call for the most common case. */
- if (*tail->name == *user && !strcmp (tail->name, user))
- return 0;
-
- pwent = getpwnam (user);
-
- tail = (struct userid *) xmalloc (sizeof (struct userid));
- tail->name = xstrdup (user);
-
- /* Add to the head of the list, so most recently used is first. */
- if (pwent)
- {
- tail->id.u = pwent->pw_uid;
- tail->next = user_alist;
- user_alist = tail;
- return &tail->id.u;
- }
-
- tail->next = nouser_alist;
- nouser_alist = tail;
- return 0;
-}
-
-/* Use the same struct as for userids. */
-static struct userid *group_alist;
-static struct userid *nogroup_alist;
-
-/* Translate GID to a group name or a stringified number,
- with cache. */
-
-char *
-getgroup (gid)
- gid_t gid;
-{
- register struct userid *tail;
- struct group *grent;
- char groupnum_string[20];
-
- for (tail = group_alist; tail; tail = tail->next)
- if (tail->id.g == gid)
- return tail->name;
-
- grent = getgrgid (gid);
- tail = (struct userid *) xmalloc (sizeof (struct userid));
- tail->id.g = gid;
- if (grent == 0)
- {
- sprintf (groupnum_string, "%u", (unsigned int) gid);
- tail->name = xstrdup (groupnum_string);
- }
- else
- tail->name = xstrdup (grent->gr_name);
-
- /* Add to the head of the list, so most recently used is first. */
- tail->next = group_alist;
- group_alist = tail;
- return tail->name;
-}
-
-/* Translate GROUP to a UID, with cache.
- Return NULL if there is no such group.
- (We also cache which group names have no group entry,
- so we don't keep looking them up.) */
-
-gid_t *
-getgidbyname (group)
- char *group;
-{
- register struct userid *tail;
- struct group *grent;
-
- for (tail = group_alist; tail; tail = tail->next)
- /* Avoid a function call for the most common case. */
- if (*tail->name == *group && !strcmp (tail->name, group))
- return &tail->id.g;
-
- for (tail = nogroup_alist; tail; tail = tail->next)
- /* Avoid a function call for the most common case. */
- if (*tail->name == *group && !strcmp (tail->name, group))
- return 0;
-
- grent = getgrnam (group);
-
- tail = (struct userid *) xmalloc (sizeof (struct userid));
- tail->name = xstrdup (group);
-
- /* Add to the head of the list, so most recently used is first. */
- if (grent)
- {
- tail->id.g = grent->gr_gid;
- tail->next = group_alist;
- group_alist = tail;
- return &tail->id.g;
- }
-
- tail->next = nogroup_alist;
- nogroup_alist = tail;
- return 0;
-}
diff --git a/contrib/cpio/main.c b/contrib/cpio/main.c
deleted file mode 100644
index bba4d3222d2a..000000000000
--- a/contrib/cpio/main.c
+++ /dev/null
@@ -1,531 +0,0 @@
-/* main.c - main program and argument processing for cpio.
- Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Written by Phil Nelson <phil@cs.wwu.edu>,
- David MacKenzie <djm@gnu.ai.mit.edu>,
- and John Oleynick <juo@klinzhai.rutgers.edu>. */
-
-#include <stdio.h>
-#include <getopt.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#if (defined(BSD) && (BSD >= 199306))
-#include <locale.h>
-#endif
-#include "filetypes.h"
-#include "system.h"
-#include "cpiohdr.h"
-#include "dstring.h"
-#include "extern.h"
-#include "rmt.h"
-
-struct option long_opts[] =
-{
- {"null", 0, 0, '0'},
- {"append", 0, 0, 'A'},
- {"block-size", 1, 0, 130},
- {"create", 0, 0, 'o'},
- {"dereference", 0, 0, 'L'},
- {"dot", 0, 0, 'V'},
- {"extract", 0, 0, 'i'},
- {"file", 1, 0, 'F'},
- {"force-local", 0, &f_force_local, 1},
- {"format", 1, 0, 'H'},
- {"help", 0, 0, 132},
- {"io-size", 1, 0, 'C'},
- {"link", 0, &link_flag, TRUE},
- {"list", 0, &table_flag, TRUE},
- {"make-directories", 0, &create_dir_flag, TRUE},
- {"message", 1, 0, 'M'},
- {"no-absolute-filenames", 0, 0, 136},
- {"no-preserve-owner", 0, 0, 134},
- {"nonmatching", 0, &copy_matching_files, FALSE},
- {"numeric-uid-gid", 0, &numeric_uid, TRUE},
- {"only-verify-crc", 0, 0, 139},
- {"owner", 1, 0, 'R'},
- {"pass-through", 0, 0, 'p'},
- {"pattern-file", 1, 0, 'E'},
- {"preserve-modification-time", 0, &retain_time_flag, TRUE},
- {"rename", 0, &rename_flag, TRUE},
- {"rename-batch-file", 1, 0, 137},
- {"quiet", 0, 0, 138},
- {"sparse", 0, 0, 135},
- {"swap", 0, 0, 'b'},
- {"swap-bytes", 0, 0, 's'},
- {"swap-halfwords", 0, 0, 'S'},
- {"reset-access-time", 0, &reset_time_flag, TRUE},
- {"unconditional", 0, &unconditional_flag, TRUE},
- {"verbose", 0, &verbose_flag, TRUE},
- {"version", 0, 0, 131},
-#ifdef DEBUG_CPIO
- {"debug", 0, &debug_flag, TRUE},
-#endif
- {0, 0, 0, 0}
-};
-
-/* Print usage message and exit with error. */
-
-void
-usage (fp, status)
- FILE *fp;
- int status;
-{
- fprintf (fp, "\
-Usage: %s {-o|--create} [-0acvABLV] [-C bytes] [-H format] [-M message]\n\
- [-O [[user@]host:]archive] [-F [[user@]host:]archive]\n\
- [--file=[[user@]host:]archive] [--format=format] [--message=message]\n\
- [--null] [--reset-access-time] [--verbose] [--dot] [--append]\n\
- [--block-size=blocks] [--dereference] [--io-size=bytes] [--quiet]\n\
- [--force-local] [--help] [--version] < name-list [> archive]\n", program_name);
- fprintf (fp, "\
- %s {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file] [-H format]\n\
- [-M message] [-R [user][:.][group]] [-I [[user@]host:]archive]\n\
- [-F [[user@]host:]archive] [--file=[[user@]host:]archive]\n\
- [--make-directories] [--nonmatching] [--preserve-modification-time]\n\
- [--numeric-uid-gid] [--rename] [--list] [--swap-bytes] [--swap] [--dot]\n\
- [--unconditional] [--verbose] [--block-size=blocks] [--swap-halfwords]\n\
- [--io-size=bytes] [--pattern-file=file] [--format=format]\n\
- [--owner=[user][:.][group]] [--no-preserve-owner] [--message=message]\n\
- [--force-local] [--no-absolute-filenames] [--sparse] [--only-verify-crc]\n\
- [--quiet] [--help] [--version] [pattern...] [< archive]\n",
- program_name);
- fprintf (fp, "\
- %s {-p|--pass-through} [-0adlmuvLV] [-R [user][:.][group]]\n\
- [--null] [--reset-access-time] [--make-directories] [--link] [--quiet]\n\
- [--preserve-modification-time] [--unconditional] [--verbose] [--dot]\n\
- [--dereference] [--owner=[user][:.][group]] [--no-preserve-owner]\n\
- [--sparse] [--help] [--version] destination-directory < name-list\n", program_name);
- exit (status);
-}
-
-/* Process the arguments. Set all options and set up the copy pass
- directory or the copy in patterns. */
-
-void
-process_args (argc, argv)
- int argc;
- char *argv[];
-{
- extern char *version_string;
- void (*copy_in) (); /* Work around for pcc bug. */
- void (*copy_out) ();
- int c;
- char *input_archive_name = 0;
- char *output_archive_name = 0;
-
- if (argc < 2)
- usage (stderr, 2);
-
- xstat = lstat;
-
- while ((c = getopt_long (argc, argv,
- "0aAbBcC:dfE:F:H:iI:lLmM:noO:prR:sStuvVz",
- long_opts, (int *) 0)) != -1)
- {
- switch (c)
- {
- case 0: /* A long option that just sets a flag. */
- break;
-
- case '0': /* Read null-terminated filenames. */
- name_end = '\0';
- break;
-
- case 'a': /* Reset access times. */
- reset_time_flag = TRUE;
- break;
-
- case 'A': /* Append to the archive. */
- append_flag = TRUE;
- break;
-
- case 'b': /* Swap bytes and halfwords. */
- swap_bytes_flag = TRUE;
- swap_halfwords_flag = TRUE;
- break;
-
- case 'B': /* Set block size to 5120. */
- io_block_size = 5120;
- break;
-
- case 130: /* --block-size */
- io_block_size = atoi (optarg);
- if (io_block_size < 1)
- error (2, 0, "invalid block size");
- io_block_size *= 512;
- break;
-
- case 'c': /* Use the old portable ASCII format. */
- if (archive_format != arf_unknown)
- usage (stderr, 2);
-#ifdef SVR4_COMPAT
- archive_format = arf_newascii; /* -H newc. */
-#else
- archive_format = arf_oldascii; /* -H odc. */
-#endif
- break;
-
- case 'C': /* Block size. */
- io_block_size = atoi (optarg);
- if (io_block_size < 1)
- error (2, 0, "invalid block size");
- break;
-
- case 'd': /* Create directories where needed. */
- create_dir_flag = TRUE;
- break;
-
- case 'f': /* Only copy files not matching patterns. */
- copy_matching_files = FALSE;
- break;
-
- case 'E': /* Pattern file name. */
- pattern_file_name = optarg;
- break;
-
- case 'F': /* Archive file name. */
- archive_name = optarg;
- break;
-
- case 'H': /* Header format name. */
- if (archive_format != arf_unknown)
- usage (stderr, 2);
- if (!strcmp (optarg, "crc") || !strcmp (optarg, "CRC"))
- archive_format = arf_crcascii;
- else if (!strcmp (optarg, "newc") || !strcmp (optarg, "NEWC"))
- archive_format = arf_newascii;
- else if (!strcmp (optarg, "odc") || !strcmp (optarg, "ODC"))
- archive_format = arf_oldascii;
- else if (!strcmp (optarg, "bin") || !strcmp (optarg, "BIN"))
- archive_format = arf_binary;
- else if (!strcmp (optarg, "ustar") || !strcmp (optarg, "USTAR"))
- archive_format = arf_ustar;
- else if (!strcmp (optarg, "tar") || !strcmp (optarg, "TAR"))
- archive_format = arf_tar;
- else if (!strcmp (optarg, "hpodc") || !strcmp (optarg, "HPODC"))
- archive_format = arf_hpoldascii;
- else if (!strcmp (optarg, "hpbin") || !strcmp (optarg, "HPBIN"))
- archive_format = arf_hpbinary;
- else
- error (2, 0, "\
-invalid archive format `%s'; valid formats are:\n\
-crc newc odc bin ustar tar (all-caps also recognized)", optarg);
- break;
-
- case 'i': /* Copy-in mode. */
- if (copy_function != 0)
- usage (stderr, 2);
- copy_function = process_copy_in;
- break;
-
- case 'I': /* Input archive file name. */
- input_archive_name = optarg;
- break;
-
- case 'k': /* Handle corrupted archives. We always handle
- corrupted archives, but recognize this
- option for compatability. */
- break;
-
- case 'l': /* Link files when possible. */
- link_flag = TRUE;
- break;
-
- case 'L': /* Dereference symbolic links. */
- xstat = stat;
- break;
-
- case 'm': /* Retain previous file modify times. */
- retain_time_flag = TRUE;
- break;
-
- case 'M': /* New media message. */
- set_new_media_message (optarg);
- break;
-
- case 'n': /* Long list owner and group as numbers. */
- numeric_uid = TRUE;
- break;
-
- case 136: /* --no-absolute-filenames */
- no_abs_paths_flag = TRUE;
- break;
-
- case 134: /* --no-preserve-owner */
- if (set_owner_flag || set_group_flag)
- usage (stderr, 2);
- no_chown_flag = TRUE;
- break;
-
- case 'o': /* Copy-out mode. */
- if (copy_function != 0)
- usage (stderr, 2);
- copy_function = process_copy_out;
- break;
-
- case 'O': /* Output archive file name. */
- output_archive_name = optarg;
- break;
-
- case 139:
- only_verify_crc_flag = TRUE;
- break;
-
- case 'p': /* Copy-pass mode. */
- if (copy_function != 0)
- usage (stderr, 2);
- copy_function = process_copy_pass;
- break;
-
- case 'r': /* Interactively rename. */
- rename_flag = TRUE;
- break;
-
- case 137:
- rename_batch_file = optarg;
- break;
-
- case 138:
- quiet_flag = TRUE;
- break;
-
- case 'R': /* Set the owner. */
- if (no_chown_flag)
- usage (stderr, 2);
-#ifndef __MSDOS__
- {
- char *e, *u, *g;
-
- e = parse_user_spec (optarg, &set_owner, &set_group, &u, &g);
- if (e)
- error (2, 0, "%s: %s", optarg, e);
- if (u)
- {
- free (u);
- set_owner_flag = TRUE;
- }
- if (g)
- {
- free (g);
- set_group_flag = TRUE;
- }
- }
-#endif
- break;
-
- case 's': /* Swap bytes. */
- swap_bytes_flag = TRUE;
- break;
-
- case 'S': /* Swap halfwords. */
- swap_halfwords_flag = TRUE;
- break;
-
- case 't': /* Only print a list. */
- table_flag = TRUE;
- break;
-
- case 'u': /* Replace all! Unconditionally! */
- unconditional_flag = TRUE;
- break;
-
- case 'v': /* Verbose! */
- verbose_flag = TRUE;
- break;
-
- case 'V': /* Print `.' for each file. */
- dot_flag = TRUE;
- break;
-
- case 131:
- printf ("GNU cpio %s", version_string);
- exit (0);
- break;
-
- case 135:
- sparse_flag = TRUE;
- break;
-
- case 132: /* --help */
- usage (stdout, 0);
- break;
-
- default:
- usage (stderr, 2);
- }
- }
-
- /* Do error checking and look at other args. */
-
- if (copy_function == 0)
- {
- if (table_flag)
- copy_function = process_copy_in;
- else
- usage (stderr, 2);
- }
-
- if ((!table_flag || !verbose_flag) && numeric_uid)
- usage (stderr, 2);
-
- /* Work around for pcc bug. */
- copy_in = process_copy_in;
- copy_out = process_copy_out;
-
- if (copy_function == copy_in)
- {
- archive_des = 0;
- if (link_flag || reset_time_flag || xstat != lstat || append_flag
- || sparse_flag
- || output_archive_name
- || (archive_name && input_archive_name))
- usage (stderr, 2);
- if (archive_format == arf_crcascii)
- crc_i_flag = TRUE;
- num_patterns = argc - optind;
- save_patterns = &argv[optind];
- if (input_archive_name)
- archive_name = input_archive_name;
- }
- else if (copy_function == copy_out)
- {
- archive_des = 1;
- if (argc != optind || create_dir_flag || rename_flag
- || table_flag || unconditional_flag || link_flag
- || retain_time_flag || no_chown_flag || set_owner_flag
- || set_group_flag || swap_bytes_flag || swap_halfwords_flag
- || (append_flag && !(archive_name || output_archive_name))
- || rename_batch_file || no_abs_paths_flag
- || input_archive_name || (archive_name && output_archive_name))
- usage (stderr, 2);
- if (archive_format == arf_unknown)
- archive_format = arf_binary;
- if (output_archive_name)
- archive_name = output_archive_name;
- }
- else
- {
- /* Copy pass. */
- archive_des = -1;
- if (argc - 1 != optind || archive_format != arf_unknown
- || swap_bytes_flag || swap_halfwords_flag
- || table_flag || rename_flag || append_flag
- || rename_batch_file || no_abs_paths_flag)
- usage (stderr, 2);
- directory_name = argv[optind];
- }
-
- if (archive_name)
- {
- if (copy_function != copy_in && copy_function != copy_out)
- usage (stderr, 2);
- archive_des = open_archive (archive_name);
- if (archive_des < 0)
- error (1, errno, "%s", archive_name);
- }
-
-#ifndef __MSDOS__
- /* Prevent SysV non-root users from giving away files inadvertantly.
- This happens automatically on BSD, where only root can give
- away files. */
- if (set_owner_flag == FALSE && set_group_flag == FALSE && geteuid ())
- no_chown_flag = TRUE;
-#endif
-}
-
-/* Initialize the input and output buffers to their proper size and
- initialize all variables associated with the input and output
- buffers. */
-
-void
-initialize_buffers ()
-{
- int in_buf_size, out_buf_size;
-
- if (copy_function == process_copy_in)
- {
- /* Make sure the input buffer can always hold 2 blocks and that it
- is big enough to hold 1 tar record (512 bytes) even if it
- is not aligned on a block boundary. The extra buffer space
- is needed by process_copyin and peek_in_buf to automatically
- figure out what kind of archive it is reading. */
- if (io_block_size >= 512)
- in_buf_size = 2 * io_block_size;
- else
- in_buf_size = 1024;
- out_buf_size = DISK_IO_BLOCK_SIZE;
- }
- else if (copy_function == process_copy_out)
- {
- in_buf_size = DISK_IO_BLOCK_SIZE;
- out_buf_size = io_block_size;
- }
- else
- {
- in_buf_size = DISK_IO_BLOCK_SIZE;
- out_buf_size = DISK_IO_BLOCK_SIZE;
- }
-
- input_buffer = (char *) xmalloc (in_buf_size);
- in_buff = input_buffer;
- input_buffer_size = in_buf_size;
- input_size = 0;
- input_bytes = 0;
-
- output_buffer = (char *) xmalloc (out_buf_size);
- out_buff = output_buffer;
- output_size = 0;
- output_bytes = 0;
-
- /* Clear the block of zeros. */
- bzero (zeros_512, 512);
-}
-
-void
-main (argc, argv)
- int argc;
- char *argv[];
-{
- program_name = argv[0];
-
-#if (defined(BSD) && (BSD >= 199306))
- (void) setlocale (LC_ALL, "");
-#endif
-
-#ifdef __TURBOC__
- _fmode = O_BINARY; /* Put stdin and stdout in binary mode. */
-#endif
-#ifdef __EMX__ /* gcc on OS/2. */
- _response (&argc, &argv);
- _wildcard (&argc, &argv);
-#endif
-
- process_args (argc, argv);
- umask (0);
-
- initialize_buffers ();
-
- (*copy_function) ();
-
- if (archive_des >= 0 && rmtclose (archive_des) == -1)
- error (1, errno, "error closing archive");
-
- exit (0);
-}
diff --git a/contrib/cpio/makepath.c b/contrib/cpio/makepath.c
deleted file mode 100644
index fc47871868c6..000000000000
--- a/contrib/cpio/makepath.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* makepath.c -- Ensure that a directory path exists.
- Copyright (C) 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu> and
- Jim Meyering <meyering@cs.utexas.edu>. */
-
-/* This copy of makepath is almost like the fileutils one, but has
- changes for HPUX CDF's. Maybe the 2 versions of makepath can
- come together again in the future. */
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#else
-char *alloca ();
-#endif
-#endif
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-
-#include <errno.h>
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#else
-extern int errno;
-#endif
-
-#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#ifndef index
-#define index strchr
-#endif
-#else
-#include <strings.h>
-#endif
-
-#if defined(__MSDOS__) && !defined(__GNUC__)
-typedef int uid_t;
-typedef int gid_t;
-#endif
-
-void error ();
-
-/* Ensure that the directory ARGPATH exists.
- Remove any trailing slashes from ARGPATH before calling this function.
-
- Make any leading directories that don't already exist, with
- permissions PARENT_MODE.
- If the last element of ARGPATH does not exist, create it as
- a new directory with permissions MODE.
- If OWNER and GROUP are non-negative, make them the UID and GID of
- created directories.
- If VERBOSE_FMT_STRING is nonzero, use it as a printf format
- string for printing a message after successfully making a directory,
- with the name of the directory that was just made as an argument.
-
- Return 0 if ARGPATH exists as a directory with the proper
- ownership and permissions when done, otherwise 1. */
-
-int
-make_path (argpath, mode, parent_mode, owner, group, verbose_fmt_string)
- char *argpath;
- int mode;
- int parent_mode;
- uid_t owner;
- gid_t group;
- char *verbose_fmt_string;
-{
- char *dirpath; /* A copy we can scribble NULs on. */
- struct stat stats;
- int retval = 0;
- int oldmask = umask (0);
- dirpath = alloca (strlen (argpath) + 1);
- strcpy (dirpath, argpath);
-
- if (stat (dirpath, &stats))
- {
- char *slash;
- int tmp_mode; /* Initial perms for leading dirs. */
- int re_protect; /* Should leading dirs be unwritable? */
- struct ptr_list
- {
- char *dirname_end;
- struct ptr_list *next;
- };
- struct ptr_list *p, *leading_dirs = NULL;
-
- /* If leading directories shouldn't be writable or executable,
- or should have set[ug]id or sticky bits set and we are setting
- their owners, we need to fix their permissions after making them. */
- if (((parent_mode & 0300) != 0300)
- || (owner != (uid_t) -1 && group != (gid_t) -1
- && (parent_mode & 07000) != 0))
- {
- tmp_mode = 0700;
- re_protect = 1;
- }
- else
- {
- tmp_mode = parent_mode;
- re_protect = 0;
- }
-
- slash = dirpath;
- while (*slash == '/')
- slash++;
- while ((slash = index (slash, '/')))
- {
-#ifdef HPUX_CDF
- int iscdf;
- iscdf = 0;
-#endif
- *slash = '\0';
- if (stat (dirpath, &stats))
- {
-#ifdef HPUX_CDF
- /* If this component of the pathname ends in `+' and is
- followed by 2 `/'s, then this is a CDF. We remove the
- `+' from the name and create the directory. Later
- we will "hide" the directory. */
- if ( (*(slash +1) == '/') && (*(slash -1) == '+') )
- {
- iscdf = 1;
- *(slash -1) = '\0';
- }
-#endif
- if (mkdir (dirpath, tmp_mode))
- {
- error (0, errno, "cannot make directory `%s'", dirpath);
- umask (oldmask);
- return 1;
- }
- else
- {
- if (verbose_fmt_string != NULL)
- error (0, 0, verbose_fmt_string, dirpath);
-
- if (owner != (uid_t) -1 && group != (gid_t) -1
- && chown (dirpath, owner, group)
-#ifdef AFS
- && errno != EPERM
-#endif
- )
- {
- error (0, errno, "%s", dirpath);
- retval = 1;
- }
- if (re_protect)
- {
- struct ptr_list *new = (struct ptr_list *)
- alloca (sizeof (struct ptr_list));
- new->dirname_end = slash;
- new->next = leading_dirs;
- leading_dirs = new;
- }
-#ifdef HPUX_CDF
- if (iscdf)
- {
- /* If this is a CDF, "hide" the directory by setting
- its hidden/setuid bit. Also add the `+' back to
- its name (since once it's "hidden" we must refer
- to as `name+' instead of `name'). */
- chmod (dirpath, 04700);
- *(slash - 1) = '+';
- }
-#endif
- }
- }
- else if (!S_ISDIR (stats.st_mode))
- {
- error (0, 0, "`%s' exists but is not a directory", dirpath);
- umask (oldmask);
- return 1;
- }
-
- *slash++ = '/';
-
- /* Avoid unnecessary calls to `stat' when given
- pathnames containing multiple adjacent slashes. */
- while (*slash == '/')
- slash++;
- }
-
- /* We're done making leading directories.
- Make the final component of the path. */
-
- if (mkdir (dirpath, mode))
- {
- /* In some cases, if the final component in dirpath was `.' then we
- just got an EEXIST error from that last mkdir(). If that's
- the case, ignore it. */
- if ( (errno != EEXIST) ||
- (stat (dirpath, &stats) != 0) ||
- (!S_ISDIR (stats.st_mode) ) )
- {
- error (0, errno, "cannot make directory `%s'", dirpath);
- umask (oldmask);
- return 1;
- }
- }
- if (verbose_fmt_string != NULL)
- error (0, 0, verbose_fmt_string, dirpath);
-
- if (owner != (uid_t) -1 && group != (gid_t) -1)
- {
- if (chown (dirpath, owner, group)
-#ifdef AFS
- && errno != EPERM
-#endif
- )
- {
- error (0, errno, "%s", dirpath);
- retval = 1;
- }
- }
- /* chown may have turned off some permission bits we wanted. */
- if ((mode & 07000) != 0 && chmod (dirpath, mode))
- {
- error (0, errno, "%s", dirpath);
- retval = 1;
- }
-
- /* If the mode for leading directories didn't include owner "wx"
- privileges, we have to reset their protections to the correct
- value. */
- for (p = leading_dirs; p != NULL; p = p->next)
- {
- *(p->dirname_end) = '\0';
-#if 0
- /* cpio always calls make_path with parent mode 0700, so
- we don't have to do this. If we ever do have to do this,
- we have to stat the directory first to get the setuid
- bit so we don't break HP CDF's. */
- if (chmod (dirpath, parent_mode))
- {
- error (0, errno, "%s", dirpath);
- retval = 1;
- }
-#endif
-
- }
- }
- else
- {
- /* We get here if the entire path already exists. */
-
- if (!S_ISDIR (stats.st_mode))
- {
- error (0, 0, "`%s' exists but is not a directory", dirpath);
- umask (oldmask);
- return 1;
- }
-
- /* chown must precede chmod because on some systems,
- chown clears the set[ug]id bits for non-superusers,
- resulting in incorrect permissions.
- On System V, users can give away files with chown and then not
- be able to chmod them. So don't give files away. */
-
- if (owner != (uid_t) -1 && group != (gid_t) -1
- && chown (dirpath, owner, group)
-#ifdef AFS
- && errno != EPERM
-#endif
- )
- {
- error (0, errno, "%s", dirpath);
- retval = 1;
- }
- if (chmod (dirpath, mode))
- {
- error (0, errno, "%s", dirpath);
- retval = 1;
- }
- }
-
- umask (oldmask);
- return retval;
-}
diff --git a/contrib/cpio/rmt.h b/contrib/cpio/rmt.h
deleted file mode 100644
index 2155223954c3..000000000000
--- a/contrib/cpio/rmt.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Definitions for communicating with a remote tape drive.
- Copyright (C) 1988, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#if !defined(_POSIX_VERSION)
-#ifdef __MSDOS__
-#include <io.h>
-#else /* !__MSDOS__ */
-extern off_t lseek ();
-#endif /* __MSDOS__ */
-#endif /* _POSIX_VERSION */
-
-#ifdef NO_REMOTE
-#define _isrmt(f) 0
-#define rmtopen open
-#define rmtaccess access
-#define rmtstat stat
-#define rmtcreat creat
-#define rmtlstat lstat
-#define rmtread read
-#define rmtwrite write
-#define rmtlseek lseek
-#define rmtclose close
-#define rmtioctl ioctl
-#define rmtdup dup
-#define rmtfstat fstat
-#define rmtfcntl fcntl
-#define rmtisatty isatty
-
-#else /* !NO_REMOTE */
-
-#define __REM_BIAS 128
-#define RMTIOCTL
-
-#ifndef O_CREAT
-#define O_CREAT 01000
-#endif
-
-extern char *__rmt_path;
-
-#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#ifndef index
-#define index strchr
-#endif
-#else
-extern char *index ();
-#endif
-
-#define _remdev(path) (!f_force_local && (__rmt_path=index(path, ':')))
-#define _isrmt(fd) ((fd) >= __REM_BIAS)
-
-#define rmtopen(path,oflag,mode) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS) : open(path, oflag, mode))
-#define rmtaccess(path, amode) (_remdev(path) ? 0 : access(path, amode))
-#define rmtstat(path, buf) (_remdev(path) ? (errno = EOPNOTSUPP), -1 : stat(path, buf))
-#define rmtcreat(path, mode) (_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS) : creat(path, mode))
-#define rmtlstat(path,buf) (_remdev(path) ? (errno = EOPNOTSUPP), -1 : lstat(path,buf))
-
-#define rmtread(fd, buf, n) (_isrmt(fd) ? __rmt_read(fd - __REM_BIAS, buf, n) : read(fd, buf, n))
-#define rmtwrite(fd, buf, n) (_isrmt(fd) ? __rmt_write(fd - __REM_BIAS, buf, n) : write(fd, buf, n))
-#define rmtlseek(fd, off, wh) (_isrmt(fd) ? __rmt_lseek(fd - __REM_BIAS, off, wh) : lseek(fd, off, wh))
-#define rmtclose(fd) (_isrmt(fd) ? __rmt_close(fd - __REM_BIAS) : close(fd))
-#ifdef RMTIOCTL
-#define rmtioctl(fd,req,arg) (_isrmt(fd) ? __rmt_ioctl(fd - __REM_BIAS, req, arg) : ioctl(fd, req, arg))
-#else
-#define rmtioctl(fd,req,arg) (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : ioctl(fd, req, arg))
-#endif
-#define rmtdup(fd) (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : dup(fd))
-#define rmtfstat(fd, buf) (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : fstat(fd, buf))
-#define rmtfcntl(fd,cmd,arg) (_isrmt(fd) ? (errno = EOPNOTSUPP), -1 : fcntl (fd, cmd, arg))
-#define rmtisatty(fd) (_isrmt(fd) ? 0 : isatty(fd))
-
-#undef RMTIOCTL
-
-int __rmt_open ();
-int __rmt_close ();
-int __rmt_read ();
-int __rmt_write ();
-long __rmt_lseek ();
-int __rmt_ioctl ();
-#endif /* !NO_REMOTE */
diff --git a/contrib/cpio/rtapelib.c b/contrib/cpio/rtapelib.c
deleted file mode 100644
index 6550a6cd5bd4..000000000000
--- a/contrib/cpio/rtapelib.c
+++ /dev/null
@@ -1,566 +0,0 @@
-/* Functions for communicating with a remote tape drive.
- Copyright (C) 1988, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* The man page rmt(8) for /etc/rmt documents the remote mag tape
- protocol which rdump and rrestore use. Unfortunately, the man
- page is *WRONG*. The author of the routines I'm including originally
- wrote his code just based on the man page, and it didn't work, so he
- went to the rdump source to figure out why. The only thing he had to
- change was to check for the 'F' return code in addition to the 'E',
- and to separate the various arguments with \n instead of a space. I
- personally don't think that this is much of a problem, but I wanted to
- point it out. -- Arnold Robbins
-
- Originally written by Jeff Lee, modified some by Arnold Robbins.
- Redone as a library that can replace open, read, write, etc., by
- Fred Fish, with some additional work by Arnold Robbins.
- Modified to make all rmtXXX calls into macros for speed by Jay Fenlason.
- Use -DHAVE_NETDB_H for rexec code, courtesy of Dan Kegel, srs!dan. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <signal.h>
-
-#ifdef HAVE_SYS_MTIO_H
-#include <sys/ioctl.h>
-#include <sys/mtio.h>
-#endif
-
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-#include <errno.h>
-#include <setjmp.h>
-#include <sys/stat.h>
-
-#ifndef errno
-extern int errno;
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#endif
-
-/* Maximum size of a fully qualified host name. */
-#define MAXHOSTLEN 257
-
-/* Size of buffers for reading and writing commands to rmt.
- (An arbitrary limit.) */
-#define CMDBUFSIZE 64
-
-#ifndef RETSIGTYPE
-#define RETSIGTYPE void
-#endif
-
-/* Maximum number of simultaneous remote tape connections.
- (Another arbitrary limit.) */
-#define MAXUNIT 4
-
-/* Return the parent's read side of remote tape connection FILDES. */
-#define READ(fildes) (from_rmt[fildes][0])
-
-/* Return the parent's write side of remote tape connection FILDES. */
-#define WRITE(fildes) (to_rmt[fildes][1])
-
-/* The pipes for receiving data from remote tape drives. */
-static int from_rmt[MAXUNIT][2] =
-{-1, -1, -1, -1, -1, -1, -1, -1};
-
-/* The pipes for sending data to remote tape drives. */
-static int to_rmt[MAXUNIT][2] =
-{-1, -1, -1, -1, -1, -1, -1, -1};
-
-/* Temporary variable used by macros in rmt.h. */
-char *__rmt_path;
-
-/* Close remote tape connection FILDES. */
-
-static void
-_rmt_shutdown (fildes)
- int fildes;
-{
- close (READ (fildes));
- close (WRITE (fildes));
- READ (fildes) = -1;
- WRITE (fildes) = -1;
-}
-
-/* Attempt to perform the remote tape command specified in BUF
- on remote tape connection FILDES.
- Return 0 if successful, -1 on error. */
-
-static int
-command (fildes, buf)
- int fildes;
- char *buf;
-{
- register int buflen;
- RETSIGTYPE (*pipe_handler) ();
-
- /* Save the current pipe handler and try to make the request. */
-
- pipe_handler = signal (SIGPIPE, SIG_IGN);
- buflen = strlen (buf);
- if (write (WRITE (fildes), buf, buflen) == buflen)
- {
- signal (SIGPIPE, pipe_handler);
- return 0;
- }
-
- /* Something went wrong. Close down and go home. */
-
- signal (SIGPIPE, pipe_handler);
- _rmt_shutdown (fildes);
- errno = EIO;
- return -1;
-}
-
-/* Read and return the status from remote tape connection FILDES.
- If an error occurred, return -1 and set errno. */
-
-static int
-status (fildes)
- int fildes;
-{
- int i;
- char c, *cp;
- char buffer[CMDBUFSIZE];
-
- /* Read the reply command line. */
-
- for (i = 0, cp = buffer; i < CMDBUFSIZE; i++, cp++)
- {
- if (read (READ (fildes), cp, 1) != 1)
- {
- _rmt_shutdown (fildes);
- errno = EIO;
- return -1;
- }
- if (*cp == '\n')
- {
- *cp = '\0';
- break;
- }
- }
-
- if (i == CMDBUFSIZE)
- {
- _rmt_shutdown (fildes);
- errno = EIO;
- return -1;
- }
-
- /* Check the return status. */
-
- for (cp = buffer; *cp; cp++)
- if (*cp != ' ')
- break;
-
- if (*cp == 'E' || *cp == 'F')
- {
- errno = atoi (cp + 1);
- /* Skip the error message line. */
- while (read (READ (fildes), &c, 1) == 1)
- if (c == '\n')
- break;
-
- if (*cp == 'F')
- _rmt_shutdown (fildes);
-
- return -1;
- }
-
- /* Check for mis-synced pipes. */
-
- if (*cp != 'A')
- {
- _rmt_shutdown (fildes);
- errno = EIO;
- return -1;
- }
-
- /* Got an `A' (success) response. */
- return atoi (cp + 1);
-}
-
-#ifdef HAVE_NETDB_H
-/* Execute /etc/rmt as user USER on remote system HOST using rexec.
- Return a file descriptor of a bidirectional socket for stdin and stdout.
- If USER is NULL, or an empty string, use the current username.
-
- By default, this code is not used, since it requires that
- the user have a .netrc file in his/her home directory, or that the
- application designer be willing to have rexec prompt for login and
- password info. This may be unacceptable, and .rhosts files for use
- with rsh are much more common on BSD systems. */
-
-static int
-_rmt_rexec (host, user)
- char *host;
- char *user;
-{
- struct servent *rexecserv;
- int save_stdin = dup (fileno (stdin));
- int save_stdout = dup (fileno (stdout));
- int tape_fd; /* Return value. */
-
- /* When using cpio -o < filename, stdin is no longer the tty.
- But the rexec subroutine reads the login and the passwd on stdin,
- to allow remote execution of the command.
- So, reopen stdin and stdout on /dev/tty before the rexec and
- give them back their original value after. */
- if (freopen ("/dev/tty", "r", stdin) == NULL)
- freopen ("/dev/null", "r", stdin);
- if (freopen ("/dev/tty", "w", stdout) == NULL)
- freopen ("/dev/null", "w", stdout);
-
- rexecserv = getservbyname ("exec", "tcp");
- if (NULL == rexecserv)
- {
- fprintf (stderr, "exec/tcp: service not available");
- exit (1);
- }
- if (user != NULL && *user == '\0')
- user = NULL;
- tape_fd = rexec (&host, rexecserv->s_port, user, NULL,
- "/etc/rmt", (int *) NULL);
- fclose (stdin);
- fdopen (save_stdin, "r");
- fclose (stdout);
- fdopen (save_stdout, "w");
-
- return tape_fd;
-}
-
-#endif /* HAVE_NETDB_H */
-
-/* Open a magtape device on the system specified in PATH, as the given user.
- PATH has the form `[user@]system:/dev/????'.
- If COMPAT is defined, it can also have the form `system[.user]:/dev/????'.
-
- OFLAG is O_RDONLY, O_WRONLY, etc.
- MODE is ignored; 0666 is always used.
-
- If successful, return the remote tape pipe number plus BIAS.
- On error, return -1. */
-
-int
-__rmt_open (path, oflag, mode, bias)
- char *path;
- int oflag;
- int mode;
- int bias;
-{
- int i, rc;
- char buffer[CMDBUFSIZE]; /* Command buffer. */
- char system[MAXHOSTLEN]; /* The remote host name. */
- char device[CMDBUFSIZE]; /* The remote device name. */
- char login[CMDBUFSIZE]; /* The remote user name. */
- char *sys, *dev, *user; /* For copying into the above buffers. */
-
- sys = system;
- dev = device;
- user = login;
-
- /* Find an unused pair of file descriptors. */
-
- for (i = 0; i < MAXUNIT; i++)
- if (READ (i) == -1 && WRITE (i) == -1)
- break;
-
- if (i == MAXUNIT)
- {
- errno = EMFILE;
- return -1;
- }
-
- /* Pull apart the system and device, and optional user.
- Don't munge the original string. */
-
- while (*path != '@'
-#ifdef COMPAT
- && *path != '.'
-#endif
- && *path != ':')
- {
- *sys++ = *path++;
- }
- *sys = '\0';
- path++;
-
- if (*(path - 1) == '@')
- {
- /* Saw user part of user@host. Start over. */
- strcpy (user, system);
- sys = system;
- while (*path != ':')
- {
- *sys++ = *path++;
- }
- *sys = '\0';
- path++;
- }
-#ifdef COMPAT
- else if (*(path - 1) == '.')
- {
- while (*path != ':')
- {
- *user++ = *path++;
- }
- *user = '\0';
- path++;
- }
-#endif
- else
- *user = '\0';
-
- while (*path)
- {
- *dev++ = *path++;
- }
- *dev = '\0';
-
-#ifdef HAVE_NETDB_H
- /* Execute the remote command using rexec. */
- READ (i) = WRITE (i) = _rmt_rexec (system, login);
- if (READ (i) < 0)
- return -1;
-#else /* !HAVE_NETDB_H */
- /* Set up the pipes for the `rsh' command, and fork. */
-
- if (pipe (to_rmt[i]) == -1 || pipe (from_rmt[i]) == -1)
- return -1;
-
- rc = fork ();
- if (rc == -1)
- return -1;
-
- if (rc == 0)
- {
- /* Child. */
- close (0);
- dup (to_rmt[i][0]);
- close (to_rmt[i][0]);
- close (to_rmt[i][1]);
-
- close (1);
- dup (from_rmt[i][1]);
- close (from_rmt[i][0]);
- close (from_rmt[i][1]);
-
- setuid (getuid ());
- setgid (getgid ());
-
- if (*login)
- {
- execl ("/usr/bin/rsh", "rsh", "-l", login, system,
- "/etc/rmt", (char *) 0);
- }
- else
- {
- execl ("/usr/bin/rsh", "rsh", system,
- "/etc/rmt", (char *) 0);
- }
-
- /* Bad problems if we get here. */
-
- perror ("cannot execute remote shell");
- _exit (1);
- }
-
- /* Parent. */
- close (to_rmt[i][0]);
- close (from_rmt[i][1]);
-#endif /* !HAVE_NETDB_H */
-
- /* Attempt to open the tape device. */
-
- sprintf (buffer, "O%s\n%d\n", device, oflag);
- if (command (i, buffer) == -1 || status (i) == -1)
- return -1;
-
- return i + bias;
-}
-
-/* Close remote tape connection FILDES and shut down.
- Return 0 if successful, -1 on error. */
-
-int
-__rmt_close (fildes)
- int fildes;
-{
- int rc;
-
- if (command (fildes, "C\n") == -1)
- return -1;
-
- rc = status (fildes);
- _rmt_shutdown (fildes);
- return rc;
-}
-
-/* Read up to NBYTE bytes into BUF from remote tape connection FILDES.
- Return the number of bytes read on success, -1 on error. */
-
-int
-__rmt_read (fildes, buf, nbyte)
- int fildes;
- char *buf;
- unsigned int nbyte;
-{
- int rc, i;
- char buffer[CMDBUFSIZE];
-
- sprintf (buffer, "R%d\n", nbyte);
- if (command (fildes, buffer) == -1 || (rc = status (fildes)) == -1)
- return -1;
-
- for (i = 0; i < rc; i += nbyte, buf += nbyte)
- {
- nbyte = read (READ (fildes), buf, rc - i);
- if (nbyte <= 0)
- {
- _rmt_shutdown (fildes);
- errno = EIO;
- return -1;
- }
- }
-
- return rc;
-}
-
-/* Write NBYTE bytes from BUF to remote tape connection FILDES.
- Return the number of bytes written on success, -1 on error. */
-
-int
-__rmt_write (fildes, buf, nbyte)
- int fildes;
- char *buf;
- unsigned int nbyte;
-{
- char buffer[CMDBUFSIZE];
- RETSIGTYPE (*pipe_handler) ();
-
- sprintf (buffer, "W%d\n", nbyte);
- if (command (fildes, buffer) == -1)
- return -1;
-
- pipe_handler = signal (SIGPIPE, SIG_IGN);
- if (write (WRITE (fildes), buf, nbyte) == nbyte)
- {
- signal (SIGPIPE, pipe_handler);
- return status (fildes);
- }
-
- /* Write error. */
- signal (SIGPIPE, pipe_handler);
- _rmt_shutdown (fildes);
- errno = EIO;
- return -1;
-}
-
-/* Perform an imitation lseek operation on remote tape connection FILDES.
- Return the new file offset if successful, -1 if on error. */
-
-long
-__rmt_lseek (fildes, offset, whence)
- int fildes;
- long offset;
- int whence;
-{
- char buffer[CMDBUFSIZE];
-
- sprintf (buffer, "L%ld\n%d\n", offset, whence);
- if (command (fildes, buffer) == -1)
- return -1;
-
- return status (fildes);
-}
-
-/* Perform a raw tape operation on remote tape connection FILDES.
- Return the results of the ioctl, or -1 on error. */
-
-#ifdef MTIOCTOP
-int
-__rmt_ioctl (fildes, op, arg)
- int fildes, op;
- char *arg;
-{
- char c;
- int rc, cnt;
- char buffer[CMDBUFSIZE];
-
- switch (op)
- {
- default:
- errno = EINVAL;
- return -1;
-
- case MTIOCTOP:
- /* MTIOCTOP is the easy one. Nothing is transfered in binary. */
- sprintf (buffer, "I%d\n%d\n", ((struct mtop *) arg)->mt_op,
- ((struct mtop *) arg)->mt_count);
- if (command (fildes, buffer) == -1)
- return -1;
- return status (fildes); /* Return the count. */
-
- case MTIOCGET:
- /* Grab the status and read it directly into the structure.
- This assumes that the status buffer is not padded
- and that 2 shorts fit in a long without any word
- alignment problems; i.e., the whole struct is contiguous.
- NOTE - this is probably NOT a good assumption. */
-
- if (command (fildes, "S") == -1 || (rc = status (fildes)) == -1)
- return -1;
-
- for (; rc > 0; rc -= cnt, arg += cnt)
- {
- cnt = read (READ (fildes), arg, rc);
- if (cnt <= 0)
- {
- _rmt_shutdown (fildes);
- errno = EIO;
- return -1;
- }
- }
-
- /* Check for byte position. mt_type is a small integer field
- (normally) so we will check its magnitude. If it is larger than
- 256, we will assume that the bytes are swapped and go through
- and reverse all the bytes. */
-
- if (((struct mtget *) arg)->mt_type < 256)
- return 0;
-
- for (cnt = 0; cnt < rc; cnt += 2)
- {
- c = arg[cnt];
- arg[cnt] = arg[cnt + 1];
- arg[cnt + 1] = c;
- }
-
- return 0;
- }
-}
-
-#endif
diff --git a/contrib/cpio/safe-stat.h b/contrib/cpio/safe-stat.h
deleted file mode 100644
index 3a379703cf64..000000000000
--- a/contrib/cpio/safe-stat.h
+++ /dev/null
@@ -1 +0,0 @@
-#define SAFE_STAT(path,pbuf) stat(path,pbuf)
diff --git a/contrib/cpio/stripslash.c b/contrib/cpio/stripslash.c
deleted file mode 100644
index 67330e57560b..000000000000
--- a/contrib/cpio/stripslash.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* stripslash.c -- remove trailing slashes from a string
- Copyright (C) 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-/* Remove trailing slashes from PATH.
- This is useful when using filename completion from a shell that
- adds a "/" after directory names (such as tcsh and bash), because
- the Unix rename and rmdir system calls return an "Invalid argument" error
- when given a path that ends in "/" (except for the root directory). */
-
-void
-strip_trailing_slashes (path)
- char *path;
-{
- int last;
-
- last = strlen (path) - 1;
- while (last > 0 && path[last] == '/')
- path[last--] = '\0';
-}
diff --git a/contrib/cpio/system.h b/contrib/cpio/system.h
deleted file mode 100644
index e4cf0ffe9809..000000000000
--- a/contrib/cpio/system.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* System dependent declarations. Requires sys/types.h.
- Copyright (C) 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#ifndef index
-#define index strchr
-#endif
-#ifndef rindex
-#define rindex strrchr
-#endif
-#ifndef bcmp
-#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
-#endif
-#ifndef bzero
-#define bzero(s, n) memset ((s), 0, (n))
-#endif
-#else
-#include <strings.h>
-#endif
-
-#include <time.h>
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-#endif
-
-#ifndef _POSIX_VERSION
-#if defined(__MSDOS__) && !defined(__GNUC__)
-typedef long off_t;
-#endif
-off_t lseek ();
-#endif
-
-/* Since major is a function on SVR4, we can't use `ifndef major'. */
-#ifdef MAJOR_IN_MKDEV
-#include <sys/mkdev.h>
-#define HAVE_MAJOR
-#endif
-
-#ifdef MAJOR_IN_SYSMACROS
-#include <sys/sysmacros.h>
-#define HAVE_MAJOR
-#endif
-
-#ifdef major /* Might be defined in sys/types.h. */
-#define HAVE_MAJOR
-#endif
-
-#ifndef HAVE_MAJOR
-#define major(dev) (((dev) >> 8) & 0xff)
-#define minor(dev) ((dev) & 0xff)
-#define makedev(ma, mi) (((ma) << 8) | (mi))
-#endif
-#undef HAVE_MAJOR
-
-#if defined(__MSDOS__) || defined(_POSIX_VERSION) || defined(HAVE_FCNTL_H)
-#include <fcntl.h>
-#else
-#include <sys/file.h>
-#endif
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-#include <errno.h>
-#ifndef errno
-extern int errno;
-#endif
-#ifdef __EMX__ /* gcc on OS/2. */
-#define EPERM EACCES
-#define ENXIO EIO
-#endif
-
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#else
-struct utimbuf
-{
- time_t actime;
- time_t modtime;
-};
-#endif
-
-#ifdef TRUE
-#undef TRUE
-#endif
-#define TRUE 1
-#ifdef FALSE
-#undef FALSE
-#endif
-#define FALSE 0
-
-#ifndef __MSDOS__
-#define CONSOLE "/dev/tty"
-#else
-#define CONSOLE "con"
-#endif
-
-#if defined(__MSDOS__) && !defined(__GNUC__)
-typedef int uid_t;
-typedef int gid_t;
-#endif
-
-/* On most systems symlink() always creates links with rwxrwxrwx
- protection modes, but on some (HP/UX 8.07; I think maybe DEC's OSF
- on MIPS too) symlink() uses the value of umask, so links' protection modes
- aren't always rwxrwxrwx. There doesn't seem to be any way to change
- the modes of a link (no system call like, say, lchmod() ), it seems
- the only way to set the modes right is to set umask before calling
- symlink(). */
-
-#ifndef SYMLINK_USES_UMASK
-#define UMASKED_SYMLINK(name1,name2,mode) symlink(name1,name2)
-#else
-#define UMASKED_SYMLINK(name1,name2,mode) umasked_symlink(name1,name2,mode)
-#endif /* SYMLINK_USES_UMASK */
-
diff --git a/contrib/cpio/tar.c b/contrib/cpio/tar.c
deleted file mode 100644
index 333ec20efd5b..000000000000
--- a/contrib/cpio/tar.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/* tar.c - read in write tar headers for cpio
- Copyright (C) 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "filetypes.h"
-#include "system.h"
-#include "cpiohdr.h"
-#include "dstring.h"
-#include "extern.h"
-#include "rmt.h"
-#include "tarhdr.h"
-
-static void to_oct ();
-static char *stash_tar_linkname ();
-static char *stash_tar_filename ();
-
-/* Compute and return a checksum for TAR_HDR,
- counting the checksum bytes as if they were spaces. */
-
-unsigned long
-tar_checksum (tar_hdr)
- struct tar_header *tar_hdr;
-{
- unsigned long sum = 0;
- char *p = (char *) tar_hdr;
- char *q = p + TARRECORDSIZE;
- int i;
-
- while (p < tar_hdr->chksum)
- sum += *p++ & 0xff;
- for (i = 0; i < 8; ++i)
- {
- sum += ' ';
- ++p;
- }
- while (p < q)
- sum += *p++ & 0xff;
- return sum;
-}
-
-/* Write out header FILE_HDR, including the file name, to file
- descriptor OUT_DES. */
-
-void
-write_out_tar_header (file_hdr, out_des)
- struct new_cpio_header *file_hdr;
- int out_des;
-{
- int name_len;
- union tar_record tar_rec;
- struct tar_header *tar_hdr = (struct tar_header *) &tar_rec;
-
- bzero ((char *) &tar_rec, TARRECORDSIZE);
-
- /* process_copy_out must ensure that file_hdr->c_name is short enough,
- or we will lose here. */
-
- name_len = strlen (file_hdr->c_name);
- if (name_len <= TARNAMESIZE)
- {
- strncpy (tar_hdr->name, file_hdr->c_name, name_len);
- }
- else
- {
- /* Fit as much as we can into `name', the rest into `prefix'. */
- char *suffix = file_hdr->c_name + name_len - TARNAMESIZE;
-
- /* We have to put the boundary at a slash. */
- name_len = TARNAMESIZE;
- while (*suffix != '/')
- {
- --name_len;
- ++suffix;
- }
- strncpy (tar_hdr->name, suffix + 1, name_len);
- strncpy (tar_hdr->prefix, file_hdr->c_name, suffix - file_hdr->c_name);
- }
-
- /* SVR4 seems to want the whole mode, not just protection modes.
- Nobody else seems to care, so we might as well put it all in. */
- to_oct (file_hdr->c_mode, 8, tar_hdr->mode);
- to_oct (file_hdr->c_uid, 8, tar_hdr->uid);
- to_oct (file_hdr->c_gid, 8, tar_hdr->gid);
- to_oct (file_hdr->c_filesize, 12, tar_hdr->size);
- to_oct (file_hdr->c_mtime, 12, tar_hdr->mtime);
-
- switch (file_hdr->c_mode & CP_IFMT)
- {
- case CP_IFREG:
- if (file_hdr->c_tar_linkname)
- {
- /* process_copy_out makes sure that c_tar_linkname is shorter
- than TARLINKNAMESIZE. */
- strncpy (tar_hdr->linkname, file_hdr->c_tar_linkname,
- TARLINKNAMESIZE);
- tar_hdr->typeflag = LNKTYPE;
- to_oct (0, 12, tar_hdr->size);
- }
- else
- tar_hdr->typeflag = REGTYPE;
- break;
- case CP_IFDIR:
- tar_hdr->typeflag = DIRTYPE;
- break;
-#ifndef __MSDOS__
- case CP_IFCHR:
- tar_hdr->typeflag = CHRTYPE;
- break;
- case CP_IFBLK:
- tar_hdr->typeflag = BLKTYPE;
- break;
-#ifdef CP_IFIFO
- case CP_IFIFO:
- tar_hdr->typeflag = FIFOTYPE;
- break;
-#endif /* CP_IFIFO */
-#ifdef CP_IFLNK
- case CP_IFLNK:
- tar_hdr->typeflag = SYMTYPE;
- /* process_copy_out makes sure that c_tar_linkname is shorter
- than TARLINKNAMESIZE. */
- strncpy (tar_hdr->linkname, file_hdr->c_tar_linkname,
- TARLINKNAMESIZE);
- to_oct (0, 12, tar_hdr->size);
- break;
-#endif /* CP_IFLNK */
-#endif /* !__MSDOS__ */
- }
-
- if (archive_format == arf_ustar)
- {
- char *name;
-
- strncpy (tar_hdr->magic, TMAGIC, TMAGLEN);
- strncpy (tar_hdr->magic + TMAGLEN, TVERSION, TVERSLEN);
-
-#ifndef __MSDOS__
- name = getuser (file_hdr->c_uid);
- if (name)
- strcpy (tar_hdr->uname, name);
- name = getgroup (file_hdr->c_gid);
- if (name)
- strcpy (tar_hdr->gname, name);
-#endif
-
- to_oct (file_hdr->c_rdev_maj, 8, tar_hdr->devmajor);
- to_oct (file_hdr->c_rdev_min, 8, tar_hdr->devminor);
- }
-
- to_oct (tar_checksum (tar_hdr), 8, tar_hdr->chksum);
-
- tape_buffered_write ((char *) &tar_rec, out_des, TARRECORDSIZE);
-}
-
-/* Return nonzero iff all the bytes in BLOCK are NUL.
- SIZE is the number of bytes to check in BLOCK; it must be a
- multiple of sizeof (long). */
-
-int
-null_block (block, size)
- long *block;
- int size;
-{
- register long *p = block;
- register int i = size / sizeof (long);
-
- while (i--)
- if (*p++)
- return 0;
- return 1;
-}
-
-/* Read a tar header, including the file name, from file descriptor IN_DES
- into FILE_HDR. */
-
-void
-read_in_tar_header (file_hdr, in_des)
- struct new_cpio_header *file_hdr;
- int in_des;
-{
- long bytes_skipped = 0;
- int warned = FALSE;
- union tar_record tar_rec;
- struct tar_header *tar_hdr = (struct tar_header *) &tar_rec;
-#ifndef __MSDOS__
- uid_t *uidp;
- gid_t *gidp;
-#endif
-
- tape_buffered_read ((char *) &tar_rec, in_des, TARRECORDSIZE);
-
- /* Check for a block of 0's. */
- if (null_block ((long *) &tar_rec, TARRECORDSIZE))
- {
-#if 0
- /* Found one block of 512 0's. If the next block is also all 0's
- then this is the end of the archive. If not, assume the
- previous block was all corruption and continue reading
- the archive. */
- /* Commented out because GNU tar sometimes creates archives with
- only one block of 0's at the end. This happened for the
- cpio 2.0 distribution! */
- tape_buffered_read ((char *) &tar_rec, in_des, TARRECORDSIZE);
- if (null_block ((long *) &tar_rec, TARRECORDSIZE))
-#endif
- {
- file_hdr->c_name = "TRAILER!!!";
- return;
- }
-#if 0
- bytes_skipped = TARRECORDSIZE;
-#endif
- }
-
- while (1)
- {
- otoa (tar_hdr->chksum, &file_hdr->c_chksum);
-
- if (file_hdr->c_chksum != tar_checksum (tar_hdr))
- {
- /* If the checksum is bad, skip 1 byte and try again. When
- we try again we do not look for an EOF record (all zeros),
- because when we start skipping bytes in a corrupted archive
- the chances are pretty good that we might stumble across
- 2 blocks of 512 zeros (that probably is not really the last
- record) and it is better to miss the EOF and give the user
- a "premature EOF" error than to give up too soon on a corrupted
- archive. */
- if (!warned)
- {
- error (0, 0, "invalid header: checksum error");
- warned = TRUE;
- }
- bcopy (((char *) &tar_rec) + 1, (char *) &tar_rec,
- TARRECORDSIZE - 1);
- tape_buffered_read (((char *) &tar_rec) + (TARRECORDSIZE - 1), in_des, 1);
- ++bytes_skipped;
- continue;
- }
-
- if (archive_format != arf_ustar)
- file_hdr->c_name = stash_tar_filename (NULL, tar_hdr->name);
- else
- file_hdr->c_name = stash_tar_filename (tar_hdr->prefix, tar_hdr->name);
- file_hdr->c_nlink = 1;
- otoa (tar_hdr->mode, &file_hdr->c_mode);
- file_hdr->c_mode = file_hdr->c_mode & 07777;
-#ifndef __MSDOS__
- if (archive_format == arf_ustar
- && (uidp = getuidbyname (tar_hdr->uname)))
- file_hdr->c_uid = *uidp;
- else
-#endif
- otoa (tar_hdr->uid, &file_hdr->c_uid);
-#ifndef __MSDOS__
- if (archive_format == arf_ustar
- && (gidp = getgidbyname (tar_hdr->gname)))
- file_hdr->c_gid = *gidp;
- else
-#endif
- otoa (tar_hdr->gid, &file_hdr->c_gid);
- otoa (tar_hdr->size, &file_hdr->c_filesize);
- otoa (tar_hdr->mtime, &file_hdr->c_mtime);
- otoa (tar_hdr->devmajor, (unsigned long *) &file_hdr->c_rdev_maj);
- otoa (tar_hdr->devminor, (unsigned long *) &file_hdr->c_rdev_min);
- file_hdr->c_tar_linkname = NULL;
-
- switch (tar_hdr->typeflag)
- {
- case REGTYPE:
- case CONTTYPE: /* For now, punt. */
- default:
- file_hdr->c_mode |= CP_IFREG;
- break;
- case DIRTYPE:
- file_hdr->c_mode |= CP_IFDIR;
- break;
-#ifndef __MSDOS__
- case CHRTYPE:
- file_hdr->c_mode |= CP_IFCHR;
- /* If a POSIX tar header has a valid linkname it's always supposed
- to set typeflag to be LNKTYPE. System V.4 tar seems to
- be broken, and for device files with multiple links it
- puts the name of the link into linkname, but leaves typeflag
- as CHRTYPE, BLKTYPE, FIFOTYPE, etc. */
- file_hdr->c_tar_linkname = stash_tar_linkname (tar_hdr->linkname);
-
- /* Does POSIX say that the filesize must be 0 for devices? We
- assume so, but HPUX's POSIX tar sets it to be 1 which causes
- us problems (when reading an archive we assume we can always
- skip to the next file by skipping filesize bytes). For
- now at least, it's easier to clear filesize for devices,
- rather than check everywhere we skip in copyin.c. */
- file_hdr->c_filesize = 0;
- break;
- case BLKTYPE:
- file_hdr->c_mode |= CP_IFBLK;
- file_hdr->c_tar_linkname = stash_tar_linkname (tar_hdr->linkname);
- file_hdr->c_filesize = 0;
- break;
-#ifdef CP_IFIFO
- case FIFOTYPE:
- file_hdr->c_mode |= CP_IFIFO;
- file_hdr->c_tar_linkname = stash_tar_linkname (tar_hdr->linkname);
- file_hdr->c_filesize = 0;
- break;
-#endif
- case SYMTYPE:
-#ifdef CP_IFLNK
- file_hdr->c_mode |= CP_IFLNK;
- file_hdr->c_tar_linkname = stash_tar_linkname (tar_hdr->linkname);
- file_hdr->c_filesize = 0;
- break;
- /* Else fall through. */
-#endif
- case LNKTYPE:
- file_hdr->c_mode |= CP_IFREG;
- file_hdr->c_tar_linkname = stash_tar_linkname (tar_hdr->linkname);
- file_hdr->c_filesize = 0;
- break;
-#endif /* !__MSDOS__ */
- case AREGTYPE:
- /* Old tar format; if the last char in filename is '/' then it is
- a directory, otherwise it's a regular file. */
- if (file_hdr->c_name[strlen (file_hdr->c_name) - 1] == '/')
- file_hdr->c_mode |= CP_IFDIR;
- else
- file_hdr->c_mode |= CP_IFREG;
- break;
- }
- break;
- }
- if (bytes_skipped > 0)
- error (0, 0, "warning: skipped %ld bytes of junk", bytes_skipped);
-}
-
-/* Stash the tar linkname in static storage. */
-
-static char *
-stash_tar_linkname (linkname)
- char *linkname;
-{
- static char hold_tar_linkname[TARLINKNAMESIZE + 1];
-
- strncpy (hold_tar_linkname, linkname, TARLINKNAMESIZE);
- hold_tar_linkname[TARLINKNAMESIZE] = '\0';
- return hold_tar_linkname;
-}
-
-/* Stash the tar filename and optional prefix in static storage. */
-
-static char *
-stash_tar_filename (prefix, filename)
- char *prefix;
- char *filename;
-{
- static char hold_tar_filename[TARNAMESIZE + TARPREFIXSIZE + 2];
- if (prefix == NULL || *prefix == '\0')
- {
- strncpy (hold_tar_filename, filename, TARNAMESIZE);
- hold_tar_filename[TARNAMESIZE] = '\0';
- }
- else
- {
- strncpy (hold_tar_filename, prefix, TARPREFIXSIZE);
- hold_tar_filename[TARPREFIXSIZE] = '\0';
- strcat (hold_tar_filename, "/");
- strncat (hold_tar_filename, filename, TARNAMESIZE);
- hold_tar_filename[TARPREFIXSIZE + TARNAMESIZE] = '\0';
- }
- return hold_tar_filename;
-}
-
-/* Convert the string of octal digits S into a number and store
- it in *N. Return nonzero if the whole string was converted,
- zero if there was something after the number.
- Skip leading and trailing spaces. */
-
-int
-otoa (s, n)
- char *s;
- unsigned long *n;
-{
- unsigned long val = 0;
-
- while (*s == ' ')
- ++s;
- while (*s >= '0' && *s <= '7')
- val = 8 * val + *s++ - '0';
- while (*s == ' ')
- ++s;
- *n = val;
- return *s == '\0';
-}
-
-/* Convert a number into a string of octal digits.
- Convert long VALUE into a DIGITS-digit field at WHERE,
- including a trailing space and room for a NUL. DIGITS==3 means
- 1 digit, a space, and room for a NUL.
-
- We assume the trailing NUL is already there and don't fill it in.
- This fact is used by start_header and finish_header, so don't change it!
-
- This is be equivalent to:
- sprintf (where, "%*lo ", digits - 2, value);
- except that sprintf fills in the trailing NUL and we don't. */
-
-static void
-to_oct (value, digits, where)
- register long value;
- register int digits;
- register char *where;
-{
- --digits; /* Leave the trailing NUL slot alone. */
- where[--digits] = ' '; /* Put in the space, though. */
-
- /* Produce the digits -- at least one. */
- do
- {
- where[--digits] = '0' + (char) (value & 7); /* One octal digit. */
- value >>= 3;
- }
- while (digits > 0 && value != 0);
-
- /* Add leading spaces, if necessary. */
- while (digits > 0)
- where[--digits] = ' ';
-}
-
-/* Return
- 2 if BUF is a valid POSIX tar header (the checksum is correct
- and it has the "ustar" magic string),
- 1 if BUF is a valid old tar header (the checksum is correct),
- 0 otherwise. */
-
-int
-is_tar_header (buf)
- char *buf;
-{
- struct tar_header *tar_hdr = (struct tar_header *) buf;
- unsigned long chksum;
-
- otoa (tar_hdr->chksum, &chksum);
-
- if (chksum != tar_checksum (tar_hdr))
- return 0;
-
- /* GNU tar 1.10 and previous set the magic field to be "ustar " instead
- of "ustar\0". Only look at the first 5 characters of the magic
- field so we can recognize old GNU tar ustar archives. */
- if (!strncmp (tar_hdr->magic, TMAGIC, TMAGLEN - 1))
- return 2;
- return 1;
-}
-
-/* Return TRUE if the filename is too long to fit in a tar header.
- For old tar headers, if the filename's length is less than or equal
- to 100 then it will fit, otherwise it will not. For POSIX tar headers,
- if the filename's length is less than or equal to 100 then it
- will definitely fit, and if it is greater than 256 then it
- will definitely not fit. If the length is between 100 and 256,
- then the filename will fit only if it is possible to break it
- into a 155 character "prefix" and 100 character "name". There
- must be a slash between the "prefix" and the "name", although
- the slash is not stored or counted in either the "prefix" or
- the "name", and there must be at least one character in both
- the "prefix" and the "name". If it is not possible to break down
- the filename like this then it will not fit. */
-
-int
-is_tar_filename_too_long (name)
- char *name;
-{
- int whole_name_len;
- int prefix_name_len;
- char *p;
-
- whole_name_len = strlen (name);
- if (whole_name_len <= TARNAMESIZE)
- return FALSE;
-
- if (archive_format != arf_ustar)
- return TRUE;
-
- if (whole_name_len > TARNAMESIZE + TARPREFIXSIZE + 1)
- return TRUE;
-
- /* See whether we can split up the name into acceptably-sized
- `prefix' and `name' (`p') pieces. Start out by making `name'
- as big as possible, then shrink it by looking for the first '/'. */
- p = name + whole_name_len - TARNAMESIZE;
- while (*p != '/' && *p != '\0')
- ++p;
- if (*p == '\0')
- /* The last component of the path is longer than TARNAMESIZE. */
- return TRUE;
-
- prefix_name_len = p - name - 1;
- /* Interestingly, a name consisting of a slash followed by
- TARNAMESIZE characters can't be stored, because the prefix
- would be empty, and thus ignored. */
- if (prefix_name_len > TARPREFIXSIZE || prefix_name_len == 0)
- return TRUE;
-
- return FALSE;
-}
diff --git a/contrib/cpio/tar.h b/contrib/cpio/tar.h
deleted file mode 100644
index 411579c9d1ab..000000000000
--- a/contrib/cpio/tar.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Extended tar format from POSIX.1.
- Copyright (C) 1992 Free Software Foundation, Inc.
- Written by David J. MacKenzie.
-
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#ifndef _TAR_H
-
-#define _TAR_H 1
-
-
-/* A tar archive consists of 512-byte blocks.
- Each file in the archive has a header block followed by 0+ data blocks.
- Two blocks of NUL bytes indicate the end of the archive. */
-
-/* The fields of header blocks:
- All strings are stored as ISO 646 (approximately ASCII) strings.
-
- Fields are numeric unless otherwise noted below; numbers are ISO 646
- representations of octal numbers, with leading zeros as needed.
-
- linkname is only valid when typeflag==LNKTYPE. It doesn't use prefix;
- files that are links to pathnames >100 chars long can not be stored
- in a tar archive.
-
- If typeflag=={LNKTYPE,SYMTYPE,DIRTYPE} then size must be 0.
-
- devmajor and devminor are only valid for typeflag=={BLKTYPE,CHRTYPE}.
-
- chksum contains the sum of all 512 bytes in the header block,
- treating each byte as an 8-bit unsigned value and treating the
- 8 bytes of chksum as blank characters.
-
- uname and gname are used in preference to uid and gid, if those
- names exist locally.
-
- Field Name Byte Offset Length in Bytes Field Type
- name 0 100 NUL-terminated if NUL fits
- mode 100 8
- uid 108 8
- gid 116 8
- size 124 12
- mtime 136 12
- chksum 148 8
- typeflag 156 1 see below
- linkname 157 100 NUL-terminated if NUL fits
- magic 257 6 must be TMAGIC (NUL term.)
- version 263 2 must be TVERSION
- uname 265 32 NUL-terminated
- gname 297 32 NUL-terminated
- devmajor 329 8
- devminor 337 8
- prefix 345 155 NUL-terminated if NUL fits
-
- If the first character of prefix is '\0', the file name is name;
- otherwise, it is prefix/name. Files whose pathnames don't fit in that
- length can not be stored in a tar archive. */
-
-/* The bits in mode: */
-#define TSUID 04000
-#define TSGID 02000
-#define TSVTX 01000
-#define TUREAD 00400
-#define TUWRITE 00200
-#define TUEXEC 00100
-#define TGREAD 00040
-#define TGWRITE 00020
-#define TGEXEC 00010
-#define TOREAD 00004
-#define TOWRITE 00002
-#define TOEXEC 00001
-
-/* The values for typeflag:
- Values 'A'-'Z' are reserved for custom implementations.
- All other values are reserved for future POSIX.1 revisions. */
-
-#define REGTYPE '0' /* Regular file (preferred code). */
-#define AREGTYPE '\0' /* Regular file (alternate code). */
-#define LNKTYPE '1' /* Hard link. */
-#define SYMTYPE '2' /* Symbolic link (hard if not supported). */
-#define CHRTYPE '3' /* Character special. */
-#define BLKTYPE '4' /* Block special. */
-#define DIRTYPE '5' /* Directory. */
-#define FIFOTYPE '6' /* Named pipe. */
-#define CONTTYPE '7' /* Contiguous file */
- /* (regular file if not supported). */
-
-/* Contents of magic field and its length. */
-#define TMAGIC "ustar"
-#define TMAGLEN 6
-
-/* Contents of the version field and its length. */
-#define TVERSION "00"
-#define TVERSLEN 2
-
-
-#endif /* tar.h */
diff --git a/contrib/cpio/tarhdr.h b/contrib/cpio/tarhdr.h
deleted file mode 100644
index 54de0d6a35bd..000000000000
--- a/contrib/cpio/tarhdr.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Extended tar header from POSIX.1.
- Copyright (C) 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef _TARHDR_H
-
-#define _TARHDR_H 1
-
-#include <tar.h>
-
-/* Size of `name' field. */
-#define TARNAMESIZE 100
-
-/* Size of `linkname' field. */
-#define TARLINKNAMESIZE 100
-
-/* Size of `prefix' field. */
-#define TARPREFIXSIZE 155
-
-/* Size of entire tar header. */
-#define TARRECORDSIZE 512
-
-struct tar_header
-{
- char name[TARNAMESIZE];
- char mode[8];
- char uid[8];
- char gid[8];
- char size[12];
- char mtime[12];
- char chksum[8];
- char typeflag;
- char linkname[TARLINKNAMESIZE];
- char magic[6];
- char version[2];
- char uname[32];
- char gname[32];
- char devmajor[8];
- char devminor[8];
- char prefix[TARPREFIXSIZE];
-};
-
-union tar_record
-{
- struct tar_header header;
- char buffer[TARRECORDSIZE];
-};
-
-#endif /* tarhdr.h */
diff --git a/contrib/cpio/userspec.c b/contrib/cpio/userspec.c
deleted file mode 100644
index 67f1583335c5..000000000000
--- a/contrib/cpio/userspec.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* userspec.c -- Parse a user and group string.
- Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#else
-#ifdef _AIX
- #pragma alloca
-#else
-char *alloca ();
-#endif
-#endif
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
-
-#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#ifndef index
-#define index strchr
-#endif
-#else
-#include <strings.h>
-#endif
-
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifndef _POSIX_VERSION
-struct passwd *getpwnam ();
-struct group *getgrnam ();
-struct group *getgrgid ();
-#endif
-
-#ifdef _POSIX_SOURCE
-#define endpwent()
-#define endgrent()
-#endif
-
-/* Perform the equivalent of the statement `dest = strdup (src);',
- but obtaining storage via alloca instead of from the heap. */
-
-#define V_STRDUP(dest, src) \
- do \
- { \
- int _len = strlen ((src)); \
- (dest) = (char *) alloca (_len + 1); \
- strcpy (dest, src); \
- } \
- while (0)
-
-#define isdigit(c) ((c) >= '0' && (c) <= '9')
-
-char *strdup ();
-
-/* Return nonzero if STR represents an unsigned decimal integer,
- otherwise return 0. */
-
-static int
-isnumber (str)
- const char *str;
-{
- for (; *str; str++)
- if (!isdigit (*str))
- return 0;
- return 1;
-}
-
-/* Extract from NAME, which has the form "[user][:.][group]",
- a USERNAME, UID U, GROUPNAME, and GID G.
- Either user or group, or both, must be present.
- If the group is omitted but the ":" or "." separator is given,
- use the given user's login group.
-
- USERNAME and GROUPNAME will be in newly malloc'd memory.
- Either one might be NULL instead, indicating that it was not
- given and the corresponding numeric ID was left unchanged.
-
- Return NULL if successful, a static error message string if not. */
-
-const char *
-parse_user_spec (spec_arg, uid, gid, username_arg, groupname_arg)
- const char *spec_arg;
- uid_t *uid;
- gid_t *gid;
- char **username_arg, **groupname_arg;
-{
- static const char *tired = "virtual memory exhausted";
- const char *error_msg;
- char *spec; /* A copy we can write on. */
- struct passwd *pwd;
- struct group *grp;
- char *g, *u, *separator;
- char *groupname;
-
- error_msg = NULL;
- *username_arg = *groupname_arg = NULL;
- groupname = NULL;
-
- V_STRDUP (spec, spec_arg);
-
- /* Find the separator if there is one. */
- separator = index (spec, ':');
- if (separator == NULL)
- separator = index (spec, '.');
-
- /* Replace separator with a NUL. */
- if (separator != NULL)
- *separator = '\0';
-
- /* Set U and G to non-zero length strings corresponding to user and
- group specifiers or to NULL. */
- u = (*spec == '\0' ? NULL : spec);
-
- g = (separator == NULL || *(separator + 1) == '\0'
- ? NULL
- : separator + 1);
-
- if (u == NULL && g == NULL)
- return "can not omit both user and group";
-
- if (u != NULL)
- {
- pwd = getpwnam (u);
- if (pwd == NULL)
- {
-
- if (!isnumber (u))
- error_msg = "invalid user";
- else
- {
- int use_login_group;
- use_login_group = (separator != NULL && g == NULL);
- if (use_login_group)
- error_msg = "cannot get the login group of a numeric UID";
- else
- *uid = atoi (u);
- }
- }
- else
- {
- *uid = pwd->pw_uid;
- if (g == NULL && separator != NULL)
- {
- /* A separator was given, but a group was not specified,
- so get the login group. */
- *gid = pwd->pw_gid;
- grp = getgrgid (pwd->pw_gid);
- if (grp == NULL)
- {
- /* This is enough room to hold the unsigned decimal
- representation of any 32-bit quantity and the trailing
- zero byte. */
- char uint_buf[21];
- sprintf (uint_buf, "%u", (unsigned) (pwd->pw_gid));
- V_STRDUP (groupname, uint_buf);
- }
- else
- {
- V_STRDUP (groupname, grp->gr_name);
- }
- endgrent ();
- }
- }
- endpwent ();
- }
-
- if (g != NULL && error_msg == NULL)
- {
- /* Explicit group. */
- grp = getgrnam (g);
- if (grp == NULL)
- {
- if (!isnumber (g))
- error_msg = "invalid group";
- else
- *gid = atoi (g);
- }
- else
- *gid = grp->gr_gid;
- endgrent (); /* Save a file descriptor. */
-
- if (error_msg == NULL)
- V_STRDUP (groupname, g);
- }
-
- if (error_msg == NULL)
- {
- if (u != NULL)
- {
- *username_arg = strdup (u);
- if (*username_arg == NULL)
- error_msg = tired;
- }
-
- if (groupname != NULL && error_msg == NULL)
- {
- *groupname_arg = strdup (groupname);
- if (*groupname_arg == NULL)
- {
- if (*username_arg != NULL)
- {
- free (*username_arg);
- *username_arg = NULL;
- }
- error_msg = tired;
- }
- }
- }
-
- return error_msg;
-}
-
-#ifdef TEST
-
-#define NULL_CHECK(s) ((s) == NULL ? "(null)" : (s))
-
-int
-main (int argc, char **argv)
-{
- int i;
-
- for (i = 1; i < argc; i++)
- {
- const char *e;
- char *username, *groupname;
- uid_t uid;
- gid_t gid;
- char *tmp;
-
- tmp = strdup (argv[i]);
- e = parse_user_spec (tmp, &uid, &gid, &username, &groupname);
- free (tmp);
- printf ("%s: %u %u %s %s %s\n",
- argv[i],
- (unsigned int) uid,
- (unsigned int) gid,
- NULL_CHECK (username),
- NULL_CHECK (groupname),
- NULL_CHECK (e));
- }
-
- exit (0);
-}
-
-#endif
diff --git a/contrib/cpio/util.c b/contrib/cpio/util.c
deleted file mode 100644
index 216041fd6c08..000000000000
--- a/contrib/cpio/util.c
+++ /dev/null
@@ -1,1343 +0,0 @@
-/* util.c - Several utility routines for cpio.
- Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-#include <sys/types.h>
-#ifdef HPUX_CDF
-#include <sys/stat.h>
-#endif
-#include "system.h"
-#include "cpiohdr.h"
-#include "dstring.h"
-#include "extern.h"
-#include "rmt.h"
-
-#ifndef __MSDOS__
-#include <sys/ioctl.h>
-#else
-#include <io.h>
-#endif
-
-#ifdef HAVE_SYS_MTIO_H
-#ifdef HAVE_SYS_IO_TRIOCTL_H
-#include <sys/io/trioctl.h>
-#endif
-#include <sys/mtio.h>
-#endif
-
-static void tape_fill_input_buffer P_((int in_des, int num_bytes));
-static int disk_fill_input_buffer P_((int in_des, int num_bytes));
-static void hash_insert ();
-static void write_nuls_to_file P_((long num_bytes, int out_des));
-
-/* Write `output_size' bytes of `output_buffer' to file
- descriptor OUT_DES and reset `output_size' and `out_buff'. */
-
-void
-tape_empty_output_buffer (out_des)
- int out_des;
-{
- int bytes_written;
-
-#ifdef BROKEN_LONG_TAPE_DRIVER
- static long output_bytes_before_lseek = 0;
-
- /* Some tape drivers seem to have a signed internal seek pointer and
- they lose if it overflows and becomes negative (e.g. when writing
- tapes > 2Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the
- seek pointer and prevent it from overflowing. */
- if (output_is_special
- && ( (output_bytes_before_lseek += output_size) >= 1073741824L) )
- {
- lseek(out_des, 0L, SEEK_SET);
- output_bytes_before_lseek = 0;
- }
-#endif
-
- bytes_written = rmtwrite (out_des, output_buffer, output_size);
- if (bytes_written != output_size)
- {
- int rest_bytes_written;
- int rest_output_size;
-
- if (output_is_special
- && (bytes_written >= 0
- || (bytes_written < 0
- && (errno == ENOSPC || errno == EIO || errno == ENXIO))))
- {
- get_next_reel (out_des);
- if (bytes_written > 0)
- rest_output_size = output_size - bytes_written;
- else
- rest_output_size = output_size;
- rest_bytes_written = rmtwrite (out_des, output_buffer,
- rest_output_size);
- if (rest_bytes_written != rest_output_size)
- error (1, errno, "write error");
- }
- else
- error (1, errno, "write error");
- }
- output_bytes += output_size;
- out_buff = output_buffer;
- output_size = 0;
-}
-
-/* Write `output_size' bytes of `output_buffer' to file
- descriptor OUT_DES and reset `output_size' and `out_buff'.
- If `swapping_halfwords' or `swapping_bytes' is set,
- do the appropriate swapping first. Our callers have
- to make sure to only set these flags if `output_size'
- is appropriate (a multiple of 4 for `swapping_halfwords',
- 2 for `swapping_bytes'). The fact that DISK_IO_BLOCK_SIZE
- must always be a multiple of 4 helps us (and our callers)
- insure this. */
-
-void
-disk_empty_output_buffer (out_des)
- int out_des;
-{
- int bytes_written;
-
- if (swapping_halfwords || swapping_bytes)
- {
- if (swapping_halfwords)
- {
- int complete_words;
- complete_words = output_size / 4;
- swahw_array (output_buffer, complete_words);
- if (swapping_bytes)
- swab_array (output_buffer, 2 * complete_words);
- }
- else
- {
- int complete_halfwords;
- complete_halfwords = output_size /2;
- swab_array (output_buffer, complete_halfwords);
- }
- }
-
- if (sparse_flag)
- bytes_written = sparse_write (out_des, output_buffer, output_size);
- else
- bytes_written = write (out_des, output_buffer, output_size);
-
- if (bytes_written != output_size)
- {
- error (1, errno, "write error");
- }
- output_bytes += output_size;
- out_buff = output_buffer;
- output_size = 0;
-}
-
-/* Exchange the halfwords of each element of the array of COUNT longs
- starting at PTR. PTR does not have to be aligned at a word
- boundary. */
-
-void
-swahw_array (ptr, count)
- char *ptr;
- int count;
-{
- char tmp;
-
- for (; count > 0; --count)
- {
- tmp = *ptr;
- *ptr = *(ptr + 2);
- *(ptr + 2) = tmp;
- ++ptr;
- tmp = *ptr;
- *ptr = *(ptr + 2);
- *(ptr + 2) = tmp;
- ptr += 3;
- }
-}
-
-/* Read at most NUM_BYTES or `io_block_size' bytes, whichever is smaller,
- into the start of `input_buffer' from file descriptor IN_DES.
- Set `input_size' to the number of bytes read and reset `in_buff'.
- Exit with an error if end of file is reached. */
-
-#ifdef BROKEN_LONG_TAPE_DRIVER
-static long input_bytes_before_lseek = 0;
-#endif
-
-static void
-tape_fill_input_buffer (in_des, num_bytes)
- int in_des;
- int num_bytes;
-{
-#ifdef BROKEN_LONG_TAPE_DRIVER
- /* Some tape drivers seem to have a signed internal seek pointer and
- they lose if it overflows and becomes negative (e.g. when writing
- tapes > 4Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the
- seek pointer and prevent it from overflowing. */
- if (input_is_special
- && ( (input_bytes_before_lseek += num_bytes) >= 1073741824L) )
- {
- lseek(in_des, 0L, SEEK_SET);
- input_bytes_before_lseek = 0;
- }
-#endif
- in_buff = input_buffer;
- num_bytes = (num_bytes < io_block_size) ? num_bytes : io_block_size;
- input_size = rmtread (in_des, input_buffer, num_bytes);
- if (input_size == 0 && input_is_special)
- {
- get_next_reel (in_des);
- input_size = rmtread (in_des, input_buffer, num_bytes);
- }
- if (input_size < 0)
- error (1, errno, "read error");
- if (input_size == 0)
- {
- error (0, 0, "premature end of file");
- exit (1);
- }
- input_bytes += input_size;
-}
-
-/* Read at most NUM_BYTES or `DISK_IO_BLOCK_SIZE' bytes, whichever is smaller,
- into the start of `input_buffer' from file descriptor IN_DES.
- Set `input_size' to the number of bytes read and reset `in_buff'.
- Exit with an error if end of file is reached. */
-
-static int
-disk_fill_input_buffer (in_des, num_bytes)
- int in_des;
- int num_bytes;
-{
- in_buff = input_buffer;
- num_bytes = (num_bytes < DISK_IO_BLOCK_SIZE) ? num_bytes : DISK_IO_BLOCK_SIZE;
- input_size = read (in_des, input_buffer, num_bytes);
- if (input_size < 0)
- {
- input_size = 0;
- return (-1);
- }
- else if (input_size == 0)
- return (1);
- input_bytes += input_size;
- return (0);
-}
-
-/* Copy NUM_BYTES of buffer IN_BUF to `out_buff', which may be partly full.
- When `out_buff' fills up, flush it to file descriptor OUT_DES. */
-
-void
-tape_buffered_write (in_buf, out_des, num_bytes)
- char *in_buf;
- int out_des;
- long num_bytes;
-{
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
- register long space_left; /* Room left in output buffer. */
-
- while (bytes_left > 0)
- {
- space_left = io_block_size - output_size;
- if (space_left == 0)
- tape_empty_output_buffer (out_des);
- else
- {
- if (bytes_left < space_left)
- space_left = bytes_left;
- bcopy (in_buf, out_buff, (unsigned) space_left);
- out_buff += space_left;
- output_size += space_left;
- in_buf += space_left;
- bytes_left -= space_left;
- }
- }
-}
-
-/* Copy NUM_BYTES of buffer IN_BUF to `out_buff', which may be partly full.
- When `out_buff' fills up, flush it to file descriptor OUT_DES. */
-
-void
-disk_buffered_write (in_buf, out_des, num_bytes)
- char *in_buf;
- int out_des;
- long num_bytes;
-{
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
- register long space_left; /* Room left in output buffer. */
-
- while (bytes_left > 0)
- {
- space_left = DISK_IO_BLOCK_SIZE - output_size;
- if (space_left == 0)
- disk_empty_output_buffer (out_des);
- else
- {
- if (bytes_left < space_left)
- space_left = bytes_left;
- bcopy (in_buf, out_buff, (unsigned) space_left);
- out_buff += space_left;
- output_size += space_left;
- in_buf += space_left;
- bytes_left -= space_left;
- }
- }
-}
-
-/* Copy NUM_BYTES of buffer `in_buff' into IN_BUF.
- `in_buff' may be partly full.
- When `in_buff' is exhausted, refill it from file descriptor IN_DES. */
-
-void
-tape_buffered_read (in_buf, in_des, num_bytes)
- char *in_buf;
- int in_des;
- long num_bytes;
-{
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
- register long space_left; /* Bytes to copy from input buffer. */
-
- while (bytes_left > 0)
- {
- if (input_size == 0)
- tape_fill_input_buffer (in_des, io_block_size);
- if (bytes_left < input_size)
- space_left = bytes_left;
- else
- space_left = input_size;
- bcopy (in_buff, in_buf, (unsigned) space_left);
- in_buff += space_left;
- in_buf += space_left;
- input_size -= space_left;
- bytes_left -= space_left;
- }
-}
-
-/* Copy the the next NUM_BYTES bytes of `input_buffer' into PEEK_BUF.
- If NUM_BYTES bytes are not available, read the next `io_block_size' bytes
- into the end of `input_buffer' and update `input_size'.
-
- Return the number of bytes copied into PEEK_BUF.
- If the number of bytes returned is less than NUM_BYTES,
- then EOF has been reached. */
-
-int
-tape_buffered_peek (peek_buf, in_des, num_bytes)
- char *peek_buf;
- int in_des;
- int num_bytes;
-{
- long tmp_input_size;
- long got_bytes;
- char *append_buf;
-
-#ifdef BROKEN_LONG_TAPE_DRIVER
- /* Some tape drivers seem to have a signed internal seek pointer and
- they lose if it overflows and becomes negative (e.g. when writing
- tapes > 4Gb). Doing an lseek (des, 0, SEEK_SET) seems to reset the
- seek pointer and prevent it from overflowing. */
- if (input_is_special
- && ( (input_bytes_before_lseek += num_bytes) >= 1073741824L) )
- {
- lseek(in_des, 0L, SEEK_SET);
- input_bytes_before_lseek = 0;
- }
-#endif
-
- while (input_size < num_bytes)
- {
- append_buf = in_buff + input_size;
- if ( (append_buf - input_buffer) >= input_buffer_size)
- {
- /* We can keep up to 2 "blocks" (either the physical block size
- or 512 bytes(the size of a tar record), which ever is
- larger) in the input buffer when we are peeking. We
- assume that our caller will never be interested in peeking
- ahead at more than 512 bytes, so we know that by the time
- we need a 3rd "block" in the buffer we can throw away the
- first block to make room. */
- int half;
- half = input_buffer_size / 2;
- bcopy (input_buffer + half, input_buffer, half);
- in_buff = in_buff - half;
- append_buf = append_buf - half;
- }
- tmp_input_size = rmtread (in_des, append_buf, io_block_size);
- if (tmp_input_size == 0)
- {
- if (input_is_special)
- {
- get_next_reel (in_des);
- tmp_input_size = rmtread (in_des, append_buf, io_block_size);
- }
- else
- break;
- }
- if (tmp_input_size < 0)
- error (1, errno, "read error");
- input_bytes += tmp_input_size;
- input_size += tmp_input_size;
- }
- if (num_bytes <= input_size)
- got_bytes = num_bytes;
- else
- got_bytes = input_size;
- bcopy (in_buff, peek_buf, (unsigned) got_bytes);
- return got_bytes;
-}
-
-/* Skip the next NUM_BYTES bytes of file descriptor IN_DES. */
-
-void
-tape_toss_input (in_des, num_bytes)
- int in_des;
- long num_bytes;
-{
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
- register long space_left; /* Bytes to copy from input buffer. */
-
- while (bytes_left > 0)
- {
- if (input_size == 0)
- tape_fill_input_buffer (in_des, io_block_size);
- if (bytes_left < input_size)
- space_left = bytes_left;
- else
- space_left = input_size;
-
- if (crc_i_flag && only_verify_crc_flag)
- {
- int k;
- for (k = 0; k < space_left; ++k)
- crc += in_buff[k] & 0xff;
- }
-
- in_buff += space_left;
- input_size -= space_left;
- bytes_left -= space_left;
- }
-}
-
-/* Copy a file using the input and output buffers, which may start out
- partly full. After the copy, the files are not closed nor the last
- block flushed to output, and the input buffer may still be partly
- full. If `crc_i_flag' is set, add each byte to `crc'.
- IN_DES is the file descriptor for input;
- OUT_DES is the file descriptor for output;
- NUM_BYTES is the number of bytes to copy. */
-
-void
-copy_files_tape_to_disk (in_des, out_des, num_bytes)
- int in_des;
- int out_des;
- long num_bytes;
-{
- long size;
- long k;
-
- while (num_bytes > 0)
- {
- if (input_size == 0)
- tape_fill_input_buffer (in_des, io_block_size);
- size = (input_size < num_bytes) ? input_size : num_bytes;
- if (crc_i_flag)
- {
- for (k = 0; k < size; ++k)
- crc += in_buff[k] & 0xff;
- }
- disk_buffered_write (in_buff, out_des, size);
- num_bytes -= size;
- input_size -= size;
- in_buff += size;
- }
-}
-/* Copy a file using the input and output buffers, which may start out
- partly full. After the copy, the files are not closed nor the last
- block flushed to output, and the input buffer may still be partly
- full. If `crc_i_flag' is set, add each byte to `crc'.
- IN_DES is the file descriptor for input;
- OUT_DES is the file descriptor for output;
- NUM_BYTES is the number of bytes to copy. */
-
-void
-copy_files_disk_to_tape (in_des, out_des, num_bytes, filename)
- int in_des;
- int out_des;
- long num_bytes;
- char *filename;
-{
- long size;
- long k;
- int rc;
- long original_num_bytes;
-
- original_num_bytes = num_bytes;
-
- while (num_bytes > 0)
- {
- if (input_size == 0)
- if (rc = disk_fill_input_buffer (in_des, DISK_IO_BLOCK_SIZE))
- {
- if (rc > 0)
- error (0, 0, "File %s shrunk by %ld bytes, padding with zeros",
- filename, num_bytes);
- else
- error (0, 0, "Read error at byte %ld in file %s, padding with zeros",
- original_num_bytes - num_bytes, filename);
- write_nuls_to_file (num_bytes, out_des);
- break;
- }
- size = (input_size < num_bytes) ? input_size : num_bytes;
- if (crc_i_flag)
- {
- for (k = 0; k < size; ++k)
- crc += in_buff[k] & 0xff;
- }
- tape_buffered_write (in_buff, out_des, size);
- num_bytes -= size;
- input_size -= size;
- in_buff += size;
- }
-}
-/* Copy a file using the input and output buffers, which may start out
- partly full. After the copy, the files are not closed nor the last
- block flushed to output, and the input buffer may still be partly
- full. If `crc_i_flag' is set, add each byte to `crc'.
- IN_DES is the file descriptor for input;
- OUT_DES is the file descriptor for output;
- NUM_BYTES is the number of bytes to copy. */
-
-void
-copy_files_disk_to_disk (in_des, out_des, num_bytes, filename)
- int in_des;
- int out_des;
- long num_bytes;
- char *filename;
-{
- long size;
- long k;
- long original_num_bytes;
- int rc;
-
- original_num_bytes = num_bytes;
- while (num_bytes > 0)
- {
- if (input_size == 0)
- if (rc = disk_fill_input_buffer (in_des, DISK_IO_BLOCK_SIZE))
- {
- if (rc > 0)
- error (0, 0, "File %s shrunk by %ld bytes, padding with zeros",
- filename, num_bytes);
- else
- error (0, 0, "Read error at byte %ld in file %s, padding with zeros",
- original_num_bytes - num_bytes, filename);
- write_nuls_to_file (num_bytes, out_des);
- break;
- }
- size = (input_size < num_bytes) ? input_size : num_bytes;
- if (crc_i_flag)
- {
- for (k = 0; k < size; ++k)
- crc += in_buff[k] & 0xff;
- }
- disk_buffered_write (in_buff, out_des, size);
- num_bytes -= size;
- input_size -= size;
- in_buff += size;
- }
-}
-
-/* Create all directories up to but not including the last part of NAME.
- Do not destroy any nondirectories while creating directories. */
-
-void
-create_all_directories (name)
- char *name;
-{
- char *dir;
- int mode;
-#ifdef HPUX_CDF
- int cdf;
-#endif
-
- dir = dirname (name);
- mode = 0700;
-#ifdef HPUX_CDF
- cdf = islastparentcdf (name);
- if (cdf)
- {
- dir [strlen (dir) - 1] = '\0'; /* remove final + */
- mode = 04700;
- }
-
-#endif
-
- if (dir == NULL)
- error (2, 0, "virtual memory exhausted");
-
- if (dir[0] != '.' || dir[1] != '\0')
- make_path (dir, mode, 0700, -1, -1, (char *) NULL);
-
- free (dir);
-}
-
-/* Prepare to append to an archive. We have been in
- process_copy_in, keeping track of the position where
- the last header started in `last_header_start'. Now we
- have the starting position of the last header (the TRAILER!!!
- header, or blank record for tar archives) and we want to start
- writing (appending) over the last header. The last header may
- be in the middle of a block, so to keep the buffering in sync
- we lseek back to the start of the block, read everything up
- to but not including the last header, lseek back to the start
- of the block, and then do a copy_buf_out of what we read.
- Actually, we probably don't have to worry so much about keeping the
- buffering perfect since you can only append to archives that
- are disk files. */
-
-void
-prepare_append (out_file_des)
- int out_file_des;
-{
- int start_of_header;
- int start_of_block;
- int useful_bytes_in_block;
- char *tmp_buf;
-
- start_of_header = last_header_start;
- /* Figure out how many bytes we will rewrite, and where they start. */
- useful_bytes_in_block = start_of_header % io_block_size;
- start_of_block = start_of_header - useful_bytes_in_block;
-
- if (lseek (out_file_des, start_of_block, SEEK_SET) < 0)
- error (1, errno, "cannot seek on output");
- if (useful_bytes_in_block > 0)
- {
- tmp_buf = (char *) xmalloc (useful_bytes_in_block);
- read (out_file_des, tmp_buf, useful_bytes_in_block);
- if (lseek (out_file_des, start_of_block, SEEK_SET) < 0)
- error (1, errno, "cannot seek on output");
- /* fix juo -- is this copy_tape_buf_out? or copy_disk? */
- tape_buffered_write (tmp_buf, out_file_des, useful_bytes_in_block);
- free (tmp_buf);
- }
-
- /* We are done reading the archive, so clear these since they
- will now be used for reading in files that we are appending
- to the archive. */
- input_size = 0;
- input_bytes = 0;
- in_buff = input_buffer;
-}
-
-/* Support for remembering inodes with multiple links. Used in the
- "copy in" and "copy pass" modes for making links instead of copying
- the file. */
-
-struct inode_val
-{
- unsigned long inode;
- unsigned long major_num;
- unsigned long minor_num;
- char *file_name;
-};
-
-/* Inode hash table. Allocated by first call to add_inode. */
-static struct inode_val **hash_table = NULL;
-
-/* Size of current hash table. Initial size is 47. (47 = 2*22 + 3) */
-static int hash_size = 22;
-
-/* Number of elements in current hash table. */
-static int hash_num;
-
-/* Find the file name associated with NODE_NUM. If there is no file
- associated with NODE_NUM, return NULL. */
-
-char *
-find_inode_file (node_num, major_num, minor_num)
- unsigned long node_num;
- unsigned long major_num;
- unsigned long minor_num;
-{
-#ifndef __MSDOS__
- int start; /* Initial hash location. */
- int temp; /* Rehash search variable. */
-
- if (hash_table != NULL)
- {
- /* Hash function is node number modulo the table size. */
- start = node_num % hash_size;
-
- /* Initial look into the table. */
- if (hash_table[start] == NULL)
- return NULL;
- if (hash_table[start]->inode == node_num
- && hash_table[start]->major_num == major_num
- && hash_table[start]->minor_num == minor_num)
- return hash_table[start]->file_name;
-
- /* The home position is full with a different inode record.
- Do a linear search terminated by a NULL pointer. */
- for (temp = (start + 1) % hash_size;
- hash_table[temp] != NULL && temp != start;
- temp = (temp + 1) % hash_size)
- {
- if (hash_table[temp]->inode == node_num
- && hash_table[start]->major_num == major_num
- && hash_table[start]->minor_num == minor_num)
- return hash_table[temp]->file_name;
- }
- }
-#endif
- return NULL;
-}
-
-/* Associate FILE_NAME with the inode NODE_NUM. (Insert into hash table.) */
-
-void
-add_inode (node_num, file_name, major_num, minor_num)
- unsigned long node_num;
- char *file_name;
- unsigned long major_num;
- unsigned long minor_num;
-{
-#ifndef __MSDOS__
- struct inode_val *temp;
-
- /* Create new inode record. */
- temp = (struct inode_val *) xmalloc (sizeof (struct inode_val));
- temp->inode = node_num;
- temp->major_num = major_num;
- temp->minor_num = minor_num;
- temp->file_name = xstrdup (file_name);
-
- /* Do we have to increase the size of (or initially allocate)
- the hash table? */
- if (hash_num == hash_size || hash_table == NULL)
- {
- struct inode_val **old_table; /* Pointer to old table. */
- int i; /* Index for re-insert loop. */
-
- /* Save old table. */
- old_table = hash_table;
- if (old_table == NULL)
- hash_num = 0;
-
- /* Calculate new size of table and allocate it.
- Sequence of table sizes is 47, 97, 197, 397, 797, 1597, 3197, 6397 ...
- where 3197 and most of the sizes after 6397 are not prime. The other
- numbers listed are prime. */
- hash_size = 2 * hash_size + 3;
- hash_table = (struct inode_val **)
- xmalloc (hash_size * sizeof (struct inode_val *));
- bzero (hash_table, hash_size * sizeof (struct inode_val *));
-
- /* Insert the values from the old table into the new table. */
- for (i = 0; i < hash_num; i++)
- hash_insert (old_table[i]);
-
- if (old_table != NULL)
- free (old_table);
- }
-
- /* Insert the new record and increment the count of elements in the
- hash table. */
- hash_insert (temp);
- hash_num++;
-#endif /* __MSDOS__ */
-}
-
-/* Do the hash insert. Used in normal inserts and resizing the hash
- table. It is guaranteed that there is room to insert the item.
- NEW_VALUE is the pointer to the previously allocated inode, file
- name association record. */
-
-static void
-hash_insert (new_value)
- struct inode_val *new_value;
-{
- int start; /* Home position for the value. */
- int temp; /* Used for rehashing. */
-
- /* Hash function is node number modulo the table size. */
- start = new_value->inode % hash_size;
-
- /* Do the initial look into the table. */
- if (hash_table[start] == NULL)
- {
- hash_table[start] = new_value;
- return;
- }
-
- /* If we get to here, the home position is full with a different inode
- record. Do a linear search for the first NULL pointer and insert
- the new item there. */
- temp = (start + 1) % hash_size;
- while (hash_table[temp] != NULL)
- temp = (temp + 1) % hash_size;
-
- /* Insert at the NULL. */
- hash_table[temp] = new_value;
-}
-
-/* Open FILE in the mode specified by the command line options
- and return an open file descriptor for it,
- or -1 if it can't be opened. */
-
-int
-open_archive (file)
- char *file;
-{
- int fd;
- void (*copy_in) (); /* Workaround for pcc bug. */
-
- copy_in = process_copy_in;
-
- if (copy_function == copy_in)
- fd = rmtopen (file, O_RDONLY | O_BINARY, 0666);
- else
- {
- if (!append_flag)
- fd = rmtopen (file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
- else
- fd = rmtopen (file, O_RDWR | O_BINARY, 0666);
- }
-
- return fd;
-}
-
-/* Attempt to rewind the tape drive on file descriptor TAPE_DES
- and take it offline. */
-
-void
-tape_offline (tape_des)
- int tape_des;
-{
-#if defined(MTIOCTOP) && defined(MTOFFL)
- struct mtop control;
-
- control.mt_op = MTOFFL;
- control.mt_count = 1;
- rmtioctl (tape_des, MTIOCTOP, &control); /* Don't care if it fails. */
-#endif
-}
-
-/* The file on file descriptor TAPE_DES is assumed to be magnetic tape
- (or floppy disk or other device) and the end of the medium
- has been reached. Ask the user for to mount a new "tape" to continue
- the processing. If the user specified the device name on the
- command line (with the -I, -O, -F or --file options), then we can
- automatically re-open the same device to use the next medium. If the
- user did not specify the device name, then we have to ask them which
- device to use. */
-
-void
-get_next_reel (tape_des)
- int tape_des;
-{
- static int reel_number = 1;
- FILE *tty_in; /* File for interacting with user. */
- FILE *tty_out; /* File for interacting with user. */
- int old_tape_des;
- char *next_archive_name;
- dynamic_string new_name;
- char *str_res;
-
- ds_init (&new_name, 128);
-
- /* Open files for interactive communication. */
- tty_in = fopen (CONSOLE, "r");
- if (tty_in == NULL)
- error (2, errno, CONSOLE);
- tty_out = fopen (CONSOLE, "w");
- if (tty_out == NULL)
- error (2, errno, CONSOLE);
-
- old_tape_des = tape_des;
- tape_offline (tape_des);
- rmtclose (tape_des);
-
- /* Give message and wait for carrage return. User should hit carrage return
- only after loading the next tape. */
- ++reel_number;
- if (new_media_message)
- fprintf (tty_out, "%s", new_media_message);
- else if (new_media_message_with_number)
- fprintf (tty_out, "%s%d%s", new_media_message_with_number, reel_number,
- new_media_message_after_number);
- else if (archive_name)
- fprintf (tty_out, "Found end of volume. Load next volume and press RETURN. ");
- else
- fprintf (tty_out, "Found end of volume. To continue, type device/file name when ready.\n");
-
- fflush (tty_out);
-
- if (archive_name)
- {
- int c;
-
- do
- c = getc (tty_in);
- while (c != EOF && c != '\n');
-
- tape_des = open_archive (archive_name);
- if (tape_des == -1)
- error (1, errno, "%s", archive_name);
- }
- else
- {
- do
- {
- if (tape_des < 0)
- {
- fprintf (tty_out,
- "To continue, type device/file name when ready.\n");
- fflush (tty_out);
- }
-
- str_res = ds_fgets (tty_in, &new_name);
- if (str_res == NULL || str_res[0] == '\0')
- exit (1);
- next_archive_name = str_res;
-
- tape_des = open_archive (next_archive_name);
- if (tape_des == -1)
- error (0, errno, "%s", next_archive_name);
- }
- while (tape_des < 0);
- }
-
- /* We have to make sure that `tape_des' has not changed its value even
- though we closed it and reopened it, since there are local
- copies of it in other routines. This works fine on Unix (even with
- rmtread and rmtwrite) since open will always return the lowest
- available file descriptor and we haven't closed any files (e.g.,
- stdin, stdout or stderr) that were opened before we originally opened
- the archive. */
-
- if (tape_des != old_tape_des)
- error (1, 0, "internal error: tape descriptor changed from %d to %d",
- old_tape_des, tape_des);
-
- free (new_name.ds_string);
- fclose (tty_in);
- fclose (tty_out);
-}
-
-/* If MESSAGE does not contain the string "%d", make `new_media_message'
- a copy of MESSAGE. If MESSAGES does contain the string "%d", make
- `new_media_message_with_number' a copy of MESSAGE up to, but
- not including, the string "%d", and make `new_media_message_after_number'
- a copy of MESSAGE after the string "%d". */
-
-void
-set_new_media_message (message)
- char *message;
-{
- char *p;
- int prev_was_percent;
-
- p = message;
- prev_was_percent = 0;
- while (*p != '\0')
- {
- if (*p == 'd' && prev_was_percent)
- break;
- prev_was_percent = (*p == '%');
- ++p;
- }
- if (*p == '\0')
- {
- new_media_message = xstrdup (message);
- }
- else
- {
- int length = p - message - 1;
-
- new_media_message_with_number = xmalloc (length + 1);
- strncpy (new_media_message_with_number, message, length);
- new_media_message_with_number[length] = '\0';
- length = strlen (p + 1);
- new_media_message_after_number = xmalloc (length + 1);
- strcpy (new_media_message_after_number, p + 1);
- }
-}
-
-#ifdef SYMLINK_USES_UMASK
-/* Most machines always create symlinks with rwxrwxrwx protection,
- but some (HP/UX 8.07; maybe DEC's OSF on MIPS, too?) use the
- umask when creating symlinks, so if your umask is 022 you end
- up with rwxr-xr-x symlinks (although HP/UX seems to completely
- ignore the protection). There doesn't seem to be any way to
- manipulate the modes once the symlinks are created (e.g.
- a hypothetical "lchmod"), so to create them with the right
- modes we have to set the umask first. */
-
-int
-umasked_symlink (name1, name2, mode)
- char *name1;
- char *name2;
- int mode;
-{
- int old_umask;
- int rc;
- mode = ~(mode & 0777) & 0777;
- old_umask = umask (mode);
- rc = symlink (name1, name2);
- umask (old_umask);
- return rc;
-}
-#endif /* SYMLINK_USES_UMASK */
-
-#if defined(__MSDOS__) && !defined(__GNUC__)
-int
-chown (path, owner, group)
- char *path;
- int owner, group;
-{
- return 0;
-}
-#endif
-
-#ifdef __TURBOC__
-#include <time.h>
-#include <fcntl.h>
-#include <io.h>
-
-int
-utime (char *filename, struct utimbuf *utb)
-{
- extern int errno;
- struct tm *tm;
- struct ftime filetime;
- time_t when;
- int fd;
- int status;
-
- if (utb == 0)
- when = time (0);
- else
- when = utb->modtime;
-
- fd = _open (filename, O_RDWR);
- if (fd == -1)
- return -1;
-
- tm = localtime (&when);
- if (tm->tm_year < 80)
- filetime.ft_year = 0;
- else
- filetime.ft_year = tm->tm_year - 80;
- filetime.ft_month = tm->tm_mon + 1;
- filetime.ft_day = tm->tm_mday;
- if (tm->tm_hour < 0)
- filetime.ft_hour = 0;
- else
- filetime.ft_hour = tm->tm_hour;
- filetime.ft_min = tm->tm_min;
- filetime.ft_tsec = tm->tm_sec / 2;
-
- status = setftime (fd, &filetime);
- _close (fd);
- return status;
-}
-#endif
-#ifdef HPUX_CDF
-/* When we create a cpio archive we mark CDF's by putting an extra `/'
- after their component name so we can distinguish the CDF's when we
- extract the archive (in case the "hidden" directory's files appear
- in the archive before the directory itself). E.g., in the path
- "a/b+/c", if b+ is a CDF, we will write this path as "a/b+//c" in
- the archive so when we extract the archive we will know that b+
- is actually a CDF, and not an ordinary directory whose name happens
- to end in `+'. We also do the same thing internally in copypass.c. */
-
-
-/* Take an input pathname and check it for CDF's. Insert an extra
- `/' in the pathname after each "hidden" directory. If we add
- any `/'s, return a malloced string (which it will reuse for
- later calls so our caller doesn't have to worry about freeing
- the string) instead of the original input string. */
-
-char *
-add_cdf_double_slashes (input_name)
- char *input_name;
-{
- static char *ret_name = NULL; /* re-usuable return buffer (malloc'ed) */
- static int ret_size = -1; /* size of return buffer. */
- char *p;
- char *q;
- int n;
- struct stat dir_stat;
-
- /* Search for a `/' preceeded by a `+'. */
-
- for (p = input_name; *p != '\0'; ++p)
- {
- if ( (*p == '+') && (*(p + 1) == '/') )
- break;
- }
-
- /* If we didn't find a `/' preceeded by a `+' then there are
- no CDF's in this pathname. Return the original pathname. */
-
- if (*p == '\0')
- return input_name;
-
- /* There was a `/' preceeded by a `+' in the pathname. If it is a CDF
- then we will need to copy the input pathname to our return
- buffer so we can insert the extra `/'s. Since we can't tell
- yet whether or not it is a CDF we will just always copy the
- string to the return buffer. First we have to make sure the
- buffer is large enough to hold the string and any number of
- extra `/'s we might add. */
-
- n = 2 * (strlen (input_name) + 1);
- if (n >= ret_size)
- {
- if (ret_size < 0)
- ret_name = (char *) malloc (n);
- else
- ret_name = (char *)realloc (ret_name, n);
- ret_size = n;
- }
-
- /* Clear the `/' after this component, so we can stat the pathname
- up to and including this component. */
- ++p;
- *p = '\0';
- if ((*xstat) (input_name, &dir_stat) < 0)
- {
- error (0, errno, "%s", input_name);
- return input_name;
- }
-
- /* Now put back the `/' after this component and copy the pathname up to
- and including this component and its trailing `/' to the return
- buffer. */
- *p++ = '/';
- strncpy (ret_name, input_name, p - input_name);
- q = ret_name + (p - input_name);
-
- /* If it was a CDF, add another `/'. */
- if (S_ISDIR (dir_stat.st_mode) && (dir_stat.st_mode & 04000) )
- *q++ = '/';
-
- /* Go through the rest of the input pathname, copying it to the
- return buffer, and adding an extra `/' after each CDF. */
- while (*p != '\0')
- {
- if ( (*p == '+') && (*(p + 1) == '/') )
- {
- *q++ = *p++;
-
- *p = '\0';
- if ((*xstat) (input_name, &dir_stat) < 0)
- {
- error (0, errno, "%s", input_name);
- return input_name;
- }
- *p = '/';
-
- if (S_ISDIR (dir_stat.st_mode) && (dir_stat.st_mode & 04000) )
- *q++ = '/';
- }
- *q++ = *p++;
- }
- *q = '\0';
-
- return ret_name;
-}
-
-/* Is the last parent directory (e.g., c in a/b/c/d) a CDF? If the
- directory name ends in `+' and is followed by 2 `/'s instead of 1
- then it is. This is only the case for cpio archives, but we don't
- have to worry about tar because tar always has the directory before
- its files (or else we lose). */
-
-islastparentcdf(path)
- char *path;
-{
- char *newpath;
- char *slash;
- int slash_count;
- int length; /* Length of result, not including NUL. */
-
- slash = rindex (path, '/');
- if (slash == 0)
- return 0;
- else
- {
- slash_count = 0;
- while (slash > path && *slash == '/')
- {
- ++slash_count;
- --slash;
- }
-
-
- if ( (*slash == '+') && (slash_count >= 2) )
- return 1;
- }
- return 0;
-}
-#endif
-
-#define DISKBLOCKSIZE (512)
-
-enum sparse_write_states { begin, in_zeros, not_in_zeros };
-
-
-static int
-buf_all_zeros (buf, bufsize)
- char *buf;
- int bufsize;
-{
- int i;
- for (i = 0; i < bufsize; ++i)
- {
- if (*buf++ != '\0')
- return 0;
- }
- return 1;
-}
-
-int delayed_seek_count = 0;
-
-/* Write NBYTE bytes from BUF to remote tape connection FILDES.
- Return the number of bytes written on success, -1 on error. */
-
-int
-sparse_write (fildes, buf, nbyte)
- int fildes;
- char *buf;
- unsigned int nbyte;
-{
- int complete_block_count;
- int leftover_bytes_count;
- int seek_count;
- int write_count;
- char *cur_write_start;
- int lseek_rc;
- int write_rc;
- int i;
- enum sparse_write_states state;
-
- complete_block_count = nbyte / DISKBLOCKSIZE;
- leftover_bytes_count = nbyte % DISKBLOCKSIZE;
-
- if (delayed_seek_count != 0)
- state = in_zeros;
- else
- state = begin;
-
- seek_count = delayed_seek_count;
-
- for (i = 0; i < complete_block_count; ++i)
- {
- switch (state)
- {
- case begin :
- if (buf_all_zeros (buf, DISKBLOCKSIZE))
- {
- seek_count = DISKBLOCKSIZE;
- state = in_zeros;
- }
- else
- {
- cur_write_start = buf;
- write_count = DISKBLOCKSIZE;
- state = not_in_zeros;
- }
- buf += DISKBLOCKSIZE;
- break;
- case in_zeros :
- if (buf_all_zeros (buf, DISKBLOCKSIZE))
- {
- seek_count += DISKBLOCKSIZE;
- }
- else
- {
- lseek (fildes, seek_count, SEEK_CUR);
- cur_write_start = buf;
- write_count = DISKBLOCKSIZE;
- state = not_in_zeros;
- }
- buf += DISKBLOCKSIZE;
- break;
- case not_in_zeros :
- if (buf_all_zeros (buf, DISKBLOCKSIZE))
- {
- write_rc = write (fildes, cur_write_start, write_count);
- seek_count = DISKBLOCKSIZE;
- state = in_zeros;
- }
- else
- {
- write_count += DISKBLOCKSIZE;
- }
- buf += DISKBLOCKSIZE;
- break;
- }
- }
-
- switch (state)
- {
- case begin :
- case in_zeros :
- delayed_seek_count = seek_count;
- break;
- case not_in_zeros :
- write_rc = write (fildes, cur_write_start, write_count);
- delayed_seek_count = 0;
- break;
- }
-
- if (leftover_bytes_count != 0)
- {
- if (delayed_seek_count != 0)
- {
- lseek_rc = lseek (fildes, delayed_seek_count, SEEK_CUR);
- delayed_seek_count = 0;
- }
- write_rc = write (fildes, buf, leftover_bytes_count);
- }
- return nbyte;
-}
-
-static void
-write_nuls_to_file (num_bytes, out_des)
- long num_bytes;
- int out_des;
-{
- long blocks;
- long extra_bytes;
- long i;
-
- blocks = num_bytes / 512;
- extra_bytes = num_bytes % 512;
- for (i = 0; i < extra_bytes; ++i)
- {
- if (write (out_des, zeros_512, 512) != 512)
- error (1, errno, "error writing NUL's");
- }
- if (extra_bytes != 0)
- {
- if (write (out_des, zeros_512, extra_bytes) != extra_bytes)
- error (1, errno, "error writing NUL's");
- }
-}
diff --git a/contrib/cpio/version.c b/contrib/cpio/version.c
deleted file mode 100644
index c641a3a02010..000000000000
--- a/contrib/cpio/version.c
+++ /dev/null
@@ -1,2 +0,0 @@
-/* The version number of cpio and mt. */
-char *version_string = "version 2.4.2\n";
diff --git a/contrib/cpio/xmalloc.c b/contrib/cpio/xmalloc.c
deleted file mode 100644
index bad831f5db59..000000000000
--- a/contrib/cpio/xmalloc.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* xmalloc.c -- malloc with out of memory checking
- Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#if __STDC__
-#define VOID void
-#else
-#define VOID char
-#endif
-
-#include <sys/types.h>
-
-#if STDC_HEADERS
-#include <stdlib.h>
-#else
-VOID *malloc ();
-VOID *realloc ();
-void free ();
-#endif
-
-/* This is for other GNU distributions with internationalized messages.
- The GNU C Library itself does not yet support such messages. */
-#if HAVE_LIBINTL_H
-# include <libintl.h>
-#else
-# define gettext(msgid) (msgid)
-#endif
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif
-
-/* Exit value when the requested amount of memory is not available.
- The caller may set it to some other value. */
-int xmalloc_exit_failure = EXIT_FAILURE;
-
-#if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT)
-void error (int, int, const char *, ...);
-#else
-void error ();
-#endif
-
-static VOID *
-fixup_null_alloc (n)
- size_t n;
-{
- VOID *p;
-
- p = 0;
- if (n == 0)
- p = malloc ((size_t) 1);
- if (p == 0)
- error (xmalloc_exit_failure, 0, gettext ("Memory exhausted"));
- return p;
-}
-
-/* Allocate N bytes of memory dynamically, with error checking. */
-
-VOID *
-xmalloc (n)
- size_t n;
-{
- VOID *p;
-
- p = malloc (n);
- if (p == 0)
- p = fixup_null_alloc (n);
- return p;
-}
-
-/* Change the size of an allocated block of memory P to N bytes,
- with error checking.
- If P is NULL, run xmalloc. */
-
-VOID *
-xrealloc (p, n)
- VOID *p;
- size_t n;
-{
- if (p == 0)
- return xmalloc (n);
- p = realloc (p, n);
- if (p == 0)
- p = fixup_null_alloc (n);
- return p;
-}
diff --git a/contrib/cpio/xstrdup.c b/contrib/cpio/xstrdup.c
deleted file mode 100644
index 27cd0c6738ce..000000000000
--- a/contrib/cpio/xstrdup.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* xstrdup.c -- copy a string with out of memory checking
- Copyright (C) 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-char *xmalloc ();
-
-/* Return a newly allocated copy of STRING. */
-
-char *
-xstrdup (string)
- char *string;
-{
- return strcpy (xmalloc (strlen (string) + 1), string);
-}
diff --git a/crypto/README b/crypto/README
deleted file mode 100644
index 004485eadec0..000000000000
--- a/crypto/README
+++ /dev/null
@@ -1,9 +0,0 @@
-This directory is for the EXACT same use as src/contrib, execpt it
-holds crypto sources. As a consequence of USA law, this makes it export
-controlled, so it has to be kept separate.
-
-Please do not export the contents of this direcory and its
-subdirectories from the USA without the necessary permits.
-
-Mark Murray
-3 May, 1997
diff --git a/lib/libF77/lbitbits.c b/lib/libF77/lbitbits.c
deleted file mode 100644
index 75e9f9c603f9..000000000000
--- a/lib/libF77/lbitbits.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "f2c.h"
-
-#ifndef LONGBITS
-#define LONGBITS 32
-#endif
-
- integer
-#ifdef KR_headers
-lbit_bits(a, b, len) integer a, b, len;
-#else
-lbit_bits(integer a, integer b, integer len)
-#endif
-{
- /* Assume 2's complement arithmetic */
-
- unsigned long x, y;
-
- x = (unsigned long) a;
- y = (unsigned long)-1L;
- x >>= b;
- y <<= len;
- return (integer)(x & ~y);
- }
-
- integer
-#ifdef KR_headers
-lbit_cshift(a, b, len) integer a, b, len;
-#else
-lbit_cshift(integer a, integer b, integer len)
-#endif
-{
- unsigned long x, y, z;
-
- x = (unsigned long)a;
- if (len <= 0) {
- if (len == 0)
- return 0;
- goto full_len;
- }
- if (len >= LONGBITS) {
- full_len:
- if (b >= 0) {
- b %= LONGBITS;
- return (integer)(x << b | x >> LONGBITS -b );
- }
- b = -b;
- b %= LONGBITS;
- return (integer)(x << LONGBITS - b | x >> b);
- }
- y = z = (unsigned long)-1;
- y <<= len;
- z &= ~y;
- y &= x;
- x &= z;
- if (b >= 0) {
- b %= len;
- return (integer)(y | z & (x << b | x >> len - b));
- }
- b = -b;
- b %= len;
- return (integer)(y | z & (x >> b | x << len - b));
- }
diff --git a/lib/libF77/lbitshft.c b/lib/libF77/lbitshft.c
deleted file mode 100644
index 81b0fdbeaba1..000000000000
--- a/lib/libF77/lbitshft.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "f2c.h"
-
- integer
-#ifdef KR_headers
-lbit_shift(a, b) integer a; integer b;
-#else
-lbit_shift(integer a, integer b)
-#endif
-{
- return b >= 0 ? a << b : (integer)((uinteger)a >> -b);
- }
diff --git a/lib/libF77/signal1.h b/lib/libF77/signal1.h
deleted file mode 100644
index 8800a18d77b4..000000000000
--- a/lib/libF77/signal1.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* You may need to adjust the definition of signal1 to supply a */
-/* cast to the correct argument type. This detail is system- and */
-/* compiler-dependent. The #define below assumes signal.h declares */
-/* type SIG_PF for the signal function's second argument. */
-
-#include <signal.h>
-
-#ifndef Sigret_t
-#define Sigret_t void
-#endif
-#ifndef Sigarg_t
-#ifdef KR_headers
-#define Sigarg_t
-#else
-#define Sigarg_t int
-#endif
-#endif /*Sigarg_t*/
-
-#ifdef USE_SIG_PF /* compile with -DUSE_SIG_PF under IRIX */
-#define sig_pf SIG_PF
-#else
-typedef Sigret_t (*sig_pf)(Sigarg_t);
-#endif
-
-#define signal1(a,b) signal(a,(sig_pf)b)
diff --git a/lib/libc/Makefile.inc b/lib/libc/Makefile.inc
deleted file mode 100644
index 1f51b57644b9..000000000000
--- a/lib/libc/Makefile.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-# $Id$
-#
-# This file contains make rules that are shared by libc and libc_r.
-#
-.include "${.CURDIR}/../libc/db/Makefile.inc"
-.include "${.CURDIR}/../libc/compat-43/Makefile.inc"
-.include "${.CURDIR}/../libc/gen/Makefile.inc"
-.include "${.CURDIR}/../libc/gmon/Makefile.inc"
-.include "${.CURDIR}/../libc/locale/Makefile.inc"
-.include "${.CURDIR}/../libc/net/Makefile.inc"
-.include "${.CURDIR}/../libc/nls/Makefile.inc"
-.include "${.CURDIR}/../libc/quad/Makefile.inc"
-.include "${.CURDIR}/../libc/regex/Makefile.inc"
-.include "${.CURDIR}/../libc/stdio/Makefile.inc"
-.include "${.CURDIR}/../libc/stdlib/Makefile.inc"
-.include "${.CURDIR}/../libc/stdtime/Makefile.inc"
-.include "${.CURDIR}/../libc/string/Makefile.inc"
-.include "${.CURDIR}/../libc/sys/Makefile.inc"
-.include "${.CURDIR}/../libc/rpc/Makefile.inc"
-.include "${.CURDIR}/../libc/xdr/Makefile.inc"
-.if !defined(NO_YP_LIBC)
-CFLAGS+= -DYP
-.include "${.CURDIR}/../libc/yp/Makefile.inc"
-.endif
-.include "${.CURDIR}/../libc/${MACHINE}/sys/Makefile.inc"
diff --git a/lib/libc/i386/string/memcpy.S b/lib/libc/i386/string/memcpy.S
deleted file mode 100644
index 1617c7153aac..000000000000
--- a/lib/libc/i386/string/memcpy.S
+++ /dev/null
@@ -1,2 +0,0 @@
-#define MEMCOPY
-#include "bcopy.S"
diff --git a/lib/libc/net/base64.c b/lib/libc/net/base64.c
deleted file mode 100644
index 868826a777dc..000000000000
--- a/lib/libc/net/base64.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-/*
- * Portions Copyright (c) 1995 by International Business Machines, Inc.
- *
- * International Business Machines, Inc. (hereinafter called IBM) grants
- * permission under its copyrights to use, copy, modify, and distribute this
- * Software with or without fee, provided that the above copyright notice and
- * all paragraphs of this notice appear in all copies, and that the name of IBM
- * not be used in connection with the marketing of any product incorporating
- * the Software or modifications thereof, without specific, written prior
- * permission.
- *
- * To the extent it has a right to do so, IBM grants an immunity from suit
- * under its patents, if any, for the use, sale or manufacture of products to
- * the extent that such products are used for performing Domain Name System
- * dynamic updates in TCP/IP networks by means of the Software. No immunity is
- * granted for any product per se or for any other function of any product.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
- * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
- * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-#include <ctype.h>
-#include <resolv.h>
-#include <stdio.h>
-
-#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
-# include <stdlib.h>
-# include <string.h>
-#else
-# include "../conf/portability.h"
-#endif
-
-#define Assert(Cond) if (!(Cond)) abort()
-
-static const char Base64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-static const char Pad64 = '=';
-
-/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
- The following encoding technique is taken from RFC 1521 by Borenstein
- and Freed. It is reproduced here in a slightly edited form for
- convenience.
-
- A 65-character subset of US-ASCII is used, enabling 6 bits to be
- represented per printable character. (The extra 65th character, "=",
- is used to signify a special processing function.)
-
- The encoding process represents 24-bit groups of input bits as output
- strings of 4 encoded characters. Proceeding from left to right, a
- 24-bit input group is formed by concatenating 3 8-bit input groups.
- These 24 bits are then treated as 4 concatenated 6-bit groups, each
- of which is translated into a single digit in the base64 alphabet.
-
- Each 6-bit group is used as an index into an array of 64 printable
- characters. The character referenced by the index is placed in the
- output string.
-
- Table 1: The Base64 Alphabet
-
- Value Encoding Value Encoding Value Encoding Value Encoding
- 0 A 17 R 34 i 51 z
- 1 B 18 S 35 j 52 0
- 2 C 19 T 36 k 53 1
- 3 D 20 U 37 l 54 2
- 4 E 21 V 38 m 55 3
- 5 F 22 W 39 n 56 4
- 6 G 23 X 40 o 57 5
- 7 H 24 Y 41 p 58 6
- 8 I 25 Z 42 q 59 7
- 9 J 26 a 43 r 60 8
- 10 K 27 b 44 s 61 9
- 11 L 28 c 45 t 62 +
- 12 M 29 d 46 u 63 /
- 13 N 30 e 47 v
- 14 O 31 f 48 w (pad) =
- 15 P 32 g 49 x
- 16 Q 33 h 50 y
-
- Special processing is performed if fewer than 24 bits are available
- at the end of the data being encoded. A full encoding quantum is
- always completed at the end of a quantity. When fewer than 24 input
- bits are available in an input group, zero bits are added (on the
- right) to form an integral number of 6-bit groups. Padding at the
- end of the data is performed using the '=' character.
-
- Since all base64 input is an integral number of octets, only the
- -------------------------------------------------
- following cases can arise:
-
- (1) the final quantum of encoding input is an integral
- multiple of 24 bits; here, the final unit of encoded
- output will be an integral multiple of 4 characters
- with no "=" padding,
- (2) the final quantum of encoding input is exactly 8 bits;
- here, the final unit of encoded output will be two
- characters followed by two "=" padding characters, or
- (3) the final quantum of encoding input is exactly 16 bits;
- here, the final unit of encoded output will be three
- characters followed by one "=" padding character.
- */
-
-int
-b64_ntop(src, srclength, target, targsize)
- u_char const *src;
- size_t srclength;
- char *target;
- size_t targsize;
-{
- size_t datalength = 0;
- u_char input[3];
- u_char output[4];
- int i;
-
- while (2 < srclength) {
- input[0] = *src++;
- input[1] = *src++;
- input[2] = *src++;
- srclength -= 3;
-
- output[0] = input[0] >> 2;
- output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
- output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
- output[3] = input[2] & 0x3f;
- Assert(output[0] < 64);
- Assert(output[1] < 64);
- Assert(output[2] < 64);
- Assert(output[3] < 64);
-
- if (datalength + 4 > targsize)
- return (-1);
- target[datalength++] = Base64[output[0]];
- target[datalength++] = Base64[output[1]];
- target[datalength++] = Base64[output[2]];
- target[datalength++] = Base64[output[3]];
- }
-
- /* Now we worry about padding. */
- if (0 != srclength) {
- /* Get what's left. */
- input[0] = input[1] = input[2] = '\0';
- for (i = 0; i < srclength; i++)
- input[i] = *src++;
-
- output[0] = input[0] >> 2;
- output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
- output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
- Assert(output[0] < 64);
- Assert(output[1] < 64);
- Assert(output[2] < 64);
-
- if (datalength + 4 > targsize)
- return (-1);
- target[datalength++] = Base64[output[0]];
- target[datalength++] = Base64[output[1]];
- if (srclength == 1)
- target[datalength++] = Pad64;
- else
- target[datalength++] = Base64[output[2]];
- target[datalength++] = Pad64;
- }
- if (datalength >= targsize)
- return (-1);
- target[datalength] = '\0'; /* Returned value doesn't count \0. */
- return (datalength);
-}
-
-/* skips all whitespace anywhere.
- converts characters, four at a time, starting at (or after)
- src from base - 64 numbers into three 8 bit bytes in the target area.
- it returns the number of data bytes stored at the target, or -1 on error.
- */
-
-int
-b64_pton(src, target, targsize)
- char const *src;
- u_char *target;
- size_t targsize;
-{
- int tarindex, state, ch;
- char *pos;
-
- state = 0;
- tarindex = 0;
-
- while ((ch = *src++) != '\0') {
- if (isspace(ch)) /* Skip whitespace anywhere. */
- continue;
-
- if (ch == Pad64)
- break;
-
- pos = strchr(Base64, ch);
- if (pos == 0) /* A non-base64 character. */
- return (-1);
-
- switch (state) {
- case 0:
- if (target) {
- if (tarindex >= targsize)
- return (-1);
- target[tarindex] = (pos - Base64) << 2;
- }
- state = 1;
- break;
- case 1:
- if (target) {
- if (tarindex + 1 >= targsize)
- return (-1);
- target[tarindex] |= (pos - Base64) >> 4;
- target[tarindex+1] = ((pos - Base64) & 0x0f)
- << 4 ;
- }
- tarindex++;
- state = 2;
- break;
- case 2:
- if (target) {
- if (tarindex + 1 >= targsize)
- return (-1);
- target[tarindex] |= (pos - Base64) >> 2;
- target[tarindex+1] = ((pos - Base64) & 0x03)
- << 6;
- }
- tarindex++;
- state = 3;
- break;
- case 3:
- if (target) {
- if (tarindex >= targsize)
- return (-1);
- target[tarindex] |= (pos - Base64);
- }
- tarindex++;
- state = 0;
- break;
- default:
- abort();
- }
- }
-
- /*
- * We are done decoding Base-64 chars. Let's see if we ended
- * on a byte boundary, and/or with erroneous trailing characters.
- */
-
- if (ch == Pad64) { /* We got a pad char. */
- ch = *src++; /* Skip it, get next. */
- switch (state) {
- case 0: /* Invalid = in first position */
- case 1: /* Invalid = in second position */
- return (-1);
-
- case 2: /* Valid, means one byte of info */
- /* Skip any number of spaces. */
- for (NULL; ch != '\0'; ch = *src++)
- if (!isspace(ch))
- break;
- /* Make sure there is another trailing = sign. */
- if (ch != Pad64)
- return (-1);
- ch = *src++; /* Skip the = */
- /* Fall through to "single trailing =" case. */
- /* FALLTHROUGH */
-
- case 3: /* Valid, means two bytes of info */
- /*
- * We know this char is an =. Is there anything but
- * whitespace after it?
- */
- for (NULL; ch != '\0'; ch = *src++)
- if (!isspace(ch))
- return (-1);
-
- /*
- * Now make sure for cases 2 and 3 that the "extra"
- * bits that slopped past the last full byte were
- * zeros. If we don't check them, they become a
- * subliminal channel.
- */
- if (target && target[tarindex] != 0)
- return (-1);
- }
- } else {
- /*
- * We ended by seeing the end of the string. Make sure we
- * have no partial bytes lying around.
- */
- if (state != 0)
- return (-1);
- }
-
- return (tarindex);
-}
diff --git a/lib/libc/net/inet_net_ntop.c b/lib/libc/net/inet_net_ntop.c
deleted file mode 100644
index 4c7893d417ff..000000000000
--- a/lib/libc/net/inet_net_ntop.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char orig_rcsid[] = "From Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp";
-static const char rcsid[] = "$Id$";
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
-static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
- char *dst, size_t size));
-
-/*
- * char *
- * inet_net_ntop(af, src, bits, dst, size)
- * convert network number from network to presentation format.
- * generates CIDR style result always.
- * return:
- * pointer to dst, or NULL if an error occurred (check errno).
- * author:
- * Paul Vixie (ISC), July 1996
- */
-char *
-inet_net_ntop(af, src, bits, dst, size)
- int af;
- const void *src;
- int bits;
- char *dst;
- size_t size;
-{
- switch (af) {
- case AF_INET:
- return (inet_net_ntop_ipv4(src, bits, dst, size));
- default:
- errno = EAFNOSUPPORT;
- return (NULL);
- }
-}
-
-/*
- * static char *
- * inet_net_ntop_ipv4(src, bits, dst, size)
- * convert IPv4 network number from network to presentation format.
- * generates CIDR style result always.
- * return:
- * pointer to dst, or NULL if an error occurred (check errno).
- * note:
- * network byte order assumed. this means 192.5.5.240/28 has
- * 0x11110000 in its fourth octet.
- * author:
- * Paul Vixie (ISC), July 1996
- */
-static char *
-inet_net_ntop_ipv4(src, bits, dst, size)
- const u_char *src;
- int bits;
- char *dst;
- size_t size;
-{
- char *odst = dst;
- char *t;
- u_int m;
- int b;
-
- if (bits < 0 || bits > 32) {
- errno = EINVAL;
- return (NULL);
- }
- if (bits == 0) {
- if (size < sizeof "0")
- goto emsgsize;
- *dst++ = '0';
- *dst = '\0';
- }
-
- /* Format whole octets. */
- for (b = bits / 8; b > 0; b--) {
- if (size < sizeof "255.")
- goto emsgsize;
- t = dst;
- dst += SPRINTF((dst, "%u", *src++));
- if (b > 1) {
- *dst++ = '.';
- *dst = '\0';
- }
- size -= (size_t)(dst - t);
- }
-
- /* Format partial octet. */
- b = bits % 8;
- if (b > 0) {
- if (size < sizeof ".255")
- goto emsgsize;
- t = dst;
- if (dst != odst)
- *dst++ = '.';
- m = ((1 << b) - 1) << (8 - b);
- dst += SPRINTF((dst, "%u", *src & m));
- size -= (size_t)(dst - t);
- }
-
- /* Format CIDR /width. */
- if (size < sizeof "/32")
- goto emsgsize;
- dst += SPRINTF((dst, "/%u", bits));
- return (odst);
-
- emsgsize:
- errno = EMSGSIZE;
- return (NULL);
-}
diff --git a/lib/libc/net/inet_net_pton.c b/lib/libc/net/inet_net_pton.c
deleted file mode 100644
index 6fd6a06c6da9..000000000000
--- a/lib/libc/net/inet_net_pton.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char orig_rcsid[] = "From Id: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp";
-static const char rcsid[] = "$Id$";
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
-static int inet_net_pton_ipv4 __P((const char *src, u_char *dst,
- size_t size));
-
-/*
- * static int
- * inet_net_pton(af, src, dst, size)
- * convert network number from presentation to network format.
- * accepts hex octets, hex strings, decimal octets, and /CIDR.
- * "size" is in bytes and describes "dst".
- * return:
- * number of bits, either imputed classfully or specified with /CIDR,
- * or -1 if some failure occurred (check errno). ENOENT means it was
- * not a valid network specification.
- * author:
- * Paul Vixie (ISC), June 1996
- */
-int
-inet_net_pton(af, src, dst, size)
- int af;
- const char *src;
- void *dst;
- size_t size;
-{
- switch (af) {
- case AF_INET:
- return (inet_net_pton_ipv4(src, dst, size));
- default:
- errno = EAFNOSUPPORT;
- return (-1);
- }
-}
-
-/*
- * static int
- * inet_net_pton_ipv4(src, dst, size)
- * convert IPv4 network number from presentation to network format.
- * accepts hex octets, hex strings, decimal octets, and /CIDR.
- * "size" is in bytes and describes "dst".
- * return:
- * number of bits, either imputed classfully or specified with /CIDR,
- * or -1 if some failure occurred (check errno). ENOENT means it was
- * not an IPv4 network specification.
- * note:
- * network byte order assumed. this means 192.5.5.240/28 has
- * 0x11110000 in its fourth octet.
- * author:
- * Paul Vixie (ISC), June 1996
- */
-static int
-inet_net_pton_ipv4(src, dst, size)
- const char *src;
- u_char *dst;
- size_t size;
-{
- static const char
- xdigits[] = "0123456789abcdef",
- digits[] = "0123456789";
- int n, ch, tmp, dirty, bits;
- const u_char *odst = dst;
-
- ch = *src++;
- if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
- && isascii(src[1]) && isxdigit(src[1])) {
- /* Hexadecimal: Eat nybble string. */
- if (size <= 0)
- goto emsgsize;
- *dst = 0, dirty = 0;
- src++; /* skip x or X. */
- while ((ch = *src++) != '\0' &&
- isascii(ch) && isxdigit(ch)) {
- if (isupper(ch))
- ch = tolower(ch);
- n = strchr(xdigits, ch) - xdigits;
- assert(n >= 0 && n <= 15);
- *dst |= n;
- if (!dirty++)
- *dst <<= 4;
- else if (size-- > 0)
- *++dst = 0, dirty = 0;
- else
- goto emsgsize;
- }
- if (dirty)
- size--;
- } else if (isascii(ch) && isdigit(ch)) {
- /* Decimal: eat dotted digit string. */
- for (;;) {
- tmp = 0;
- do {
- n = strchr(digits, ch) - digits;
- assert(n >= 0 && n <= 9);
- tmp *= 10;
- tmp += n;
- if (tmp > 255)
- goto enoent;
- } while ((ch = *src++) != '\0' &&
- isascii(ch) && isdigit(ch));
- if (size-- <= 0)
- goto emsgsize;
- *dst++ = (u_char) tmp;
- if (ch == '\0' || ch == '/')
- break;
- if (ch != '.')
- goto enoent;
- ch = *src++;
- if (!isascii(ch) || !isdigit(ch))
- goto enoent;
- }
- } else
- goto enoent;
-
- bits = -1;
- if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
- /* CIDR width specifier. Nothing can follow it. */
- ch = *src++; /* Skip over the /. */
- bits = 0;
- do {
- n = strchr(digits, ch) - digits;
- assert(n >= 0 && n <= 9);
- bits *= 10;
- bits += n;
- } while ((ch = *src++) != '\0' &&
- isascii(ch) && isdigit(ch));
- if (ch != '\0')
- goto enoent;
- if (bits > 32)
- goto emsgsize;
- }
-
- /* Firey death and destruction unless we prefetched EOS. */
- if (ch != '\0')
- goto enoent;
-
- /* If nothing was written to the destination, we found no address. */
- if (dst == odst)
- goto enoent;
- /* If no CIDR spec was given, infer width from net class. */
- if (bits == -1) {
- if (*odst >= 240) /* Class E */
- bits = 32;
- else if (*odst >= 224) /* Class D */
- bits = 4;
- else if (*odst >= 192) /* Class C */
- bits = 24;
- else if (*odst >= 128) /* Class B */
- bits = 16;
- else /* Class A */
- bits = 8;
- /* If imputed mask is narrower than specified octets, widen. */
- if (bits >= 8 && bits < ((dst - odst) * 8))
- bits = (dst - odst) * 8;
- }
- /* Extend network to cover the actual mask. */
- while (bits > ((dst - odst) * 8)) {
- if (size-- <= 0)
- goto emsgsize;
- *dst++ = '\0';
- }
- return (bits);
-
- enoent:
- errno = ENOENT;
- return (-1);
-
- emsgsize:
- errno = EMSGSIZE;
- return (-1);
-}
diff --git a/lib/libc/net/inet_neta.c b/lib/libc/net/inet_neta.c
deleted file mode 100644
index 15a1c70529ac..000000000000
--- a/lib/libc/net/inet_neta.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 1996 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char orig_rcsid[] = "From Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp";
-static const char rcsid[] = "$Id$";
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <errno.h>
-#include <stdio.h>
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
-/*
- * char *
- * inet_neta(src, dst, size)
- * format a u_long network number into presentation format.
- * return:
- * pointer to dst, or NULL if an error occurred (check errno).
- * note:
- * format of ``src'' is as for inet_network().
- * author:
- * Paul Vixie (ISC), July 1996
- */
-char *
-inet_neta(src, dst, size)
- u_long src;
- char *dst;
- size_t size;
-{
- char *odst = dst;
- char *tp;
-
- while (src & 0xffffffff) {
- u_char b = (src & 0xff000000) >> 24;
-
- src <<= 8;
- if (b) {
- if (size < sizeof "255.")
- goto emsgsize;
- tp = dst;
- dst += SPRINTF((dst, "%u", b));
- if (src != 0L) {
- *dst++ = '.';
- *dst = '\0';
- }
- size -= (size_t)(dst - tp);
- }
- }
- if (dst == odst) {
- if (size < sizeof "0.0.0.0")
- goto emsgsize;
- strcpy(dst, "0.0.0.0");
- }
- return (odst);
-
- emsgsize:
- errno = EMSGSIZE;
- return (NULL);
-}
diff --git a/lib/libc/sys/issetugid.2 b/lib/libc/sys/issetugid.2
deleted file mode 100644
index 943aa7db8d71..000000000000
--- a/lib/libc/sys/issetugid.2
+++ /dev/null
@@ -1,94 +0,0 @@
-.\" $OpenBSD: issetugid.2,v 1.7 1997/02/18 00:16:09 deraadt Exp $
-.\"
-.\" Copyright (c) 1980, 1991, 1993
-.\" 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.
-.\"
-.\" $Id: issetugid.2,v 1.3 1997/04/01 18:45:57 mpp Exp $
-.\"
-.Dd August, 25 1996
-.Dt ISSETUGID 2
-.Os
-.Sh NAME
-.Nm issetugid
-.Nd is current process tainted by uid or gid changes
-.Sh SYNOPSIS
-.Fd #include <unistd.h>
-.Ft int
-.Fn issetugid void
-.Sh DESCRIPTION
-The
-.Fn issetugid
-function returns 1 if the process environment or memory address space
-is considered ``tainted'', and returns 0 otherwise.
-.Pp
-A process is tainted if it was created as a result of an
-.Xr execve 2
-system call which had either of the setuid or setgid bits set (and extra
-privileges were given as a result) or if it has changed any of it's real,
-effective or saved user or group ID's since it began execution.
-.Pp
-This system call exists so that library routines (eg: libc, libtermcap)
-can reliably determine if it is safe to use information
-that was obtained from the user, in particular the results from
-.Xr getenv 3
-should be viewed with suspicion if it is used to control operation.
-.Pp
-A ``tainted'' status is inherited by child processes as a result of the
-.Xr fork 2
-system call (or other library code that calls fork, such as
-.Xr popen 3 ) .
-.Pp
-It is assumed that a program that clears all privileges as it prepares
-to execute another will also reset the environment, hence the ``tainted''
-status will not be passed on. This is important for programs such as
-.Xr su 1
-which begin setuid but need to be able to create an untainted process.
-.Sh ERRORS
-The
-.Fn issetugid
-function is always successful, and no return value is reserved to
-indicate an error.
-.Sh SEE ALSO
-.Xr execve 2 ,
-.Xr fork 2 ,
-.Xr setgid 2 ,
-.Xr setegid 2 ,
-.Xr seteuid 2 ,
-.Xr setregid 2 ,
-.Xr setreuid 2 ,
-.Xr setuid 2
-.Sh HISTORY
-A
-.Fn issetugid
-function call first appeared in
-.Ox 2.0
-and was also implemented in
-.Fx 3.0 .
diff --git a/lib/libc_r/uthread/uthread_attr_getdetachstate.c b/lib/libc_r/uthread/uthread_attr_getdetachstate.c
deleted file mode 100644
index 4715cb6f2424..000000000000
--- a/lib/libc_r/uthread/uthread_attr_getdetachstate.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int pthread_attr_getdetachstate(pthread_attr_t *attr, int *detachstate)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || detachstate == NULL)
- ret = EINVAL;
- else {
- /* Check if the detached flag is set: */
- if ((*attr)->flags & PTHREAD_DETACHED)
- /* Return detached: */
- *detachstate = PTHREAD_CREATE_DETACHED;
- else
- /* Return joinable: */
- *detachstate = PTHREAD_CREATE_JOINABLE;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_attr_getstackaddr.c b/lib/libc_r/uthread/uthread_attr_getstackaddr.c
deleted file mode 100644
index 1850a324c611..000000000000
--- a/lib/libc_r/uthread/uthread_attr_getstackaddr.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int pthread_attr_getstackaddr(pthread_attr_t *attr, void **stackaddr)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stackaddr == NULL)
- ret = EINVAL;
- else {
- /* Return the stack address: */
- *stackaddr = (*attr)->stackaddr_attr;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_attr_getstacksize.c b/lib/libc_r/uthread/uthread_attr_getstacksize.c
deleted file mode 100644
index de81106083d4..000000000000
--- a/lib/libc_r/uthread/uthread_attr_getstacksize.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int pthread_attr_getstacksize(pthread_attr_t *attr, size_t *stacksize)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stacksize == NULL)
- ret = EINVAL;
- else {
- /* Return the stack size: */
- *stacksize = (*attr)->stacksize_attr;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_attr_setdetachstate.c b/lib/libc_r/uthread/uthread_attr_setdetachstate.c
deleted file mode 100644
index 6ec0dbc1c585..000000000000
--- a/lib/libc_r/uthread/uthread_attr_setdetachstate.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL ||
- (detachstate != PTHREAD_CREATE_DETACHED &&
- detachstate != PTHREAD_CREATE_JOINABLE))
- ret = EINVAL;
- else {
- /* Check if detached state: */
- if (detachstate == PTHREAD_CREATE_DETACHED)
- /* Set the detached flag: */
- (*attr)->flags |= PTHREAD_DETACHED;
- else
- /* Reset the detached flag: */
- (*attr)->flags &= ~PTHREAD_DETACHED;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_attr_setstackaddr.c b/lib/libc_r/uthread/uthread_attr_setstackaddr.c
deleted file mode 100644
index ce54915d096d..000000000000
--- a/lib/libc_r/uthread/uthread_attr_setstackaddr.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
-{
- int ret;
-
- /* Check for invalid arguments: */
- if (attr == NULL || *attr == NULL || stackaddr == NULL)
- ret = EINVAL;
- else {
- /* Save the stack address: */
- (*attr)->stackaddr_attr = stackaddr;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_condattr_destroy.c b/lib/libc_r/uthread/uthread_condattr_destroy.c
deleted file mode 100644
index b20f183bb608..000000000000
--- a/lib/libc_r/uthread/uthread_condattr_destroy.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <stdlib.h>
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int pthread_condattr_destroy(pthread_condattr_t *attr)
-{
- int ret;
- if (attr == NULL || *attr == NULL) {
- errno = EINVAL;
- ret = -1;
- } else {
- free(*attr);
- *attr = NULL;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_condattr_init.c b/lib/libc_r/uthread/uthread_condattr_init.c
deleted file mode 100644
index f94e4384b925..000000000000
--- a/lib/libc_r/uthread/uthread_condattr_init.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int
-pthread_condattr_init(pthread_condattr_t *attr)
-{
- int ret;
- pthread_condattr_t pattr;
-
- if ((pattr = (pthread_condattr_t)
- malloc(sizeof(struct pthread_cond_attr))) == NULL) {
- errno = ENOMEM;
- ret = -1;
- } else {
- memcpy(pattr, &pthread_condattr_default,
- sizeof(struct pthread_cond_attr));
- *attr = pattr;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_kill.c b/lib/libc_r/uthread/uthread_kill.c
deleted file mode 100644
index eb2c6b75d740..000000000000
--- a/lib/libc_r/uthread/uthread_kill.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <errno.h>
-#include <signal.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int
-pthread_kill(pthread_t pthread, int sig)
-{
- int rval = 0;
- int status;
- pthread_t p_pthread;
-
- /* Check for invalid signal numbers: */
- if (sig < 0 || sig >= NSIG)
- /* Invalid signal: */
- rval = EINVAL;
- else {
- /* Assume that the search will succeed: */
- rval = 0;
-
- /* Block signals: */
- _thread_kern_sig_block(&status);
-
- /* Search for the thread: */
- p_pthread = _thread_link_list;
- while (p_pthread != NULL && p_pthread != pthread) {
- p_pthread = p_pthread->nxt;
- }
-
- /* Check if the thread was not found: */
- if (p_pthread == NULL)
- /* Can't find the thread: */
- rval = ESRCH;
- else
- /* Increment the pending signal count: */
- p_pthread->sigpend[sig] += 1;
-
- /* Unblock signals: */
- _thread_kern_sig_unblock(status);
- }
-
- /* Return the completion status: */
- return (rval);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_mattr_init.c b/lib/libc_r/uthread/uthread_mattr_init.c
deleted file mode 100644
index 323c982355c5..000000000000
--- a/lib/libc_r/uthread/uthread_mattr_init.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int
-pthread_mutexattr_init(pthread_mutexattr_t *attr)
-{
- int ret;
- pthread_mutexattr_t pattr;
-
- if ((pattr = (pthread_mutexattr_t)
- malloc(sizeof(struct pthread_mutex_attr))) == NULL) {
- errno = ENOMEM;
- ret = -1;
- } else {
- memcpy(pattr, &pthread_mutexattr_default,
- sizeof(struct pthread_mutex_attr));
- *attr = pattr;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_mattr_kind_np.c b/lib/libc_r/uthread/uthread_mattr_kind_np.c
deleted file mode 100644
index 3eeabff038a7..000000000000
--- a/lib/libc_r/uthread/uthread_mattr_kind_np.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int
-pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
-{
- int ret;
- if (attr == NULL || *attr == NULL) {
- errno = EINVAL;
- ret = -1;
- } else {
- (*attr)->m_type = kind;
- ret = 0;
- }
- return(ret);
-}
-
-int
-pthread_mutexattr_getkind_np(pthread_mutexattr_t attr)
-{
- int ret;
- if (attr == NULL) {
- errno = EINVAL;
- ret = -1;
- } else {
- ret = attr->m_type;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_mutexattr_destroy.c b/lib/libc_r/uthread/uthread_mutexattr_destroy.c
deleted file mode 100644
index cf2e09f44e23..000000000000
--- a/lib/libc_r/uthread/uthread_mutexattr_destroy.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <stdlib.h>
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
-{
- int ret;
- if (attr == NULL || *attr == NULL) {
- errno = EINVAL;
- ret = -1;
- } else {
- free(*attr);
- *attr = NULL;
- ret = 0;
- }
- return(ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_sigmask.c b/lib/libc_r/uthread/uthread_sigmask.c
deleted file mode 100644
index 94f64cb7991f..000000000000
--- a/lib/libc_r/uthread/uthread_sigmask.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <errno.h>
-#include <signal.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int
-pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
-{
- int ret = 0;
- int status;
-
- /* Check if the existing signal process mask is to be returned: */
- if (oset != NULL) {
- /* Return the current mask: */
- *oset = _thread_run->sigmask;
- }
- /* Check if a new signal set was provided by the caller: */
- if (set != NULL) {
- /* Block signals while the signal mask is changed: */
- _thread_kern_sig_block(&status);
-
- /* Process according to what to do: */
- switch (how) {
- /* Block signals: */
- case SIG_BLOCK:
- /* Add signals to the existing mask: */
- _thread_run->sigmask |= *set;
- break;
-
- /* Unblock signals: */
- case SIG_UNBLOCK:
- /* Clear signals from the existing mask: */
- _thread_run->sigmask &= ~(*set);
- break;
-
- /* Set the signal process mask: */
- case SIG_SETMASK:
- /* Set the new mask: */
- _thread_run->sigmask = *set;
- break;
-
- /* Trap invalid actions: */
- default:
- /* Return an invalid argument: */
- errno = EINVAL;
- ret = -1;
- break;
- }
-
- /*
- * Schedule the next thread in case there are signals that
- * now need to be acted on:
- */
- _thread_kern_sched(NULL);
- }
- /* Return the completion status: */
- return (ret);
-}
-#endif
diff --git a/lib/libc_r/uthread/uthread_sigwait.c b/lib/libc_r/uthread/uthread_sigwait.c
deleted file mode 100644
index 4f95190e4216..000000000000
--- a/lib/libc_r/uthread/uthread_sigwait.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * 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 John Birrell.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
- *
- */
-#include <signal.h>
-#include <errno.h>
-#ifdef _THREAD_SAFE
-#include <pthread.h>
-#include "pthread_private.h"
-
-int
-sigwait(const sigset_t * set, int *sig)
-{
- int ret;
- int status;
- sigset_t oset;
-
- /* Block signals: */
- _thread_kern_sig_block(&status);
-
- /* Save the current sigmal mask: */
- oset = _thread_run->sigmask;
-
- /* Combine the caller's mask with the current one: */
- _thread_run->sigmask |= *set;
-
- /* Wait for a signal: */
- _thread_kern_sched_state(PS_SIGWAIT, __FILE__, __LINE__);
-
- /* Block signals again: */
- _thread_kern_sig_block(NULL);
-
- /* Return the signal number to the caller: */
- *sig = _thread_run->signo;
-
- /* Restore the signal mask: */
- _thread_run->sigmask = oset;
-
- /* Unblock signals: */
- _thread_kern_sig_unblock(status);
-
- /* Return the completion status: */
- return (ret);
-}
-#endif
diff --git a/lib/libutil/login_auth.3 b/lib/libutil/login_auth.3
deleted file mode 100644
index 14a2a63fcf0f..000000000000
--- a/lib/libutil/login_auth.3
+++ /dev/null
@@ -1,71 +0,0 @@
-.\" Copyright (c) 1995 David Nugent <davidn@blaze.net.au>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, is permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice immediately at the beginning of the file, without modification,
-.\" 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. This work was done expressly for inclusion into FreeBSD. Other use
-.\" is permitted provided this notation is included.
-.\" 4. Absolutely no warranty of function or purpose is made by the author
-.\" David Nugent.
-.\" 5. Modifications may be freely made to this file providing the above
-.\" conditions are met.
-.\"
-.\" $Id$
-.\"
-.Dd December 29, 1996
-.Os FreeBSD
-.Dt LOGIN_AUTH 3
-.Sh NAME
-.Nm authenticate
-.Nm auth_script
-.Nm auth_env
-.Nm auth_scan
-.Nm auth_rmfiles
-.Nm auth_checknologin
-.Nm auth_cat
-.Nm auth_ttyok
-.Nm auth_hostok
-.Nm auth_timesok
-.Nd Authentication style support library for login class capabilities database.
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <login_cap.h>
-.Ft int
-.Fn authenticate "const char *name" "const char *classname" "const char *style" "const char *service"
-.Ft int
-.Fn auth_script "const char * path" ...
-.Ft int
-.Fn auth_env "void"
-.Ft int
-.Fn auth_scan "int ok"
-.Ft int
-.Fn auth_rmfiles "void"
-.Ft int
-.Fn auth_checknologin "login_cap_t *lc"
-.Ft int
-.Fn auth_cat "const char *file"
-.Ft int
-.Fn auth_ttyok "login_cap_t *lc" "const char *tty"
-.Ft int
-.Fn auth_hostok "login_cap_t *lc" "const char *hostname" "char const *ip"
-.Ft int
-.Fn auth_timesok "login_cap_t *lc" "time_t now"
-.Sh DESCRIPTION
-This set of functions support the login class authorisation style interface provided
-by
-.Xr login.conf 5 .
-
-.Sh RETURN VALUES
-.Sh SEE ALSO
-.Xr getcap 3 ,
-.Xr login_cap 3 ,
-.Xr login_class 3 ,
-.Xr login.conf 5 ,
-.Xr termcap 5
diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h
deleted file mode 100644
index 85555e380637..000000000000
--- a/sbin/ifconfig/ifconfig.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1997 Peter Wemm.
- * 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 for the FreeBSD Project
- * by Peter Wemm.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- *
- * so there!
- *
- * $Id: ifconfig.h,v 1.2 1997/05/10 14:47:35 peter Exp $
- */
-
-extern struct ifreq ifr;
-
-extern char name[32]; /* name of interface */
-extern int allmedia;
-struct afswtch;
-
-extern void setmedia(const char *, int, int, const struct afswtch *rafp);
-extern void setmediaopt(const char *, int, int, const struct afswtch *rafp);
-extern void unsetmediaopt(const char *, int, int, const struct afswtch *rafp);
-extern void media_status(int s, struct rt_addrinfo *);
diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c
deleted file mode 100644
index cd1d043afc04..000000000000
--- a/sbin/ifconfig/ifmedia.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/* $NetBSD: ifconfig.c,v 1.34 1997/04/21 01:17:58 lukem Exp $ */
-/* $Id: ifmedia.c,v 1.2 1997/05/10 14:47:35 peter Exp $ */
-
-/*
- * Copyright (c) 1997 Jason R. Thorpe.
- * 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 for the NetBSD Project
- * by Jason R. Thorpe.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*
- * Copyright (c) 1983, 1993
- * 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.
- */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/sysctl.h>
-#include <sys/time.h>
-
-#include <net/if.h>
-#include <net/if_var.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-#include <net/if_media.h>
-#include <net/route.h>
-
-#include <ctype.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "ifconfig.h"
-
-static void domediaopt __P((const char *, int, int));
-static int get_media_subtype __P((int, const char *));
-static int get_media_options __P((int, const char *));
-static int lookup_media_word __P((struct ifmedia_description *, const char *));
-static void print_media_word __P((int));
-
-void
-media_status(s, info)
- int s;
- struct rt_addrinfo *info __unused;
-{
- struct ifmediareq ifmr;
- int *media_list, i;
-
- (void) memset(&ifmr, 0, sizeof(ifmr));
- (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
-
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
- /*
- * Interface doesn't support SIOC{G,S}IFMEDIA.
- */
- return;
- }
-
- if (ifmr.ifm_count == 0) {
- warnx("%s: no media types?", name);
- return;
- }
-
- media_list = (int *)malloc(ifmr.ifm_count * sizeof(int));
- if (media_list == NULL)
- err(1, "malloc");
- ifmr.ifm_ulist = media_list;
-
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
- err(1, "SIOCGIFMEDIA");
-
- printf("\tmedia: ");
- print_media_word(ifmr.ifm_current);
- if (ifmr.ifm_active != ifmr.ifm_current) {
- putchar(' ');
- putchar('(');
- print_media_word(ifmr.ifm_active);
- putchar(')');
- }
-
- if (ifmr.ifm_status & IFM_AVALID) {
- printf(" status: ");
- switch (IFM_TYPE(ifmr.ifm_active)) {
- case IFM_ETHER:
- if (ifmr.ifm_status & IFM_ACTIVE)
- printf("active");
- else
- printf("no carrier");
- break;
-
- case IFM_FDDI:
- case IFM_TOKEN:
- if (ifmr.ifm_status & IFM_ACTIVE)
- printf("inserted");
- else
- printf("no ring");
- break;
- }
- }
-
- putchar('\n');
-
- if (allmedia) {
- printf("\tsupported media:");
- for (i = 0; i < ifmr.ifm_count; i++) {
- putchar(' ');
- print_media_word(media_list[i]);
- }
- putchar('\n');
- }
-
- free(media_list);
-}
-
-void
-setmedia(val, d, s, afp)
- const char *val;
- int d;
- int s;
- const struct afswtch *afp;
-{
- struct ifmediareq ifmr;
- int first_type, subtype;
-
- (void) memset(&ifmr, 0, sizeof(ifmr));
- (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
-
- ifmr.ifm_count = 1;
- ifmr.ifm_ulist = &first_type;
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
- /*
- * If we get E2BIG, the kernel is telling us
- * that there are more, so we can ignore it.
- */
- if (errno != E2BIG)
- err(1, "SIOCGIFMEDIA");
- }
-
- if (ifmr.ifm_count == 0)
- errx(1, "%s: no media types?", name);
-
- /*
- * We are primarily concerned with the top-level type.
- * However, "current" may be only IFM_NONE, so we just look
- * for the top-level type in the first "supported type"
- * entry.
- *
- * (I'm assuming that all supported media types for a given
- * interface will be the same top-level type..)
- */
- subtype = get_media_subtype(IFM_TYPE(first_type), val);
-
- strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- ifr.ifr_media = (ifmr.ifm_current & ~(IFM_NMASK|IFM_TMASK)) |
- IFM_TYPE(first_type) | subtype;
-
- if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0)
- err(1, "SIOCSIFMEDIA");
-}
-
-void
-setmediaopt(val, d, s, afp)
- const char *val;
- int d;
- int s;
- const struct afswtch *afp;
-{
-
- domediaopt(val, 0, s);
-}
-
-void
-unsetmediaopt(val, d, s, afp)
- const char *val;
- int d;
- int s;
- const struct afswtch *afp;
-{
-
- domediaopt(val, 1, s);
-}
-
-static void
-domediaopt(val, clear, s)
- const char *val;
- int clear;
- int s;
-{
- struct ifmediareq ifmr;
- int *mwords, options;
-
- (void) memset(&ifmr, 0, sizeof(ifmr));
- (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
-
- /*
- * We must go through the motions of reading all
- * supported media because we need to know both
- * the current media type and the top-level type.
- */
-
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
- err(1, "SIOCGIFMEDIA");
-
- if (ifmr.ifm_count == 0)
- errx(1, "%s: no media types?", name);
-
- mwords = (int *)malloc(ifmr.ifm_count * sizeof(int));
- if (mwords == NULL)
- err(1, "malloc");
-
- ifmr.ifm_ulist = mwords;
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
- err(1, "SIOCGIFMEDIA");
-
- options = get_media_options(IFM_TYPE(mwords[0]), val);
-
- free(mwords);
-
- strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- ifr.ifr_media = ifmr.ifm_current;
- if (clear)
- ifr.ifr_media &= ~options;
- else
- ifr.ifr_media |= options;
-
- if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0)
- err(1, "SIOCSIFMEDIA");
-}
-
-/**********************************************************************
- * A good chunk of this is duplicated from sys/net/ifmedia.c
- **********************************************************************/
-
-static struct ifmedia_description ifm_type_descriptions[] =
- IFM_TYPE_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_ethernet_descriptions[] =
- IFM_SUBTYPE_ETHERNET_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_ethernet_aliases[] =
- IFM_SUBTYPE_ETHERNET_ALIASES;
-
-static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] =
- IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_tokenring_descriptions[] =
- IFM_SUBTYPE_TOKENRING_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_tokenring_aliases[] =
- IFM_SUBTYPE_TOKENRING_ALIASES;
-
-static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
- IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
- IFM_SUBTYPE_FDDI_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_fddi_aliases[] =
- IFM_SUBTYPE_FDDI_ALIASES;
-
-static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
- IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_shared_descriptions[] =
- IFM_SUBTYPE_SHARED_DESCRIPTIONS;
-
-static struct ifmedia_description ifm_subtype_shared_aliases[] =
- IFM_SUBTYPE_SHARED_ALIASES;
-
-static struct ifmedia_description ifm_shared_option_descriptions[] =
- IFM_SHARED_OPTION_DESCRIPTIONS;
-
-struct ifmedia_type_to_subtype {
- struct {
- struct ifmedia_description *desc;
- int alias;
- } subtypes[5];
- struct {
- struct ifmedia_description *desc;
- int alias;
- } options[3];
-};
-
-/* must be in the same order as IFM_TYPE_DESCRIPTIONS */
-static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
- {
- {
- { &ifm_subtype_shared_descriptions[0], 0 },
- { &ifm_subtype_shared_aliases[0], 1 },
- { &ifm_subtype_ethernet_descriptions[0], 0 },
- { &ifm_subtype_ethernet_aliases[0], 1 },
- { NULL, 0 },
- },
- {
- { &ifm_shared_option_descriptions[0], 0 },
- { &ifm_subtype_ethernet_option_descriptions[0], 1 },
- { NULL, 0 },
- },
- },
- {
- {
- { &ifm_subtype_shared_descriptions[0], 0 },
- { &ifm_subtype_shared_aliases[0], 1 },
- { &ifm_subtype_tokenring_descriptions[0], 0 },
- { &ifm_subtype_tokenring_aliases[0], 1 },
- { NULL, 0 },
- },
- {
- { &ifm_shared_option_descriptions[0], 0 },
- { &ifm_subtype_tokenring_option_descriptions[0], 1 },
- { NULL, 0 },
- },
- },
- {
- {
- { &ifm_subtype_shared_descriptions[0], 0 },
- { &ifm_subtype_shared_aliases[0], 1 },
- { &ifm_subtype_fddi_descriptions[0], 0 },
- { &ifm_subtype_fddi_aliases[0], 1 },
- { NULL, 0 },
- },
- {
- { &ifm_shared_option_descriptions[0], 0 },
- { &ifm_subtype_fddi_option_descriptions[0], 1 },
- { NULL, 0 },
- },
- },
-};
-
-static int
-get_media_subtype(type, val)
- int type;
- const char *val;
-{
- struct ifmedia_description *desc;
- struct ifmedia_type_to_subtype *ttos;
- int rval, i;
-
- /* Find the top-level interface type. */
- for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
- desc->ifmt_string != NULL; desc++, ttos++)
- if (type == desc->ifmt_word)
- break;
- if (desc->ifmt_string == NULL)
- errx(1, "unknown media type 0x%x", type);
-
- for (i = 0; ttos->subtypes[i].desc != NULL; i++) {
- rval = lookup_media_word(ttos->subtypes[i].desc, val);
- if (rval != -1)
- return (rval);
- }
- errx(1, "unknown media subtype: %s", val);
- /* NOTREACHED */
-}
-
-static int
-get_media_options(type, val)
- int type;
- const char *val;
-{
- struct ifmedia_description *desc;
- struct ifmedia_type_to_subtype *ttos;
- char *optlist, *optptr;
- int option = 0, i, rval = 0;
-
- /* We muck with the string, so copy it. */
- optlist = strdup(val);
- if (optlist == NULL)
- err(1, "strdup");
-
- /* Find the top-level interface type. */
- for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
- desc->ifmt_string != NULL; desc++, ttos++)
- if (type == desc->ifmt_word)
- break;
- if (desc->ifmt_string == NULL)
- errx(1, "unknown media type 0x%x", type);
-
- /*
- * Look up the options in the user-provided comma-separated
- * list.
- */
- optptr = optlist;
- for (; (optptr = strtok(optptr, ",")) != NULL; optptr = NULL) {
- for (i = 0; ttos->options[i].desc != NULL; i++) {
- option = lookup_media_word(ttos->options[i].desc, optptr);
- if (option != -1)
- break;
- }
- if (option == 0)
- errx(1, "unknown option: %s", optptr);
- rval |= option;
- }
-
- free(optlist);
- return (rval);
-}
-
-static int
-lookup_media_word(desc, val)
- struct ifmedia_description *desc;
- const char *val;
-{
-
- for (; desc->ifmt_string != NULL; desc++)
- if (strcasecmp(desc->ifmt_string, val) == 0)
- return (desc->ifmt_word);
-
- return (-1);
-}
-
-static void
-print_media_word(ifmw)
- int ifmw;
-{
- struct ifmedia_description *desc;
- struct ifmedia_type_to_subtype *ttos;
- int seen_option = 0, i;
-
- /* Find the top-level interface type. */
- for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
- desc->ifmt_string != NULL; desc++, ttos++)
- if (IFM_TYPE(ifmw) == desc->ifmt_word)
- break;
- if (desc->ifmt_string == NULL) {
- printf("<unknown type>");
- return;
- }
-
- /*
- * Don't print the top-level type; it's not like we can
- * change it, or anything.
- */
-
- /* Find subtype. */
- for (i = 0; ttos->subtypes[i].desc != NULL; i++) {
- if (ttos->subtypes[i].alias)
- continue;
- for (desc = ttos->subtypes[i].desc;
- desc->ifmt_string != NULL; desc++) {
- if (IFM_SUBTYPE(ifmw) == desc->ifmt_word)
- goto got_subtype;
- }
- }
-
- /* Falling to here means unknown subtype. */
- printf("<unknown subtype>");
- return;
-
- got_subtype:
- printf("%s", desc->ifmt_string);
-
- /* Find options. */
- for (i = 0; ttos->options[i].desc != NULL; i++) {
- if (ttos->options[i].alias)
- continue;
- for (desc = ttos->options[i].desc;
- desc->ifmt_string != NULL; desc++) {
- if (ifmw & desc->ifmt_word) {
- if (seen_option == 0)
- printf(" <");
- printf("%s%s", seen_option++ ? "," : "",
- desc->ifmt_string);
- }
- }
- }
- printf("%s", seen_option ? ">" : "");
-}
-
-/**********************************************************************
- * ...until here.
- **********************************************************************/
diff --git a/share/doc/handbook/russian.sgml b/share/doc/handbook/russian.sgml
deleted file mode 100644
index 32b4b02c7562..000000000000
--- a/share/doc/handbook/russian.sgml
+++ /dev/null
@@ -1,195 +0,0 @@
-<!-- $Id: russian.sgml,v 1.3 1997/05/02 08:07:35 ache Exp $ -->
-<!-- The FreeBSD Documentation Project -->
-
-<sect><heading>Russian Language (KOI8-R encoding)<label id="russian"></heading>
-<p><em>Contributed by &a.ache;<newline>
-1 May 1997</em>.
-<p>See more info about KOI8-R encoding at
-<htmlurl url="http://www.nagual.pp.ru/~ache/koi8.html"
-name="KOI8-R References (Russian Net Character Set)">.
-
-<sect1><heading>Console Setup<label id="russian:console"></heading>
-<p>
-<enum>
-<item>Russian console entry in <tt>/etc/rc.conf</tt> should looks like
-<verb>
-keymap=ru.koi8-r
-keychange="61 ^[[K"
-scrnmap=koi8-r2cp866
-font8x16=cp866b-8x16
-font8x14=cp866-8x14
-font8x8=cp866-8x8
-</verb>
-<p>
-<it>NOTE:</it> ^[ means that real ESC character must be entered into
-<tt>/etc/rc.conf</tt>,
-not just ^[ string.
-<p>
-This tuning means KOI8-R keyboard with Alternative
-screen font mapped to KOI8-R encoding to
-preserve pseudographics, <it>Gray Delete</it> key remapped to match Russian
-<tt>termcap(5)</tt> entry for FreeBSD console.
-<p>
-RUS/LAT switch will be <bf>CapsLock</bf>. Old CapsLock function still
-available via <bf>Shift+CapsLock</bf>. CapsLock LED will
-indicate RUS mode, not CapsLock mode.
-
-<item>For each <tt>ttyv?</tt> entry in <tt>/etc/ttys</tt>
-change terminal type from <tt>cons25</tt> to
-<tt>cons25r</tt>, i.e. each entry should looks like
-<verb>
-ttyv0 "/usr/libexec/getty Pc" cons25r on secure
-</verb>
-</enum>
-
-<sect1><heading>Locale Setup<label id="russian:locale"></heading>
-<p><label id="russian:env">
-There is two environment variables for locale setup:
-<itemize>
-<item><tt>LANG</tt>
-for POSIX <tt>setlocale(3)</tt> family functions;
-<item><tt>MM_CHARSET</tt>
-for applications MIME chararter set.
-</itemize>
-<p>
-The best way is using <tt>/etc/login.conf</tt>
-<tt>russian</tt> user's login class
-in <tt>passwd(5)</tt> entry login class position.
-See <tt>login.conf(5)</tt> for details.
-
-<sect2><heading>Login Class Method<label id="russian:class"></heading>
-<p>
-First of all check your <tt>/etc/login.conf</tt> have
-<tt>russian</tt> login class, this entry may looks like:
-<verb>
-russian:Russian Users Accounts:\
- :charset=KOI8-R:\
- :lang=ru_RU.KOI8-R:\
- :tc=default:
-</verb>
-
-<sect3><heading>How to do it with vipw(8)</heading>
-<p>
-If you use <tt>vipw(8)</tt> for adding new users,
-<tt>/etc/master.passwd</tt>
-entry should looks like:
-<verb>
-user:password:1111:11:russian:0:0:User Name:/home/user:/bin/csh
-</verb>
-
-<sect3><heading>How to do it with adduser(8)</heading>
-<p>
-If you use <tt>adduser(8)</tt> for adding new users:
-<itemize>
-<item>Set
-<verb>
-defaultclass = russian
-</verb>
-in <tt>/etc/adduser.conf</tt>
-(you must enter <tt>default</tt> class for all non-Russian
-users in this case);
-<newline><newline>
-
-<item>Alternative variant will be answering <tt>russian</tt>
-each time when you see
-<verb>
-Enter login class: default []:
-</verb>
-prompt from <tt>adduser(8)</tt>;
-<newline><newline>
-
-<item>Another variant: call
-<verb>
-# adduser -class russian
-</verb>
-for each Russian user you want to add.
-</itemize>
-
-<sect3><heading>How to do it with pw(8)</heading>
-<p>
-If you use <tt>pw(8)</tt> for adding new users, call it in this form:
-<verb>
-# pw useradd user_name -L russian
-</verb>
-
-<sect2><heading>Shell Startup Files Method</heading>
-<p>
-If you don't want to use
-<ref id="russian:class" name="login class method">
-for some reasons, just set
-this
-<ref id="russian:env" name="two environment variables">
-in the following shell startup files:
-<itemize>
-<item><tt>/etc/profile</tt>:
-<verb>
-LANG=ru_RU.KOI8-R; export LANG
-MM_CHARSET=KOI8-R; export MM_CHARSET
-</verb>
-
-<item><tt>/etc/csh.login</tt>:
-<verb>
-setenv LANG ru_RU.KOI8-R
-setenv MM_CHARSET KOI8-R
-</verb>
-</itemize>
-<p>
-Alternatively you can add this instructions to
-<itemize>
-<item><tt>/usr/share/skel/dot.profile</tt>:
-<p>
-(similar to <tt>/etc/profile</tt> above);
-
-<item><tt>/usr/share/skel/dot.login</tt>:
-<p>
-(similar to <tt>/etc/csh.login</tt> above).
-</itemize>
-
-<sect1><heading>X Window Setup<label id="russian:xwindow"></heading>
-<p>
-Step by step instructions:
-<enum>
-<item>Do
-<ref id="russian:locale" name="locale setup"> first as described.
-<p>
-<it>NOTE:</it><label id="russian:note">
-Russian KOI8-R locale may not work with old XFree86 versions
-(lower than 3.2.1 + locale/keyboard patches).
-XFree86 port from <tt>/usr/ports/x11/XFree86</tt> already have
-all neccessary patches, so it will work, if you install XFree86
-from this port.
-Basically, XFree86 version shipped with latest FreeBSD distribution should
-work too unless somebody forget to apply port patches to it.
-
-<item>Go to <tt>/usr/ports/russian/X.language</tt> directory and say
-<verb>
-# make all install
-</verb>
-there. This port install latest version of KOI8-R fonts.
-<p>
-Check find <tt>"Files"</tt> section in your <tt>/etc/XF86Config</tt>,
-following lines must be before any other <tt>FontPath</tt> entries:
-<verb>
- FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/misc"
- FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/75dpi"
- FontPath "/usr/X11R6/lib/X11/fonts/cyrillic/100dpi"
-</verb>
-<p>
-If you use high resolution video mode, swap 75 dpi and
-100 dpi lines.
-
-<item>To activate Russian keyboard add
-<verb>
- XkbKeymap "xfree86(ru)"
-</verb>
-line into <tt>"Keyboard"</tt> section in your <tt>/etc/XF86Config</tt>,
-also make sure that <tt>XkbDisable</tt> is turned off (commented out)
-there.
-<p>
-RUS/LAT switch will be <bf>CapsLock</bf>. Old CapsLock function still
-available via <bf>Shift+CapsLock</bf> (in LAT mode only).
-<p>
-<it>NOTE:</it>
-Russian XKB keyboard may not work with old XFree86 versions,
-see <ref id="russian:note" name="locale note"> for more info.
-</enum>
diff --git a/share/examples/drivers/README b/share/examples/drivers/README
deleted file mode 100644
index d6765bdf0302..000000000000
--- a/share/examples/drivers/README
+++ /dev/null
@@ -1,45 +0,0 @@
-Sat Feb 1 23:30:12 PST 1997 <Julian Elischer>
-
-These files are shell scripts.
-
-They will, when run, create an example skeleton driver
-for you. You can use this driver as a starting point for
-writing drivers for your own devices. They have all the hooks needed
-for intiialisation, probing, attaching, as well as DEVFS
-node creation. They also create sample ioctl commands and a sample
-ioctl definition .h file in /sys/sys. In othe rwords they are fully
-functional in a 'skeleton' sort of a way. They support multiple devices
-so that you may have several of your 'foobar' devices probed and atached
-at once.
-
-I expect that these scripts will improve with time.
-
-At present these scripts also link the newly created driver into
-the kernel sources in /sys. Possibly a better way would be
-to make them interactive. (and ask what kernel tree to use as well as
-a name for the driver.).
-
-There are presently two scripts.
-One for making a real device driver for ISA devices, and
-one for making a device driver for pseudo devices (e.g. /dev/null).
-Hopefully they will be joined by similar scripts for creating
-skeletons for PCI and EISA devices as well.
-
-Give them a single argument: the name of the driver.
-They will use this given name in many places within the driver,
-both in lower and upper case form. (conforming to normal usage).
-
-The skeleton driver should already link with the kernel
-and in fact the shell script will compile a kernel with the new
-drive linked in.. The new kernel should still be
-runnable and the new driver should be
-fully callable (once you get your device to probe).
-You should simply edit the driver and continue to use
-'make' (as done in the script) until your driver does what you want.
-
-The driver will end up in /sys/i386/isa for the device driver script,
-and in /sys/dev for the pseudo driver script.
-
-
-
-
diff --git a/share/examples/drivers/make_device_driver.sh b/share/examples/drivers/make_device_driver.sh
deleted file mode 100755
index e07338d33c4b..000000000000
--- a/share/examples/drivers/make_device_driver.sh
+++ /dev/null
@@ -1,400 +0,0 @@
-#!/bin/sh
-# This writes a skeleton driver and puts it into the kernel tree for you
-#arg1 is lowercase "foo"
-#
-# Trust me, RUN THIS SCRIPT :)
-#
-#-------cut here------------------
-cd /sys/i386/conf
-
-if [ "${1}X" = "X" ]
-then
- echo "Hey , how about some help here.. give me a device name!"
- exit 1
-fi
-
-UPPER=`echo ${1} |tr "[:lower:]" "[:upper:]"`
-cat >files.${UPPER} <<DONE
-i386/isa/${1}.c optional ${1} device-driver
-DONE
-
-cat >${UPPER} <<DONE
-# Configuration file for kernel type: ${UPPER}
-ident ${UPPER}
-# \$Id:\$"
-DONE
-
-grep -v GENERIC < GENERIC >>${UPPER}
-
-cat >>${UPPER} <<DONE
-# trust me, you'll need this
-options DDB
-device ${1}0 at isa? port 0x234 bio irq 5 vector ${1}intr
-DONE
-
-cat >../isa/${1}.c <<DONE
-/*
- * Copyright ME
- *
- * ${1} driver
- * \$Id:\$
- */
-
-
-#include "${1}.h" /* generated file.. defines N${UPPER} */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h> /* SYSINIT stuff */
-#include <sys/conf.h> /* cdevsw stuff */
-#include <sys/malloc.h> /* malloc region definitions */
-#include <machine/clock.h> /* DELAY() */
-#include <i386/isa/isa.h> /* ISA bus port definitions etc. */
-#include <i386/isa/isa_device.h>/* ISA bus configuration structures */
-#include <sys/${1}io.h> /* ${1} IOCTL definitions */
-#ifdef DEVFS
-#include <sys/devfsext.h> /* DEVFS defintitions */
-#endif /* DEVFS */
-
-
-
-/* Function prototypes (these should all be static except for ${1}intr()) */
-static d_open_t ${1}open;
-static d_close_t ${1}close;
-static d_read_t ${1}read;
-static d_write_t ${1}write;
-static d_ioctl_t ${1}ioctl;
-static d_mmap_t ${1}mmap;
-static d_select_t ${1}select;
-static int ${1}probe (struct isa_device *);
-static int ${1}attach (struct isa_device *);
-/* void ${1}intr(int unit);*//* actually defined in ioconf.h (generated file) */
-
-#define CDEV_MAJOR 20
-static struct cdevsw ${1}_cdevsw = {
- ${1}open,
- ${1}close,
- ${1}read,
- ${1}write,
- ${1}ioctl,
- nullstop,
- nullreset,
- nodevtotty,
- ${1}select,
- ${1}mmap,
- NULL,
- "${1}",
- NULL,
- -1 };
-
-struct isa_driver ${1}driver = {
- ${1}probe,
- ${1}attach,
- "${1}" };
-
-/*
- * device specific Misc defines
- */
-#define BUFFERSIZE 1024
-#define NUMPORTS 4
-#define UNIT(dev) minor(dev) /* assume one minor number per unit */
-
-/*
- * One of these per allocated device
- */
-struct ${1}_softc {
- struct isa_device *dev;
- char buffer[BUFFERSIZE];
-#ifdef DEVFS
- static void *devfs_token;
-#endif
-} ;
-
-typedef struct ${1}_softc *sc_p;
-
-static sc_p sca[N${UPPER}];
-
-/* add your own test to see if it exists */
-/* should return the number of ports needed */
-static int
-${1}probe (struct isa_device *dev)
-{
- char val;
- int unit = dev->id_unit;
- sc_p scp = sca[unit];
-
- /*
- * Check the unit makes sense.
- */
- if (unit > N${UPPER}) {
- printf("bad unit (%d)\n", unit);
- return (0);
- }
- if (scp) {
- printf("unit $d already attached\n", unit);
- return (0);
- }
-
- /*
- * try see if the device is there.
- */
- val = inb (dev->id_iobase);
- if ( val != 42 ) {
- return (0);
- }
-
- /*
- * ok, we got one we think
- * do some further (this time possibly destructive) tests.
- */
- outb (dev->id_iobase, 0xff);
- DELAY (10000); /* 10 ms delay */
- val = inb (dev->id_iobase) & 0x0f;
- return ((val & 0x0f) == 0x0f)? NUMPORTS : 0 ;
-}
-
-/*
- * Called if the probe succeeded.
- * We can be destructive here as we know we have the device.
- * we can also trust the unit number.
- */
-static int
-${1}attach (struct isa_device *dev)
-{
- int unit = dev->id_unit;
- sc_p scp = sca[unit];
-
- /*
- * Allocate storage for this instance .
- */
- scp = malloc(sizeof(*scp), M_DEVBUF, M_NOWAIT);
- if( scp == NULL) {
- printf("${1}%d failed to allocage driver strorage\n", unit);
- return (0);
- }
- bzero(scp, sizeof(*scp));
- sca[unit] = scp;
-
- /*
- * Store whatever seems wise.
- */
- scp->dev = dev;
-#if DEVFS
- scp->devfs_token = devfs_add_devswf(&${1}_cdevsw, unit, DV_CHR,
- UID_ROOT, GID_KMEM, 0600, "${1}%d", unit);
-#endif
- return 1;
-}
-
-/*
- * Macro to check that the unit number is valid
- * Often this isn't needed as once the open() is performed,
- * the unit number is pretty much safe.. The exception would be if we
- * implemented devices that could "go away". in which case all these routines
- * would be wise to check the number, DIAGNOSTIC or not.
- */
-#define CHECKUNIT(RETVAL) \
-do { /* the do-while is a safe way to do this grouping */ \
- if (unit > N${UPPER}) { \
- printf(__FUNCTION__ ":bad unit $d\n", unit); \
- return (RETVAL); \
- } \
- if (scp == NULL) { \
- printf( __FUNCTION__ ": unit $d not attached\n", unit);\
- return (RETVAL); \
- } \
-} while (0)
-#ifdef DIAGNOSTIC
-#define CHECKUNIT_DIAG(RETVAL) CHECKUNIT(RETVAL)
-#else /* DIAGNOSTIC */
-#define CHECKUNIT_DIAG(RETVAL)
-#endif /* DIAGNOSTIC */
-
-void
-${1}intr(int unit)
-{
- sc_p scp = sca[unit];
-
- /*
- * well we got an interupt, now what?
- * Theoretically we don't need to check the unit.
- */
- return;
-}
-
-int ${1}ioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT_DIAG(ENXIO);
-
- switch (cmd) {
- case DHIOCRESET:
- /* whatever resets it */
- outb(scp->dev->id_iobase, 0xff);
- break;
- default:
- return ENXIO;
- }
- return (0);
-}
-/*
- * You also need read, write, open, close routines.
- * This should get you started
- */
-static int
-${1}open(dev_t dev, int oflags, int devtype, struct proc *p)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT(ENXIO);
-
- /*
- * Do processing
- */
- return (0);
-}
-
-static int
-${1}close(dev_t dev, int fflag, int devtype, struct proc *p)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT_DIAG(ENXIO);
-
- /*
- * Do processing
- */
- return (0);
-}
-
-static int
-${1}read(dev_t dev, struct uio *uio, int ioflag)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
- int toread;
-
-
- CHECKUNIT_DIAG(ENXIO);
-
- /*
- * Do processing
- * read from buffer
- */
- toread = (min(uio->uio_resid, sizeof(scp->buffer)));
- return(uiomove(scp->buffer, toread, uio));
-}
-
-static int
-${1}write(dev_t dev, struct uio *uio, int ioflag)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
- int towrite;
-
- CHECKUNIT_DIAG(ENXIO);
-
- /*
- * Do processing
- * write to buffer
- */
- towrite = (min(uio->uio_resid, sizeof(scp->buffer)));
- return(uiomove(scp->buffer, towrite, uio));
-}
-
-static int
-${1}mmap(dev_t dev, int offset, int nprot)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT_DIAG(-1);
-
- /*
- * Do processing
- */
-#if 0 /* if we had a frame buffer or whatever.. do this */
- if (offset > FRAMEBUFFERSIZE - PAGE_SIZE) {
- return (-1);
- }
- return i386_btop((FRAMEBASE + offset));
-#else
- return (-1);
-#endif
-}
-
-static int
-${1}select(dev_t dev, int which, struct proc *p)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT_DIAG(ENXIO);
-
- /*
- * Do processing
- */
- return (0); /* this is the wrong value I'm sure */
-}
-
-/*
- * Now for some driver initialisation.
- * Occurs ONCE during boot (very early).
- */
-static void
-${1}_drvinit(void *unused)
-{
- dev_t dev;
-
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &${1}_cdevsw, NULL);
-}
-
-SYSINIT(${1}dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+CDEV_MAJOR,
- ${1}_drvinit, NULL)
-
-
-DONE
-
-cat >../../sys/${1}io.h <<DONE
-/*
- * Definitions needed to access the ${1} device (ioctls etc)
- * see mtio.h , ioctl.h as examples
- */
-#ifndef SYS_DHIO_H
-#define SYS_DHIO_H
-
-#ifndef KERNEL
-#include <sys/types.h>
-#endif
-#include <sys/ioccom.h>
-
-/*
- * define an ioctl here
- */
-#define DHIOCRESET _IO('D', 0) /* reset the ${1} device */
-#endif
-DONE
-
-config ${UPPER}
-cd ../../compile/${UPPER}
-make depend
-make ${1}.o
-make
-exit
-
-#--------------end of script---------------
-#
-#you also need to add an entry into the cdevsw[]
-#array in conf.c, but it's too hard to do in a script..
-#
-#edit to your taste..
-#
-#
-
-
-
-
diff --git a/share/examples/drivers/make_pseudo_driver.sh b/share/examples/drivers/make_pseudo_driver.sh
deleted file mode 100644
index 72f9fc2f5fef..000000000000
--- a/share/examples/drivers/make_pseudo_driver.sh
+++ /dev/null
@@ -1,321 +0,0 @@
-#!/bin/sh
-# This writes a skeleton driver and puts it into the kernel tree for you
-#arg1 is lowercase "foo"
-#
-# Trust me, RUN THIS SCRIPT :)
-#
-#-------cut here------------------
-cd /sys/i386/conf
-
-if [ "${1}X" = "X" ]
-then
- echo "Hey , how about some help here.. give me a device name!"
- exit 1
-fi
-
-UPPER=`echo ${1} |tr "[:lower:]" "[:upper:]"`
-cat >files.${UPPER} <<DONE
-dev/${1}.c optional ${1} device-driver
-DONE
-
-cat >${UPPER} <<DONE
-# Configuration file for kernel type: ${UPPER}
-ident ${UPPER}
-# \$Id:\$"
-DONE
-
-grep -v GENERIC < GENERIC >>${UPPER}
-
-cat >>${UPPER} <<DONE
-# trust me, you'll need this
-options DDB
-pseudo-device ${1} 4 # might as well allow 4 of them
-DONE
-
-cat >../../dev/${1}.c <<DONE
-/*
- * Copyright ME
- *
- * ${1} driver
- * \$Id:\$
- */
-
-
-#include "${1}.h" /* generated file.. defines N${UPPER} */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h> /* SYSINIT stuff */
-#include <sys/conf.h> /* cdevsw stuff */
-#include <sys/malloc.h> /* malloc region definitions */
-#include <machine/clock.h> /* DELAY() */
-#include <sys/${1}io.h> /* ${1} IOCTL definitions */
-#ifdef DEVFS
-#include <sys/devfsext.h> /* DEVFS defintitions */
-#endif /* DEVFS */
-
-
-
-/* Function prototypes (these should all be static except for ${1}intr()) */
-static d_open_t ${1}open;
-static d_close_t ${1}close;
-static d_read_t ${1}read;
-static d_write_t ${1}write;
-static d_ioctl_t ${1}ioctl;
-static d_mmap_t ${1}mmap;
-static d_select_t ${1}select;
-
-#define CDEV_MAJOR 20
-static struct cdevsw ${1}_cdevsw = {
- ${1}open,
- ${1}close,
- ${1}read,
- ${1}write,
- ${1}ioctl,
- nullstop,
- nullreset,
- nodevtotty,
- ${1}select,
- ${1}mmap,
- NULL,
- "${1}",
- NULL,
- -1 };
-
-/*
- * device specific Misc defines
- */
-#define BUFFERSIZE 1024
-#define UNIT(dev) minor(dev) /* assume one minor number per unit */
-
-/*
- * One of these per allocated device
- */
-struct ${1}_softc {
- struct isa_device *dev;
- char buffer[BUFFERSIZE];
-#ifdef DEVFS
- static void *devfs_token;
-#endif
-} ;
-
-typedef struct ${1}_softc *sc_p;
-
-static sc_p sca[N${UPPER}];
-
-/*
- * Macro to check that the unit number is valid
- * Often this isn't needed as once the open() is performed,
- * the unit number is pretty much safe.. The exception would be if we
- * implemented devices that could "go away". in which case all these routines
- * would be wise to check the number, DIAGNOSTIC or not.
- */
-#define CHECKUNIT(RETVAL) \
-do { /* the do-while is a safe way to do this grouping */ \
- if (unit > N${UPPER}) { \
- printf(__FUNCTION__ ":bad unit $d\n", unit); \
- return (RETVAL); \
- } \
- if (scp == NULL) { \
- printf( __FUNCTION__ ": unit $d not attached\n", unit);\
- return (RETVAL); \
- } \
-} while (0)
-#ifdef DIAGNOSTIC
-#define CHECKUNIT_DIAG(RETVAL) CHECKUNIT(RETVAL)
-#else /* DIAGNOSTIC */
-#define CHECKUNIT_DIAG(RETVAL)
-#endif /* DIAGNOSTIC */
-
-int ${1}ioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT_DIAG(ENXIO);
-
- switch (cmd) {
- case DHIOCRESET:
- /* whatever resets it */
- outb(scp->dev->id_iobase, 0xff);
- break;
- default:
- return ENXIO;
- }
- return (0);
-}
-/*
- * You also need read, write, open, close routines.
- * This should get you started
- */
-static int
-${1}open(dev_t dev, int oflags, int devtype, struct proc *p)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT(ENXIO);
-
- /*
- * Do processing
- */
- return (0);
-}
-
-static int
-${1}close(dev_t dev, int fflag, int devtype, struct proc *p)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT_DIAG(ENXIO);
-
- /*
- * Do processing
- */
- return (0);
-}
-
-static int
-${1}read(dev_t dev, struct uio *uio, int ioflag)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
- int toread;
-
-
- CHECKUNIT_DIAG(ENXIO);
-
- /*
- * Do processing
- * read from buffer
- */
- toread = (min(uio->uio_resid, sizeof(scp->buffer)));
- return(uiomove(scp->buffer, toread, uio));
-}
-
-static int
-${1}write(dev_t dev, struct uio *uio, int ioflag)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
- int towrite;
-
- CHECKUNIT_DIAG(ENXIO);
-
- /*
- * Do processing
- * write to buffer
- */
- towrite = (min(uio->uio_resid, sizeof(scp->buffer)));
- return(uiomove(scp->buffer, towrite, uio));
-}
-
-static int
-${1}mmap(dev_t dev, int offset, int nprot)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT_DIAG(-1);
-
- /*
- * Do processing
- */
-#if 0 /* if we had a frame buffer or whatever.. do this */
- if (offset > FRAMEBUFFERSIZE - PAGE_SIZE) {
- return (-1);
- }
- return i386_btop((FRAMEBASE + offset));
-#else
- return (-1);
-#endif
-}
-
-static int
-${1}select(dev_t dev, int which, struct proc *p)
-{
- int unit = UNIT (dev);
- sc_p scp = sca[unit];
-
- CHECKUNIT_DIAG(ENXIO);
-
- /*
- * Do processing
- */
- return (0); /* this is the wrong value I'm sure */
-}
-
-/*
- * Now for some driver initialisation.
- * Occurs ONCE during boot (very early).
- */
-static void
-${1}_drvinit(void *unused)
-{
- dev_t dev;
- int unit;
- sc_p scp = sca[unit];
-
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &${1}_cdevsw, NULL);
- for (unit = 0; unit < N${UPPER}; unit++) {
- /*
- * Allocate storage for this instance .
- */
- scp = malloc(sizeof(*scp), M_DEVBUF, M_NOWAIT);
- if( scp == NULL) {
- printf("${1}%d failed to allocate strorage\n", unit);
- return ;
- }
- bzero(scp, sizeof(*scp));
- sca[unit] = scp;
-#if DEVFS
- scp->devfs_token = devfs_add_devswf(&${1}_cdevsw, unit, DV_CHR,
- UID_ROOT, GID_KMEM, 0640, "${1}%d", unit);
-#endif
- }
-}
-
-SYSINIT(${1}dev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+CDEV_MAJOR,
- ${1}_drvinit, NULL)
-
-
-DONE
-
-cat >../../sys/${1}io.h <<DONE
-/*
- * Definitions needed to access the ${1} device (ioctls etc)
- * see mtio.h , ioctl.h as examples
- */
-#ifndef SYS_DHIO_H
-#define SYS_DHIO_H
-
-#ifndef KERNEL
-#include <sys/types.h>
-#endif
-#include <sys/ioccom.h>
-
-/*
- * define an ioctl here
- */
-#define DHIOCRESET _IO('D', 0) /* reset the ${1} device */
-#endif
-DONE
-
-config ${UPPER}
-cd ../../compile/${UPPER}
-make depend
-make ${1}.o
-make
-exit
-
-#--------------end of script---------------
-#
-#you also need to add an entry into the cdevsw[]
-#array in conf.c, but it's too hard to do in a script..
-#
-#edit to your taste..
-#
-#
-
-
diff --git a/share/examples/printing/diablo-if-net b/share/examples/printing/diablo-if-net
deleted file mode 100644
index b2ba028f2343..000000000000
--- a/share/examples/printing/diablo-if-net
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# diablo-if-net - Text filter for Diablo printer `scrivener' listening
-# on port 5100. Installed in /usr/local/libexec/diablo-if-net
-#
-
-exec /usr/libexec/lpr/lpf "$@" | /usr/local/libexec/netprint scrivener 5100
diff --git a/share/examples/printing/hpdf b/share/examples/printing/hpdf
deleted file mode 100644
index d03c3ac70dfd..000000000000
--- a/share/examples/printing/hpdf
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-#
-# hpdf - Print DVI data on HP/PCL printer
-# Installed in /usr/local/libexec/hpdf
-
-PATH=/usr/local/bin:$PATH; export PATH
-
-#
-# Define a function to clean up our temporary files. These exist
-# in the current directory, which will be the spooling directory
-# for the printer.
-#
-cleanup() {
- rm -f hpdf$$.dvi
-}
-
-#
-# Define a function to handle fatal errors: print the given message
-# and exit 2. Exiting with 2 tells LPD to do not try to reprint the
-# job.
-#
-fatal() {
- echo "$@" 1>&2
- cleanup
- exit 2
-}
-
-#
-# If user removes the job, LPD will send SIGINT, so trap SIGINT
-# (and a few other signals) to clean up after ourselves.
-#
-trap cleanup 1 2 15
-
-#
-# Make sure we are not colliding with any existing files.
-#
-cleanup
-
-#
-# Link the DVI input file to standard input (the file to print).
-#
-ln -s /dev/fd/0 hpdf$$.dvi || fatal "Cannot symlink /dev/fd/0"
-
-#
-# Make LF = CR+LF
-#
-printf "\033&k2G" || fatal "Cannot initialize printer"
-
-#
-# Convert and print. Return value from dvilj2p does not seem to be
-# reliable, so we ignore it.
-#
-dvilj2p -M1 -q -e- dfhp$$.dvi
-
-#
-# Clean up and exit
-#
-cleanup
-exit 0
diff --git a/share/examples/printing/hpif b/share/examples/printing/hpif
deleted file mode 100644
index 69f1f34c55fd..000000000000
--- a/share/examples/printing/hpif
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-#
-# hpif - Simple text input filter for lpd for HP-PCL based printers
-# Installed in /usr/local/libexec/hpif
-#
-# Simply copies stdin to stdout. Ignores all filter arguments.
-# Tells printer to treat LF as CR+LF. Writes a form feed character
-# after printing job.
-
-printf "\033&k2G" && cat && printf "\f" && exit 0
-exit 2
diff --git a/share/examples/printing/hpof b/share/examples/printing/hpof
deleted file mode 100644
index 691b07f95d16..000000000000
--- a/share/examples/printing/hpof
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# hpof - Output filter for Hewlett Packard PCL-compatible printers
-# Installed in /usr/local/libexec/hpof
-
-
-printf "\033&k2G" || exit 2
-exec /usr/libexec/lpr/lpf
diff --git a/share/examples/printing/hprf b/share/examples/printing/hprf
deleted file mode 100644
index 37ad583fd9e1..000000000000
--- a/share/examples/printing/hprf
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# hprf - FORTRAN text filter for LaserJet 3si:
-# Installed in /usr/local/libexec/hprf
-#
-
-printf "\033&k2G" && fpr && printf "\f" && exit 0
-exit 2
diff --git a/share/examples/printing/hpvf b/share/examples/printing/hpvf
deleted file mode 100644
index 233de809745b..000000000000
--- a/share/examples/printing/hpvf
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-#
-# hpvf - Convert GIF files into HP/PCL, then print
-# Installed in /usr/local/libexec/hpvf
-
-PATH=/usr/X11R6/bin:$PATH; export PATH
-
-giftopnm | ppmtopgm | pgmtopbm | pbmtolj -resolution 300 \
- && exit 0 \
- || exit 2
diff --git a/share/examples/printing/if-simple b/share/examples/printing/if-simple
deleted file mode 100644
index 7a5bf97ab38f..000000000000
--- a/share/examples/printing/if-simple
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-#
-# if-simple - Simple text input filter for lpd
-# Installed in /usr/local/libexec/if-simple
-#
-# Simply copies stdin to stdout. Ignores all filter arguments.
-
-/bin/cat && exit 0
-exit 2
diff --git a/share/examples/printing/if-simpleX b/share/examples/printing/if-simpleX
deleted file mode 100644
index c14b4a25d12b..000000000000
--- a/share/examples/printing/if-simpleX
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-#
-# if-simple - Simple text input filter for lpd
-# Installed in /usr/local/libexec/if-simple
-#
-# Simply copies stdin to stdout. Ignores all filter arguments.
-# Writes a form feed character (\f) after printing job.
-
-/bin/cat && printf "\f" && exit 0
-exit 2
diff --git a/share/examples/printing/ifhp b/share/examples/printing/ifhp
deleted file mode 100644
index 21e6643473e3..000000000000
--- a/share/examples/printing/ifhp
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-#
-# ifhp - Print Ghostscript-simulated PostScript on a DesJet 500
-# Installed in /usr/local/libexec/hpif
-
-#
-# Treat LF as CR+LF:
-#
-printf "\033&k2G" || exit 2
-
-#
-# Read first two characters of the file
-#
-read first_line
-first_two_chars=`expr "$first_line" : '\(..\)'`
-
-if [ "$first_two_chars" = "%!" ]; then
- #
- # It is PostScript; use Ghostscript to scan-convert and print it
- #
- /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 -sOutputFile=- - \
- && exit 0
-
-else
- #
- # Plain text or HP/PCL, so just print it directly; print a form
- # at the end to eject the last page.
- #
- echo $first_line && cat && printf "\f" && exit 2
-fi
-
-exit 2
diff --git a/share/examples/printing/make-ps-header b/share/examples/printing/make-ps-header
deleted file mode 100644
index 19e38ab7c779..000000000000
--- a/share/examples/printing/make-ps-header
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-#
-# make-ps-header - make a PostScript header page on stdout
-# Installed in /usr/local/libexec/make-ps-header
-#
-
-#
-# These are PostScript units (72 to the inch). Modify for A4 or
-# whatever size paper you are using:
-#
-page_width=612
-page_height=792
-border=72
-
-#
-# Check arguments
-#
-if [ $# -ne 3 ]; then
- echo "Usage: `basename $0` <user> <host> <job>" 1>&2
- exit 1
-fi
-
-#
-# Save these, mostly for readability in the PostScript, below.
-#
-user=$1
-host=$2
-job=$3
-date=`date`
-
-#
-# Send the PostScript code to stdout.
-#
-exec cat <<EOF
-%!PS
-
-%
-% Make sure we do not interfere with user's job that will follow
-%
-save
-
-%
-% Make a thick, unpleasant border around the edge of the paper.
-%
-$border $border moveto
-$page_width $border 2 mul sub 0 rlineto
-0 $page_height $border 2 mul sub rlineto
-currentscreen 3 -1 roll pop 100 3 1 roll setscreen
-$border 2 mul $page_width sub 0 rlineto closepath
-0.8 setgray 10 setlinewidth stroke 0 setgray
-
-%
-% Display user's login name, nice and large and prominent
-%
-/Helvetica-Bold findfont 64 scalefont setfont
-$page_width ($user) stringwidth pop sub 2 div $page_height 200 sub moveto
-($user) show
-
-%
-% Now show the boring particulars
-%
-/Helvetica findfont 14 scalefont setfont
-/y 200 def
-[ (Job:) (Host:) (Date:) ] {
- 200 y moveto show /y y 18 sub def
-} forall
-
-/Helvetica-Bold findfont 14 scalefont setfont
-/y 200 def
-[ ($job) ($host) ($date) ] {
- 270 y moveto show /y y 18 sub def
-} forall
-
-%
-% That is it
-%
-restore
-showpage
-EOF
diff --git a/share/examples/printing/netprint b/share/examples/printing/netprint
deleted file mode 100644
index 9b5010cc8cc5..000000000000
--- a/share/examples/printing/netprint
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/perl
-#
-# netprint - Text filter for printer attached to network
-# Installed in /usr/local/libexec/netprint
-#
-
-$#ARGV eq 1 || die "Usage: $0 <printer-hostname> <port-number>";
-
-$printer_host = $ARGV[0];
-$printer_port = $ARGV[1];
-
-require 'sys/socket.ph';
-
-($ignore, $ignore, $protocol) = getprotobyname('tcp');
-($ignore, $ignore, $ignore, $ignore, $address)
- = gethostbyname($printer_host);
-
-$sockaddr = pack('S n a4 x8', &AF_INET, $printer_port, $address);
-
-socket(PRINTER, &PF_INET, &SOCK_STREAM, $protocol)
- || die "Can't create TCP/IP stream socket: $!";
-connect(PRINTER, $sockaddr) || die "Can't contact $printer_host: $!";
-while (<STDIN>) { print PRINTER; }
-exit 0;
diff --git a/share/examples/printing/psdf b/share/examples/printing/psdf
deleted file mode 100644
index e0d429b953c2..000000000000
--- a/share/examples/printing/psdf
+++ /dev/null
@@ -1,8 +0,0 @@
-#!bin/sh
-#
-# psdf - DVI to PostScript printer filter
-# Installed in /usr/local/libexec/psdf
-#
-# Invoked by lpd when user runs lpr -d
-#
-exec /usr/local/bin/dvips -f | /usr/local/libexec/lprps "$@"
diff --git a/share/examples/printing/psdfX b/share/examples/printing/psdfX
deleted file mode 100644
index 43bdc4100bdb..000000000000
--- a/share/examples/printing/psdfX
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-#
-# psdf - DVI to PostScript printer filter
-# Installed in /usr/local/libexec/psdf
-#
-# Invoked by lpd when user runs lpr -d
-#
-
-orig_args="$@"
-
-fail() {
- echo "$@" 1>&2
- exit 2
-}
-
-while getopts "x:y:n:h:" option; do
- case $option in
- x|y) ;; # Ignore
- n) login=$OPTARG ;;
- h) host=$OPTARG ;;
- *) echo "LPD started `basename $0` wrong." 1>&2
- exit 2
- ;;
- esac
-done
-
-[ "$login" ] || fail "No login name"
-[ "$host" ] || fail "No host name"
-
-( /u/kelly/freebsd/printing/filters/make-ps-header $login $host "DVI File"
- /usr/local/bin/dvips -f ) | eval /usr/local/libexec/lprps $orig_args
diff --git a/share/examples/printing/psif b/share/examples/printing/psif
deleted file mode 100644
index 2a657e01aae7..000000000000
--- a/share/examples/printing/psif
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-#
-# psif - Print PostScript or plain text on a PostScript printer
-# Script version; NOT the version that comes with lprps
-# Installed in /usr/local/libexec/psif
-#
-
-read first_line
-first_two_chars=`expr "$first_line" : '\(..\)'`
-
-if [ "$first_two_chars" = "%!" ]; then
- #
- # PostScript job, print it.
- #
- echo $first_line && cat && printf "\004" && exit 0
- exit 2
-else
- #
- # Plain text, convert it, then print it.
- #
- ( echo $first_line; cat ) | /usr/local/bin/textps && printf "\004" && exit 0
- exit 2
-fi
diff --git a/share/examples/printing/pstf b/share/examples/printing/pstf
deleted file mode 100644
index 308adc19e2ab..000000000000
--- a/share/examples/printing/pstf
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-#
-# pstf - Convert groff's troff data into PS, then print.
-# Installed in /usr/local/libexec/pstf
-#
-exec grops | /usr/local/libexec/lprps "$@"
diff --git a/share/examples/printing/pstfX b/share/examples/printing/pstfX
deleted file mode 100644
index 1af7134223c2..000000000000
--- a/share/examples/printing/pstfX
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-#
-# pstf - Convert groff's troff data into PS, then print.
-# Installed in /usr/local/libexec/pstf
-#
-exec grops
diff --git a/share/man/man4/od.4 b/share/man/man4/od.4
deleted file mode 100644
index ef5b023875eb..000000000000
--- a/share/man/man4/od.4
+++ /dev/null
@@ -1,288 +0,0 @@
-.\" Copyright (c) 1996,1997 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
-.\" 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 Shunsuke Akiyama.
-.\" 4. Neither the name of the author nor the names of any co-contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY Shunsuke Akiyama 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 Shunsuke Akiyama 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.
-.\"
-.\" $Id$
-.\"
-.Dd March 16, 1997
-.Dt OD 4
-.Os FreeBSD
-.Sh NAME
-.Nm od
-.Nd SCSI optical disk driver
-.Sh SYNOPSIS
-.Cd device od
-.Cd device od1 at scbus0 target 3 lun 0
-.Pp
-To use a drive which returns bogus ASC/ASCQ values:
-.Cd options OD_BOGUS_NOT_READY
-.Pp
-To enable an automatic spindown:
-.Cd options OD_AUTO_TURNOFF
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for a
-.Em SCSI
-optical disk (AKA. Magneto-Optical or Phase change optical Disk) drive.
-It enables the media change operation and the disk to be divided
-up into a set of pseudo devices called
-.Em partitions .
-A partition has both a
-.Em raw
-interface
-and a
-.Em block mode
-interface.
-In general the interfaces are similar to those described by
-.Xr wd 4
-and
-.Xr sd 4 .
-.Pp
-As the SCSI adapter is probed during boot, the
-.Em SCSI
-bus is scanned for devices. Any devices found which answered as
-.Sq Em Optical
-and
-.Sq Em removable
-type device will be attached to the
-.Nm
-driver.
-In
-.Fx 2.1.5
-or later, the first device found will be attached as
-.Em od0
-and the next,
-.Em od1 ,
-and so on.
-It is possible to specify which od unit a device should
-come on line as; refer to
-.Xr scsi 4
-for details on kernel configuration.
-Beginning in
-.Fx 2.2
-the
-.Nm
-driver can handle any device which answers as being type
-.Sq Em Direct
-and
-.Sq Em removable
-as well as
-.Sq Em Optical
-and
-.Sq Em removable
-type devices.
-.Sh PARTITIONING
-The
-.Nm
-driver allows the disk to have two levels of partitioning.
-One layer, called the
-.Dq slice layer ,
-is used to separate the
-.Tn FreeBSD
-areas of the disk from areas used by other operating systems.
-The second layer is the native
-.Bx 4.4
-partitioning scheme,
-.Xr disklabel 5 ,
-which is used to subdivide the
-.Tn FreeBSD
-slices into areas for individual filesystems.
-For more information, see
-.Xr fdisk 8
-and
-.Xr disklabel 8 ,
-respectively.
-.Pp
-If an uninitialized disk is opened, the slice table will be
-initialized with a fictitious
-.Tn FreeBSD
-slice spanning the entire disk. Similarly, if an uninitialized
-(or
-.No non- Ns Tn FreeBSD )
-slice is opened, its disklabel will be initialized with parameters
-returned by the drive and a single
-.Sq Li c
-partition encompassing the entire slice.
-.Sh KERNEL CONFIGURATION
-Only one
-.Nm
-device is necessary in the config file; data structures are dynamically
-allocated as disks are found on the
-.Tn SCSI
-bus.
-.Sh IOCTLS
-The following
-.Xr ioctl 2
-calls apply to optical disks as well as to other disks.
-They are defined in the header file
-.Aq Pa sys/disklabel.h .
-.Pp
-.Bl -tag -width CDIOCPREVENT
-.It Dv DIOCSBAD
-Usually used to set up a bad-block mapping system on the disk. SCSI
-drives incorporate their own bad-block mapping so this is not
-implemented, however it MAY be implemented in the future as a 'kludged'
-interface to the SCSI bad-block mapping.
-.It Dv DIOCGDINFO
-Read the in-core copy of the disklabel for the
-drive from the kernel. This may be a fictitious disklabel if the drive
-has never been initialised, in which case it will contain information read
-from the SCSI inquiry commands, and should be the same as
-the information printed at boot.
-.It Dv DIOCSDINFO
-Give the driver a new disklabel to use. The driver will NOT try write
-the new disklabel to the disk.
-.It Dv DIOCWLABEL
-Enable or Disable the driver's software write protect of the disklabel
-on the disk.
-.It Dv DIOCWDINFO
-Give the driver a new disklabel to use. The driver WILL try write the
-new disklabel to the disk.
-.El
-.Pp
-And the following
-.Xr ioctl 2
-calls which apply to optical disks are defined in the header file
-.Aq Pa sys/cdio.h .
-.Bl -tag -width CDIOCPREVENT
-.It Dv CDIOCEJECT
-Eject the optical disk media.
-.It Dv CDIOCALLOW
-Tell the drive to allow manual ejection of the optical disk media.
-.It Dv CDIOCPREVENT
-Tell the drive to prevent manual ejection of the optical disk media.
-.El
-.Pp
-In addition, the
-.Xr scsi 4
-general ioctls may be used with the
-.Nm
-driver, but only against the fourth (whole disk) partition.
-.Sh NOTES
-Currently the
-.Nm
-driver accepts 512, 1024 and 2048 byte/sector media.
-Raw and block mode device access to non-512 byte/sector media
-would be allowed only on each sector size boundary start position and
-I/O size.
-.Sh FILES
-.Bl -tag -width /dev/rodXXXXX -compact
-.It Pa /dev/rod Ns Ar u
-raw mode
-.Tn SCSI
-optical disk unit
-.Ar u ,
-accessed as an unpartitioned device
-.Sm off
-.It Pa /dev/od Ar u Pa s Ar n
-.Sm on
-block mode
-.Tn SCSI
-optical disk unit
-.Ar u ,
-slice
-.Ar n ,
-accessed as an unpartitioned device
-.Sm off
-.It Pa /dev/rod Ar u Pa s Ar n
-.Sm on
-raw mode
-.Tn SCSI
-optical disk unit
-.Ar u ,
-slice
-.ar n ,
-accessed as an unpartitioned device
-.It Pa /dev/od Ns Ar u Ns Ar p
-block mode
-.Tn SCSI
-optical disk unit
-.Ar u ,
-first
-.Tn FreeBSD
-slice, partition
-.Ar p
-.It Pa /dev/rod Ns Ar u Ns Ar p
-raw mode
-.Tn SCSI
-optical disk unit
-.Ar u ,
-first
-.Tn FreeBSD
-slice, partition
-.Ar p
-.Sm off
-.It Xo
-.Pa /dev/od Ar u Pa s Ar n Ar p
-.Xc
-.Sm on
-block mode
-.Tn SCSI
-optical disk unit
-.Ar u ,
-.No Ar n Ns th
-slice, partition
-.Ar p
-.Sm off
-.It Xo
-.Pa /dev/rod Ar u Pa s Ar n Ar p
-.Xc
-raw mode
-.Tn SCSI
-optical disk unit
-.Ar u ,
-.No Ar n Ns th
-slice, partition
-.Ar p
-.Sm off
-.It Xo
-.Pa /dev/rod Ar u Pa .ctl
-.Xc
-the control device unit
-.Ar u ,
-as being used by
-.Xr scsi 8
-.El
-.Sh DIAGNOSTICS
-None.
-.Sh SEE ALSO
-.Xr fdisk 1 ,
-.Xr scsi 4 ,
-.Xr sd 4 ,
-.Xr cd 4 ,
-.Xr disklabel 5 ,
-.Xr disklabel 8
-.Sh AUTHOR
-Shunsuke Akiyama <akiyama@jp.FreeBSD.org>
-.Sh HISTORY
-The
-.Nm
-driver first appeared in
-.Fx 2.1.5 .
diff --git a/share/timedef/data/ko_KR.EUC.src b/share/timedef/data/ko_KR.EUC.src
deleted file mode 100644
index eb5f45f7f0f1..000000000000
--- a/share/timedef/data/ko_KR.EUC.src
+++ /dev/null
@@ -1,89 +0,0 @@
-# $Id: ru_SU.KOI8-R.src,v 1.7 1997/02/22 13:56:47 peter Exp $
-#
-# Choi Jun Ho <jazz.snu.ac.kr>
-# 27 Mar 1997
-#
-# WARNING: spaces may be essential at the end of lines
-# WARNING: empty lines are essential too
-#
-# Short month names
-# it must be 3 char
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
-#
-# Long month names
-#
-1¿ù
-2¿ù
-3¿ù
-4¿ù
-5¿ù
-6¿ù
-7¿ù
-8¿ù
-9¿ù
-10¿ù
-11¿ù
-12¿ù
-#
-# Short weekday names
-#
-# it must be 3 char also
-# two char is our weekday name, and be careful one space is in the last
-ÀÏ
-¿ù
-È­
-¼ö
-¸ñ
-±Ý
-Åä
-#
-# Long weekday names
-#
-ÀÏ¿äÀÏ
-¿ù¿äÀÏ
-È­¿äÀÏ
-¼ö¿äÀÏ
-¸ñ¿äÀÏ
-±Ý¿äÀÏ
-Åä¿äÀÏ
-#
-# X_fmt
-#
-%H½Ã %MºÐ %SÃÊ
-#
-# x_fmt
-#
-%y/%m/%d
-#
-# c_fmt
-#
-# just following tradition...
-# %Y³â %b¿ù %eÀÏ %a¿äÀÏ %X
-%a %b %e %H:%M:%S %Y
-#
-# am
-#
-# it must be 2 char
-#¿ÀÀü
-AM
-#
-# pm
-#
-# it must be 2 char
-#¿ÀÈÄ
-PM
-#
-# date_fmt
-#
-%Y³â %b¿ù %eÀÏ %a¿äÀÏ %X %Z
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index b5b6174a8e74..fd930f0cc665 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -32,11 +32,11 @@
# SUCH DAMAGE.
#
# @(#)newvers.sh 8.1 (Berkeley) 4/20/94
-# $Id: newvers.sh,v 1.26.2.11 1997/04/15 05:29:32 asami Exp $
+# $Id: newvers.sh,v 1.26.2.13 1997/05/16 09:21:47 jkh Exp $
TYPE="FreeBSD"
-REVISION="2.2"
-BRANCH="STABLE"
+REVISION="2.2.2"
+BRANCH="RELEASE"
RELEASE="${REVISION}-${BRANCH}"
SNAPDATE=""
if [ "X${SNAPDATE}" != "X" ]; then
@@ -44,7 +44,7 @@ if [ "X${SNAPDATE}" != "X" ]; then
fi
VERSION="${TYPE} ${RELEASE}"
-RELDATE="221002"
+RELDATE="222000"
b=share/examples/etc/bsd-style-copyright
year=`date '+%Y'`
diff --git a/sys/dev/aic7xxx/aicasm.c b/sys/dev/aic7xxx/aicasm.c
deleted file mode 100644
index 45e3b755cd36..000000000000
--- a/sys/dev/aic7xxx/aicasm.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Aic7xxx SCSI host adapter firmware asssembler
- *
- * Copyright (c) 1997 Justin T. Gibbs.
- * 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 immediately at the beginning of the file, without modification,
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $Id: aic7xxx_asm.c,v 1.12.6.2 1997/03/18 19:19:10 gibbs Exp $
- */
-#include <sys/types.h>
-#include <sys/mman.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <unistd.h>
-
-#include "aic7xxx_asm.h"
-#include "symbol.h"
-#include "sequencer.h"
-
-static void usage __P((void));
-static void back_patch __P((void));
-static void output_code __P((FILE *ofile));
-static void output_listing __P((FILE *listfile, char *ifilename,
- char *options));
-static struct patch *next_patch __P((struct patch *cur_patch, int options,
- int instrptr));
-
-struct path_list search_path;
-int includes_search_curdir;
-char *appname;
-FILE *ofile;
-char *ofilename;
-
-static STAILQ_HEAD(,instruction) seq_program;
-static STAILQ_HEAD(, patch) patch_list;
-symlist_t patch_options;
-
-#if DEBUG
-extern int yy_flex_debug;
-extern int yydebug;
-#endif
-extern FILE *yyin;
-extern int yyparse __P((void));
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- extern char *optarg;
- extern int optind;
- int ch;
- int retval;
- char *inputfilename;
- char *regfilename;
- FILE *regfile;
- char *listfilename;
- FILE *listfile;
- char *options;
-
- SLIST_INIT(&search_path);
- STAILQ_INIT(&seq_program);
- STAILQ_INIT(&patch_list);
- SLIST_INIT(&patch_options);
- includes_search_curdir = 1;
- appname = *argv;
- regfile = NULL;
- listfile = NULL;
- options = NULL;
-#if DEBUG
- yy_flex_debug = 0;
-#endif
- while ((ch = getopt(argc, argv, "d:l:n:o:r:I:O:")) != -1) {
- switch(ch) {
- case 'd':
-#if DEBUG
- if (strcmp(optarg, "s") == 0)
- yy_flex_debug = 1;
- else if (strcmp(optarg, "p") == 0)
- yydebug = 1;
-#else
- stop("-d: Assembler not built with debugging "
- "information", EX_SOFTWARE);
-#endif
- break;
- case 'l':
- /* Create a program listing */
- if ((listfile = fopen(optarg, "w")) == NULL) {
- perror(optarg);
- stop(NULL, EX_CANTCREAT);
- }
- listfilename = optarg;
- break;
- case 'n':
- /* Don't complain about the -nostdinc directrive */
- if (strcmp(optarg, "ostdinc")) {
- fprintf(stderr, "%s: Unknown option -%c%s\n",
- appname, ch, optarg);
- usage();
- /* NOTREACHED */
- }
- break;
- case 'o':
- if ((ofile = fopen(optarg, "w")) == NULL) {
- perror(optarg);
- stop(NULL, EX_CANTCREAT);
- }
- ofilename = optarg;
- break;
- case 'O':
- /* Patches to include in the listing */
- options = optarg;
- break;
- case 'r':
- if ((regfile = fopen(optarg, "w")) == NULL) {
- perror(optarg);
- stop(NULL, EX_CANTCREAT);
- }
- regfilename = optarg;
- break;
- case 'I':
- {
- path_entry_t include_dir;
-
- if (strcmp(optarg, "-") == 0) {
- if (includes_search_curdir == 0) {
- fprintf(stderr, "%s: Warning - '-I-' "
- "specified multiple "
- "times\n", appname);
- }
- includes_search_curdir = 0;
- for (include_dir = search_path.slh_first;
- include_dir != NULL;
- include_dir = include_dir->links.sle_next)
- /*
- * All entries before a '-I-' only
- * apply to includes specified with
- * quotes instead of "<>".
- */
- include_dir->quoted_includes_only = 1;
- } else {
- include_dir =
- (path_entry_t)malloc(sizeof(*include_dir));
- if (include_dir == NULL) {
- perror(optarg);
- stop(NULL, EX_OSERR);
- }
- include_dir->directory = strdup(optarg);
- if (include_dir->directory == NULL) {
- perror(optarg);
- stop(NULL, EX_OSERR);
- }
- include_dir->quoted_includes_only = 0;
- SLIST_INSERT_HEAD(&search_path, include_dir,
- links);
- }
- break;
- }
- case '?':
- default:
- usage();
- /* NOTREACHED */
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc != 1) {
- fprintf(stderr, "%s: No input file specifiled\n", appname);
- usage();
- /* NOTREACHED */
- }
-
- symtable_open();
- inputfilename = *argv;
- include_file(*argv, SOURCE_FILE);
- retval = yyparse();
- if (retval == 0) {
- back_patch();
- if (ofile != NULL)
- output_code(ofile);
- if (regfile != NULL)
- symtable_dump(regfile);
- if (listfile != NULL)
- output_listing(listfile, inputfilename, options);
- }
-
- stop(NULL, 0);
- /* NOTREACHED */
- return (0);
-}
-
-static void
-usage()
-{
-
- (void)fprintf(stderr,
-"usage: %-16s [-nostdinc] [-I-] [-I directory] [-o output_file]
- [-r register_output_file] [-l program_list_file]
- [-O option_name[|options_name2]] input_file\n",
- appname);
- exit(EX_USAGE);
-}
-
-static void
-back_patch()
-{
- struct instruction *cur_instr;
-
- for(cur_instr = seq_program.stqh_first;
- cur_instr != NULL;
- cur_instr = cur_instr->links.stqe_next) {
- if (cur_instr->patch_label != NULL) {
- struct ins_format3 *f3_instr;
- u_int address;
-
- if (cur_instr->patch_label->type != LABEL) {
- char buf[255];
-
- snprintf(buf, sizeof(buf),
- "Undefined label %s",
- cur_instr->patch_label->name);
- stop(buf, EX_DATAERR);
- /* NOTREACHED */
- }
- f3_instr = &cur_instr->format.format3;
- address = ((f3_instr->opcode_addr & ADDR_HIGH_BIT) << 8)
- | f3_instr->address;
- address += cur_instr->patch_label->info.linfo->address;
- f3_instr->opcode_addr &= ~ADDR_HIGH_BIT;
- f3_instr->opcode_addr |= (address >> 8) & ADDR_HIGH_BIT;
- f3_instr->address = address & 0xFF;
- }
- }
-}
-
-static void
-output_code(ofile)
- FILE *ofile;
-{
- struct instruction *cur_instr;
- patch_t *cur_patch;
- symbol_node_t *cur_node;
- int instrcount;
-
- instrcount = 0;
- fprintf(ofile,
-"/*
- * DO NOT EDIT - This file is automatically generated.
- */\n");
-
- fprintf(ofile, "static u_int8_t seqprog[] = {\n");
- for(cur_instr = seq_program.stqh_first;
- cur_instr != NULL;
- cur_instr = cur_instr->links.stqe_next) {
- fprintf(ofile, "\t0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
- cur_instr->format.bytes[0],
- cur_instr->format.bytes[1],
- cur_instr->format.bytes[2],
- cur_instr->format.bytes[3]);
- instrcount++;
- }
- fprintf(ofile, "};\n");
-
- /*
- * Output the patch list, option definitions first.
- */
- for(cur_node = patch_options.slh_first;
- cur_node != NULL;
- cur_node = cur_node->links.sle_next) {
- fprintf(ofile, "#define\t%-16s\t0x%x\n", cur_node->symbol->name,
- cur_node->symbol->info.condinfo->value);
- }
-
- fprintf(ofile,
-"struct patch {
- int options;
- int negative;
- int begin;
- int end;
-} patches[] = {\n");
-
- for(cur_patch = patch_list.stqh_first;
- cur_patch != NULL;
- cur_patch = cur_patch->links.stqe_next)
-
- fprintf(ofile, "\t{ 0x%08x, %d, 0x%03x, 0x%03x },\n",
- cur_patch->options, cur_patch->negative, cur_patch->begin,
- cur_patch->end);
-
- fprintf(ofile, "\t{ 0x%08x, %d, 0x%03x, 0x%03x }\n};\n",
- 0, 0, 0, 0);
-
- fprintf(stderr, "%s: %d instructions used\n", appname, instrcount);
-}
-
-void
-output_listing(listfile, ifilename, patches)
- FILE *listfile;
- char *ifilename;
- char *patches;
-{
- FILE *ifile;
- int line;
- struct instruction *cur_instr;
- int instrcount;
- int instrptr;
- char buf[1024];
- patch_t *cur_patch;
- char *option_spec;
- int options;
-
- instrcount = 0;
- instrptr = 0;
- line = 1;
- options = 1; /* All code outside of patch blocks */
- if ((ifile = fopen(ifilename, "r")) == NULL) {
- perror(ifilename);
- stop(NULL, EX_DATAERR);
- }
-
- /*
- * Determine which options to apply to this listing.
- */
- while ((option_spec = strsep(&patches, "|")) != NULL) {
- symbol_t *symbol;
-
- symbol = symtable_get(option_spec);
- if (symbol->type != CONDITIONAL) {
- stop("Invalid option specified in patch list for "
- "program listing", EX_USAGE);
- /* NOTREACHED */
- }
- options |= symbol->info.condinfo->value;
- }
-
- cur_patch = patch_list.stqh_first;
- for(cur_instr = seq_program.stqh_first;
- cur_instr != NULL;
- cur_instr = cur_instr->links.stqe_next,instrcount++) {
-
- cur_patch = next_patch(cur_patch, options, instrcount);
- if (cur_patch
- && cur_patch->begin <= instrcount
- && cur_patch->end > instrcount)
- /* Don't count this instruction as it is in a patch
- * that was removed.
- */
- continue;
-
- while (line < cur_instr->srcline) {
- fgets(buf, sizeof(buf), ifile);
- fprintf(listfile, "\t\t%s", buf);
- line++;
- }
- fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr,
- cur_instr->format.bytes[0],
- cur_instr->format.bytes[1],
- cur_instr->format.bytes[2],
- cur_instr->format.bytes[3]);
- fgets(buf, sizeof(buf), ifile);
- fprintf(listfile, "\t%s", buf);
- line++;
- instrptr++;
- }
- /* Dump the remainder of the file */
- while(fgets(buf, sizeof(buf), ifile) != NULL)
- fprintf(listfile, "\t\t%s", buf);
-
- fclose(ifile);
-}
-
-static struct patch *
-next_patch(cur_patch, options, instrptr)
- struct patch *cur_patch;
- int options;
- int instrptr;
-{
- while(cur_patch != NULL) {
- if (((cur_patch->options & options) != 0
- && cur_patch->negative == FALSE)
- || ((cur_patch->options & options) == 0
- && cur_patch->negative == TRUE)
- || (instrptr >= cur_patch->end)) {
- /*
- * Either we want to keep this section of code,
- * or we have consumed this patch. Skip to the
- * next patch.
- */
- cur_patch = cur_patch->links.stqe_next;
- } else
- /* Found an okay patch */
- break;
- }
- return (cur_patch);
-}
-
-/*
- * Print out error information if appropriate, and clean up before
- * terminating the program.
- */
-void
-stop(string, err_code)
- const char *string;
- int err_code;
-{
- if (string != NULL) {
- fprintf(stderr, "%s: ", appname);
- if (yyfilename != NULL) {
- fprintf(stderr, "Stopped at file %s, line %d - ",
- yyfilename, yylineno);
- }
- fprintf(stderr, "%s\n", string);
- }
-
- if (ofile != NULL) {
- fclose(ofile);
- if (err_code != 0) {
- fprintf(stderr, "%s: Removing %s due to error\n",
- appname, ofilename);
- unlink(ofilename);
- }
- }
-
- symlist_free(&patch_options);
- symtable_close();
-
- exit(err_code);
-}
-
-struct instruction *
-seq_alloc()
-{
- struct instruction *new_instr;
-
- new_instr = (struct instruction *)malloc(sizeof(struct instruction));
- if (new_instr == NULL)
- stop("Unable to malloc instruction object", EX_SOFTWARE);
- memset(new_instr, 0, sizeof(*new_instr));
- STAILQ_INSERT_TAIL(&seq_program, new_instr, links);
- new_instr->srcline = yylineno;
- return new_instr;
-}
-
-patch_t *
-patch_alloc()
-{
- patch_t *new_patch;
-
- new_patch = (patch_t *)malloc(sizeof(patch_t));
- if (new_patch == NULL)
- stop("Unable to malloc patch object", EX_SOFTWARE);
- memset(new_patch, 0, sizeof(*new_patch));
- STAILQ_INSERT_TAIL(&patch_list, new_patch, links);
- return new_patch;
-}
diff --git a/sys/dev/aic7xxx/aicasm.h b/sys/dev/aic7xxx/aicasm.h
deleted file mode 100644
index 185d807f6788..000000000000
--- a/sys/dev/aic7xxx/aicasm.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Assembler for the sequencer program downloaded to Aic7xxx SCSI host adapters
- *
- * Copyright (c) 1997 Justin T. Gibbs.
- * 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 immediately at the beginning of the file, without modification,
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $Id$
- */
-
-#include <sys/queue.h>
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-typedef struct path_entry {
- char *directory;
- int quoted_includes_only;
- SLIST_ENTRY(path_entry) links;
-} *path_entry_t;
-
-typedef enum {
- QUOTED_INCLUDE,
- BRACKETED_INCLUDE,
- SOURCE_FILE
-} include_type;
-
-SLIST_HEAD(path_list, path_entry);
-
-extern struct path_list search_path;
-extern struct symlist patch_options;
-extern int includes_search_curdir; /* False if we've seen -I- */
-extern char *appname;
-extern int yylineno;
-extern char *yyfilename;
-
-void stop __P((const char *errstring, int err_code));
-void include_file __P((char *file_name, include_type type));
-struct instruction *seq_alloc __P((void));
-struct patch *patch_alloc __P((void));
diff --git a/sys/dev/aic7xxx/aicasm_gram.y b/sys/dev/aic7xxx/aicasm_gram.y
deleted file mode 100644
index 0c75edca3b3e..000000000000
--- a/sys/dev/aic7xxx/aicasm_gram.y
+++ /dev/null
@@ -1,1304 +0,0 @@
-%{
-/*
- * Parser for the Aic7xxx SCSI Host adapter sequencer assembler.
- *
- * Copyright (c) 1997 Justin T. Gibbs.
- * 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 immediately at the beginning of the file, without modification,
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $Id$
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-
-#include <sys/types.h>
-#include <sys/queue.h>
-
-#include "aic7xxx_asm.h"
-#include "symbol.h"
-#include "sequencer.h"
-
-int yylineno;
-char *yyfilename;
-static symbol_t *cur_symbol;
-static symtype cur_symtype;
-static symbol_t *accumulator;
-static symbol_ref_t allones;
-static symbol_ref_t allzeros;
-static symbol_ref_t none;
-static symbol_ref_t sindex;
-static int instruction_ptr;
-static int sram_or_scb_offset;
-static patch_t *cur_patch;
-
-static void process_bitmask __P((int mask_type, symbol_t *sym, int mask));
-static void initialize_symbol __P((symbol_t *symbol));
-static void process_register __P((symbol_t **p_symbol));
-static void format_1_instr __P((int opcode, symbol_ref_t *dest,
- expression_t *immed, symbol_ref_t *src,
- int ret));
-static void format_2_instr __P((int opcode, symbol_ref_t *dest,
- expression_t *places, symbol_ref_t *src,
- int ret));
-static void format_3_instr __P((int opcode, symbol_ref_t *src,
- expression_t *immed, symbol_ref_t *address));
-static void test_readable_symbol __P((symbol_t *symbol));
-static void test_writable_symbol __P((symbol_t *symbol));
-static void type_check __P((symbol_t *symbol, expression_t *expression,
- int and_op));
-static void make_expression __P((expression_t *immed, int value));
-static void add_conditional __P((symbol_t *symbol));
-
-#define YYDEBUG 1
-#define SRAM_SYMNAME "SRAM_BASE"
-#define SCB_SYMNAME "SCB_BASE"
-%}
-
-%union {
- int value;
- char *str;
- symbol_t *sym;
- symbol_ref_t sym_ref;
- expression_t expression;
-}
-
-%token T_REGISTER
-
-%token <value> T_CONST
-
-%token T_SCB
-
-%token T_SRAM
-
-%token T_ALIAS
-
-%token T_SIZE
-
-%token <value> T_ADDRESS
-
-%token T_ACCESS_MODE
-
-%token <value> T_MODE
-
-%token T_BIT
-
-%token T_MASK
-
-%token <value> T_NUMBER
-
-%token <str> T_PATH
-
-%token T_EOF T_INCLUDE
-
-%token <value> T_SHR T_SHL T_ROR T_ROL
-
-%token <value> T_MVI T_MOV T_CLR
-
-%token <value> T_JMP T_JC T_JNC T_JE T_JNE T_JNZ T_JZ T_CALL
-
-%token <value> T_ADD T_ADC
-
-%token <value> T_INC T_DEC
-
-%token <value> T_STC T_CLC
-
-%token <value> T_CMP T_XOR
-
-%token <value> T_TEST T_AND
-
-%token <value> T_OR
-
-%token T_RET
-
-%token T_NOP
-
-%token T_ACCUM T_ALLONES T_ALLZEROS T_NONE T_SINDEX
-
-%token T_A
-
-%token <sym> T_SYMBOL
-
-%token T_NL
-
-%token T_IF T_ELSE T_ENDIF
-
-%type <sym_ref> reg_symbol address destination source opt_source
-
-%type <expression> expression immediate immediate_or_a
-
-%type <value> ret f1_opcode f2_opcode jmp_jc_jnc_call jz_jnz je_jne
-
-%left '|'
-%left '&'
-%left '+' '-'
-%right '~'
-%nonassoc UMINUS
-%%
-
-program:
- include
-| program include
-| register
-| program register
-| constant
-| program constant
-| scratch_ram
-| program scratch_ram
-| scb
-| program scb
-| label
-| program label
-| conditional
-| program conditional
-| code
-| program code
-;
-
-include:
- T_INCLUDE '<' T_PATH '>'
- { include_file($3, BRACKETED_INCLUDE); }
-| T_INCLUDE '"' T_PATH '"'
- { include_file($3, QUOTED_INCLUDE); }
-;
-
-register:
- T_REGISTER { cur_symtype = REGISTER; } reg_definition
-;
-
-reg_definition:
- T_SYMBOL '{'
- {
- if ($1->type != UNINITIALIZED) {
- stop("Register multiply defined", EX_DATAERR);
- /* NOTREACHED */
- }
- cur_symbol = $1;
- cur_symbol->type = cur_symtype;
- initialize_symbol(cur_symbol);
- }
- reg_attribute_list
- '}'
- {
- /*
- * Default to allowing everything in for registers
- * with no bit or mask definitions.
- */
- if (cur_symbol->info.rinfo->valid_bitmask == 0)
- cur_symbol->info.rinfo->valid_bitmask = 0xFF;
-
- if (cur_symbol->info.rinfo->size == 0)
- cur_symbol->info.rinfo->size = 1;
-
- /*
- * This might be useful for registers too.
- */
- if (cur_symbol->type != REGISTER) {
- if (cur_symbol->info.rinfo->address == 0)
- cur_symbol->info.rinfo->address =
- sram_or_scb_offset;
- sram_or_scb_offset +=
- cur_symbol->info.rinfo->size;
- }
- cur_symbol = NULL;
- }
-;
-
-reg_attribute_list:
- reg_attribute
-| reg_attribute_list reg_attribute
-;
-
-reg_attribute:
- reg_address
-| size
-| access_mode
-| bit_defn
-| mask_defn
-| alias
-| accumulator
-| allones
-| allzeros
-| none
-| sindex
-;
-
-reg_address:
- T_ADDRESS T_NUMBER
- {
- cur_symbol->info.rinfo->address = $2;
- }
-;
-
-size:
- T_SIZE T_NUMBER
- {
- cur_symbol->info.rinfo->size = $2;
- }
-;
-
-access_mode:
- T_ACCESS_MODE T_MODE
- {
- cur_symbol->info.rinfo->mode = $2;
- }
-;
-
-bit_defn:
- T_BIT T_SYMBOL T_NUMBER
- {
- process_bitmask(BIT, $2, $3);
- }
-;
-
-mask_defn:
- T_MASK T_SYMBOL expression
- {
- process_bitmask(MASK, $2, $3.value);
- }
-;
-
-alias:
- T_ALIAS T_SYMBOL
- {
- if ($2->type != UNINITIALIZED) {
- stop("Re-definition of register alias",
- EX_DATAERR);
- /* NOTREACHED */
- }
- $2->type = ALIAS;
- initialize_symbol($2);
- $2->info.ainfo->parent = cur_symbol;
- }
-;
-
-accumulator:
- T_ACCUM
- {
- if (accumulator != NULL) {
- stop("Only one accumulator definition allowed",
- EX_DATAERR);
- /* NOTREACHED */
- }
- accumulator = cur_symbol;
- }
-;
-
-allones:
- T_ALLONES
- {
- if (allones.symbol != NULL) {
- stop("Only one definition of allones allowed",
- EX_DATAERR);
- /* NOTREACHED */
- }
- allones.symbol = cur_symbol;
- }
-;
-
-allzeros:
- T_ALLZEROS
- {
- if (allzeros.symbol != NULL) {
- stop("Only one definition of allzeros allowed",
- EX_DATAERR);
- /* NOTREACHED */
- }
- allzeros.symbol = cur_symbol;
- }
-;
-
-none:
- T_NONE
- {
- if (none.symbol != NULL) {
- stop("Only one definition of none allowed",
- EX_DATAERR);
- /* NOTREACHED */
- }
- none.symbol = cur_symbol;
- }
-;
-
-sindex:
- T_SINDEX
- {
- if (sindex.symbol != NULL) {
- stop("Only one definition of sindex allowed",
- EX_DATAERR);
- /* NOTREACHED */
- }
- sindex.symbol = cur_symbol;
- }
-;
-
-expression:
- expression '|' expression
- {
- $$.value = $1.value | $3.value;
- symlist_merge(&$$.referenced_syms,
- &$1.referenced_syms,
- &$3.referenced_syms);
- }
-| expression '&' expression
- {
- $$.value = $1.value & $3.value;
- symlist_merge(&$$.referenced_syms,
- &$1.referenced_syms,
- &$3.referenced_syms);
- }
-| expression '+' expression
- {
- $$.value = $1.value + $3.value;
- symlist_merge(&$$.referenced_syms,
- &$1.referenced_syms,
- &$3.referenced_syms);
- }
-| expression '-' expression
- {
- $$.value = $1.value - $3.value;
- symlist_merge(&($$.referenced_syms),
- &($1.referenced_syms),
- &($3.referenced_syms));
- }
-| '(' expression ')'
- {
- $$ = $2;
- }
-| '~' expression
- {
- $$ = $2;
- $$.value = (~$$.value) & 0xFF;
- }
-| '-' expression %prec UMINUS
- {
- $$ = $2;
- $$.value = -$$.value;
- }
-| T_NUMBER
- {
- $$.value = $1;
- SLIST_INIT(&$$.referenced_syms);
- }
-| T_SYMBOL
- {
- symbol_t *symbol;
-
- symbol = $1;
- switch (symbol->type) {
- case ALIAS:
- symbol = $1->info.ainfo->parent;
- case REGISTER:
- case SCBLOC:
- case SRAMLOC:
- $$.value = symbol->info.rinfo->address;
- break;
- case MASK:
- case BIT:
- $$.value = symbol->info.minfo->mask;
- break;
- case CONST:
- $$.value = symbol->info.cinfo->value;
- break;
- case UNINITIALIZED:
- default:
- {
- char buf[255];
-
- snprintf(buf, sizeof(buf),
- "Undefined symbol %s referenced",
- symbol->name);
- stop(buf, EX_DATAERR);
- /* NOTREACHED */
- break;
- }
- }
- SLIST_INIT(&$$.referenced_syms);
- symlist_add(&$$.referenced_syms, symbol, SYMLIST_INSERT_HEAD);
- }
-;
-
-constant:
- T_CONST T_SYMBOL T_NUMBER
- {
- if ($2->type != UNINITIALIZED) {
- stop("Re-definition of constant variable",
- EX_DATAERR);
- /* NOTREACHED */
- }
- $2->type = CONST;
- initialize_symbol($2);
- $2->info.cinfo->value = $3;
- $2->info.cinfo->define = $1;
- }
-;
-
-scratch_ram:
- T_SRAM '{'
- {
- cur_symbol = symtable_get(SRAM_SYMNAME);
- cur_symtype = SRAMLOC;
- if (cur_symbol->type != UNINITIALIZED) {
- stop("Only one SRAM definition allowed",
- EX_DATAERR);
- /* NOTREACHED */
- }
- cur_symbol->type = SRAMLOC;
- initialize_symbol(cur_symbol);
- }
- reg_address
- {
- sram_or_scb_offset = cur_symbol->info.rinfo->address;
- }
- scb_or_sram_reg_list
- '}'
- {
- cur_symbol = NULL;
- }
-;
-
-scb:
- T_SCB '{'
- {
- cur_symbol = symtable_get(SCB_SYMNAME);
- cur_symtype = SCBLOC;
- if (cur_symbol->type != UNINITIALIZED) {
- stop("Only one SRAM definition allowed",
- EX_SOFTWARE);
- /* NOTREACHED */
- }
- cur_symbol->type = SCBLOC;
- initialize_symbol(cur_symbol);
- }
- reg_address
- {
- sram_or_scb_offset = cur_symbol->info.rinfo->address;
- }
- scb_or_sram_reg_list
- '}'
- {
- cur_symbol = NULL;
- }
-;
-
-scb_or_sram_reg_list:
- reg_definition
-| scb_or_sram_reg_list reg_definition
-;
-
-reg_symbol:
- T_SYMBOL
- {
- process_register(&$1);
- $$.symbol = $1;
- $$.offset = 0;
- }
-| T_SYMBOL '[' T_NUMBER ']'
- {
- process_register(&$1);
- if (($3 + 1) > $1->info.rinfo->size) {
- stop("Accessing offset beyond range of register",
- EX_DATAERR);
- /* NOTREACHED */
- }
- $$.symbol = $1;
- $$.offset = $3;
- }
-| T_A
- {
- if (accumulator == NULL) {
- stop("No accumulator has been defined", EX_DATAERR);
- /* NOTREACHED */
- }
- $$.symbol = accumulator;
- $$.offset = 0;
- }
-;
-
-destination:
- reg_symbol
- {
- test_writable_symbol($1.symbol);
- $$ = $1;
- }
-;
-
-immediate:
- expression
- { $$ = $1; }
-;
-
-immediate_or_a:
- expression
- {
- $$ = $1;
- }
-| T_A
- {
- SLIST_INIT(&$$.referenced_syms);
- $$.value = 0;
- }
-;
-
-source:
- reg_symbol
- {
- test_readable_symbol($1.symbol);
- $$ = $1;
- }
-;
-
-opt_source:
- {
- $$.symbol = NULL;
- $$.offset = 0;
- }
-| ',' source
- { $$ = $2; }
-;
-
-ret:
- { $$ = 0; }
-| T_RET
- { $$ = 1; }
-;
-
-label:
- T_SYMBOL ':'
- {
- if ($1->type != UNINITIALIZED) {
- stop("Program label multiply defined", EX_DATAERR);
- /* NOTREACHED */
- }
- $1->type = LABEL;
- initialize_symbol($1);
- $1->info.linfo->address = instruction_ptr;
- }
-;
-
-address:
- T_SYMBOL
- {
- $$.symbol = $1;
- $$.offset = 0;
- }
-| T_SYMBOL '+' T_NUMBER
- {
- $$.symbol = $1;
- $$.offset = $3;
- }
-| T_SYMBOL '-' T_NUMBER
- {
- $$.symbol = $1;
- $$.offset = -$3;
- }
-| '.'
- {
- $$.symbol = NULL;
- $$.offset = 0;
- }
-| '.' '+' T_NUMBER
- {
- $$.symbol = NULL;
- $$.offset = $3;
- }
-| '.' '-' T_NUMBER
- {
- $$.symbol = NULL;
- $$.offset = -$3;
- }
-;
-
-conditional:
- T_IF
- {
- if (cur_patch != NULL) {
- stop("Nested .if directive", EX_DATAERR);
- /* NOTREACHED */
- }
- cur_patch = patch_alloc();
- cur_patch->begin = instruction_ptr;
- }
- option_list
-;
-
-conditional:
- T_ELSE
- {
- patch_t *next_patch;
-
- if (cur_patch == NULL) {
- stop(".else outsize of .if", EX_DATAERR);
- /* NOTREACHED */
- }
- cur_patch->end = instruction_ptr;
- next_patch = patch_alloc();
- next_patch->options = cur_patch->options;
- next_patch->negative = cur_patch->negative ? FALSE : TRUE;
- cur_patch = next_patch;
- cur_patch->begin = instruction_ptr;
- }
-;
-
-conditional:
- T_ENDIF
- {
- if (cur_patch == NULL) {
- stop(".endif outsize of .if", EX_DATAERR);
- /* NOTREACHED */
- }
- cur_patch->end = instruction_ptr;
- cur_patch = NULL;
- }
-;
-
-option_list:
- '(' option_symbol_list ')'
-| '!' option_list
- {
- cur_patch->negative = cur_patch->negative ? FALSE : TRUE;
- }
-;
-
-option_symbol_list:
- T_SYMBOL
- {
- add_conditional($1);
- }
-| option_list '|' T_SYMBOL
- {
- add_conditional($3);
- }
-;
-
-f1_opcode:
- T_AND { $$ = AIC_OP_AND; }
-| T_XOR { $$ = AIC_OP_XOR; }
-| T_ADD { $$ = AIC_OP_ADD; }
-| T_ADC { $$ = AIC_OP_ADC; }
-;
-
-code:
- f1_opcode destination ',' immediate_or_a opt_source ret ';'
- {
- format_1_instr($1, &$2, &$4, &$5, $6);
- }
-;
-
-code:
- T_OR reg_symbol ',' immediate_or_a opt_source ret ';'
- {
- format_1_instr(AIC_OP_OR, &$2, &$4, &$5, $6);
- }
-;
-
-code:
- T_INC destination opt_source ret ';'
- {
- expression_t immed;
-
- make_expression(&immed, 1);
- format_1_instr(AIC_OP_ADD, &$2, &immed, &$3, $4);
- }
-;
-
-code:
- T_DEC destination opt_source ret ';'
- {
- expression_t immed;
-
- make_expression(&immed, -1);
- format_1_instr(AIC_OP_ADD, &$2, &immed, &$3, $4);
- }
-;
-
-code:
- T_CLC ret ';'
- {
- expression_t immed;
-
- make_expression(&immed, -1);
- format_1_instr(AIC_OP_ADD, &none, &immed, &allzeros, $2);
- }
-| T_CLC T_MVI destination ',' immediate_or_a ret ';'
- {
- format_1_instr(AIC_OP_ADD, &$3, &$5, &allzeros, $6);
- }
-;
-
-code:
- T_STC ret ';'
- {
- expression_t immed;
-
- make_expression(&immed, 1);
- format_1_instr(AIC_OP_ADD, &none, &immed, &allones, $2);
- }
-| T_STC destination ret ';'
- {
- expression_t immed;
-
- make_expression(&immed, 1);
- format_1_instr(AIC_OP_ADD, &$2, &immed, &allones, $3);
- }
-;
-
-code:
- T_MOV destination ',' source ret ';'
- {
- expression_t immed;
-
- make_expression(&immed, 0xff);
- format_1_instr(AIC_OP_AND, &$2, &immed, &$4, $5);
- }
-;
-
-code:
- T_MVI destination ',' immediate_or_a ret ';'
- {
- format_1_instr(AIC_OP_OR, &$2, &$4, &allzeros, $5);
- }
-;
-
-code:
- T_CLR destination ret ';'
- {
- expression_t immed;
-
- make_expression(&immed, 0xff);
- format_1_instr(AIC_OP_AND, &$2, &immed, &allzeros, $3);
- }
-;
-
-code:
- T_NOP ';'
- {
- expression_t immed;
-
- make_expression(&immed, 0xff);
- format_1_instr(AIC_OP_AND, &none, &immed, &allzeros, FALSE);
- }
-;
-
-code:
- T_RET ';'
- {
- expression_t immed;
-
- make_expression(&immed, 0xff);
- format_1_instr(AIC_OP_AND, &none, &immed, &allzeros, TRUE);
- }
-;
-
- /*
- * This grammer differs from the one in the aic7xxx
- * reference manual since the grammer listed there is
- * ambiguous and causes a shift/reduce conflict.
- * It also seems more logical as the "immediate"
- * argument is listed as the second arg like the
- * other formats.
- */
-
-f2_opcode:
- T_SHL { $$ = AIC_OP_SHL; }
-| T_SHR { $$ = AIC_OP_SHR; }
-| T_ROL { $$ = AIC_OP_ROL; }
-| T_ROR { $$ = AIC_OP_ROR; }
-;
-
-code:
- f2_opcode destination ',' expression opt_source ret ';'
- {
- format_2_instr($1, &$2, &$4, &$5, $6);
- }
-;
-
-jmp_jc_jnc_call:
- T_JMP { $$ = AIC_OP_JMP; }
-| T_JC { $$ = AIC_OP_JC; }
-| T_JNC { $$ = AIC_OP_JNC; }
-| T_CALL { $$ = AIC_OP_CALL; }
-;
-
-jz_jnz:
- T_JZ { $$ = AIC_OP_JZ; }
-| T_JNZ { $$ = AIC_OP_JNZ; }
-;
-
-je_jne:
- T_JE { $$ = AIC_OP_JE; }
-| T_JNE { $$ = AIC_OP_JNE; }
-;
-
-code:
- jmp_jc_jnc_call address ';'
- {
- expression_t immed;
-
- make_expression(&immed, 0);
- format_3_instr($1, &sindex, &immed, &$2);
- }
-;
-
-code:
- T_OR reg_symbol ',' immediate jmp_jc_jnc_call address ';'
- {
- format_3_instr($5, &$2, &$4, &$6);
- }
-;
-
-code:
- T_TEST source ',' immediate_or_a jz_jnz address ';'
- {
- format_3_instr($5, &$2, &$4, &$6);
- }
-;
-
-code:
- T_CMP source ',' immediate_or_a je_jne address ';'
- {
- format_3_instr($5, &$2, &$4, &$6);
- }
-;
-
-code:
- T_MOV source jmp_jc_jnc_call address ';'
- {
- expression_t immed;
-
- make_expression(&immed, 0);
- format_3_instr($3, &$2, &immed, &$4);
- }
-;
-
-code:
- T_MVI immediate jmp_jc_jnc_call address ';'
- {
- format_3_instr($3, &allzeros, &$2, &$4);
- }
-;
-
-%%
-
-static void
-process_bitmask(mask_type, sym, mask)
- int mask_type;
- symbol_t *sym;
- int mask;
-{
- /*
- * Add the current register to its
- * symbol list, if it already exists,
- * warn if we are setting it to a
- * different value, or in the bit to
- * the "allowed bits" of this register.
- */
- if (sym->type == UNINITIALIZED) {
- sym->type = mask_type;
- initialize_symbol(sym);
- if (mask_type == BIT) {
- if (mask == 0) {
- stop("Bitmask with no bits set", EX_DATAERR);
- /* NOTREACHED */
- }
- if ((mask & ~(0x01 << (ffs(mask) - 1))) != 0) {
- stop("Bitmask with more than one bit set",
- EX_DATAERR);
- /* NOTREACHED */
- }
- }
- sym->info.minfo->mask = mask;
- } else if (sym->type != mask_type) {
- stop("Bit definition mirrors a definition of the same "
- " name, but a different type", EX_DATAERR);
- /* NOTREACHED */
- } else if (mask != sym->info.minfo->mask) {
- stop("Bitmask redefined with a conflicting value", EX_DATAERR);
- /* NOTREACHED */
- }
- /* Fail if this symbol is already listed */
- if (symlist_search(&(sym->info.minfo->symrefs),
- cur_symbol->name) != NULL) {
- stop("Bitmask defined multiple times for register", EX_DATAERR);
- /* NOTREACHED */
- }
- symlist_add(&(sym->info.minfo->symrefs), cur_symbol,
- SYMLIST_INSERT_HEAD);
- cur_symbol->info.rinfo->valid_bitmask |= mask;
- cur_symbol->info.rinfo->typecheck_masks = TRUE;
-}
-
-static void
-initialize_symbol(symbol)
- symbol_t *symbol;
-{
- switch (symbol->type) {
- case UNINITIALIZED:
- stop("Call to initialize_symbol with type field unset",
- EX_SOFTWARE);
- /* NOTREACHED */
- break;
- case REGISTER:
- case SRAMLOC:
- case SCBLOC:
- symbol->info.rinfo =
- (struct reg_info *)malloc(sizeof(struct reg_info));
- if (symbol->info.rinfo == NULL) {
- stop("Can't create register info", EX_SOFTWARE);
- /* NOTREACHED */
- }
- memset(symbol->info.rinfo, 0,
- sizeof(struct reg_info));
- break;
- case ALIAS:
- symbol->info.ainfo =
- (struct alias_info *)malloc(sizeof(struct alias_info));
- if (symbol->info.ainfo == NULL) {
- stop("Can't create alias info", EX_SOFTWARE);
- /* NOTREACHED */
- }
- memset(symbol->info.ainfo, 0,
- sizeof(struct alias_info));
- break;
- case MASK:
- case BIT:
- symbol->info.minfo =
- (struct mask_info *)malloc(sizeof(struct mask_info));
- if (symbol->info.minfo == NULL) {
- stop("Can't create bitmask info", EX_SOFTWARE);
- /* NOTREACHED */
- }
- memset(symbol->info.minfo, 0, sizeof(struct mask_info));
- SLIST_INIT(&(symbol->info.minfo->symrefs));
- break;
- case CONST:
- symbol->info.cinfo =
- (struct const_info *)malloc(sizeof(struct const_info));
- if (symbol->info.cinfo == NULL) {
- stop("Can't create alias info", EX_SOFTWARE);
- /* NOTREACHED */
- }
- memset(symbol->info.cinfo, 0,
- sizeof(struct const_info));
- break;
- case LABEL:
- symbol->info.linfo =
- (struct label_info *)malloc(sizeof(struct label_info));
- if (symbol->info.linfo == NULL) {
- stop("Can't create label info", EX_SOFTWARE);
- /* NOTREACHED */
- }
- memset(symbol->info.linfo, 0,
- sizeof(struct label_info));
- break;
- case CONDITIONAL:
- symbol->info.condinfo =
- (struct cond_info *)malloc(sizeof(struct cond_info));
- if (symbol->info.condinfo == NULL) {
- stop("Can't create conditional info", EX_SOFTWARE);
- /* NOTREACHED */
- }
- memset(symbol->info.condinfo, 0,
- sizeof(struct cond_info));
- break;
- default:
- stop("Call to initialize_symbol with invalid symbol type",
- EX_SOFTWARE);
- /* NOTREACHED */
- break;
- }
-}
-
-static void
-process_register(p_symbol)
- symbol_t **p_symbol;
-{
- char buf[255];
- symbol_t *symbol = *p_symbol;
-
- if (symbol->type == UNINITIALIZED) {
- snprintf(buf, sizeof(buf), "Undefined register %s",
- symbol->name);
- stop(buf, EX_DATAERR);
- /* NOTREACHED */
- } else if (symbol->type == ALIAS) {
- *p_symbol = symbol->info.ainfo->parent;
- } else if ((symbol->type != REGISTER)
- && (symbol->type != SCBLOC)
- && (symbol->type != SRAMLOC)) {
- snprintf(buf, sizeof(buf),
- "Specified symbol %s is not a register",
- symbol->name);
- stop(buf, EX_DATAERR);
- }
-}
-
-static void
-format_1_instr(opcode, dest, immed, src, ret)
- int opcode;
- symbol_ref_t *dest;
- expression_t *immed;
- symbol_ref_t *src;
- int ret;
-{
- struct instruction *instr;
- struct ins_format1 *f1_instr;
-
- if (src->symbol == NULL)
- src = dest;
-
- /* Test register permissions */
- test_writable_symbol(dest->symbol);
- test_readable_symbol(src->symbol);
-
- /* Ensure that immediate makes sense for this destination */
- type_check(dest->symbol, immed, opcode);
-
- /* Allocate sequencer space for the instruction and fill it out */
- instr = seq_alloc();
- f1_instr = &instr->format.format1;
- f1_instr->opcode_ret = (opcode << 1) | (ret ? RETURN_BIT : 0);
- f1_instr->destination = dest->symbol->info.rinfo->address
- + dest->offset;
- f1_instr->source = src->symbol->info.rinfo->address
- + src->offset;
- f1_instr->immediate = immed->value;
- symlist_free(&immed->referenced_syms);
- instruction_ptr++;
-}
-
-static void
-format_2_instr(opcode, dest, places, src, ret)
- int opcode;
- symbol_ref_t *dest;
- expression_t *places;
- symbol_ref_t *src;
- int ret;
-{
- struct instruction *instr;
- struct ins_format2 *f2_instr;
- u_int8_t shift_control;
-
- if (src->symbol == NULL)
- src = dest;
-
- /* Test register permissions */
- test_writable_symbol(dest->symbol);
- test_readable_symbol(src->symbol);
-
- /* Allocate sequencer space for the instruction and fill it out */
- instr = seq_alloc();
- f2_instr = &instr->format.format2;
- f2_instr->opcode_ret = (AIC_OP_ROL << 1) | (ret ? RETURN_BIT : 0);
- f2_instr->destination = dest->symbol->info.rinfo->address
- + dest->offset;
- f2_instr->source = src->symbol->info.rinfo->address
- + src->offset;
- if (places->value > 8 || places->value <= 0) {
- stop("illegal shift value", EX_DATAERR);
- /* NOTREACHED */
- }
- switch (opcode) {
- case AIC_OP_SHL:
- if (places->value == 8)
- shift_control = 0xf0;
- else
- shift_control = (places->value << 4) | places->value;
- break;
- case AIC_OP_SHR:
- if (places->value == 8) {
- shift_control = 0xf8;
- } else {
- shift_control = (places->value << 4)
- | (8 - places->value)
- | 0x08;
- }
- break;
- case AIC_OP_ROL:
- shift_control = places->value & 0x7;
- break;
- case AIC_OP_ROR:
- shift_control = (8 - places->value) | 0x08;
- break;
- default:
- shift_control = 0; /* Quiet Compiler */
- stop("Invalid shift operation specified", EX_SOFTWARE);
- /* NOTREACHED */
- break;
- };
- f2_instr->shift_control = shift_control;
- symlist_free(&places->referenced_syms);
- instruction_ptr++;
-}
-
-static void
-format_3_instr(opcode, src, immed, address)
- int opcode;
- symbol_ref_t *src;
- expression_t *immed;
- symbol_ref_t *address;
-{
- struct instruction *instr;
- struct ins_format3 *f3_instr;
- int addr;
-
- /* Test register permissions */
- test_readable_symbol(src->symbol);
-
- /* Ensure that immediate makes sense for this source */
- type_check(src->symbol, immed, opcode);
-
- /* Allocate sequencer space for the instruction and fill it out */
- instr = seq_alloc();
- f3_instr = &instr->format.format3;
- if (address->symbol == NULL) {
- /* 'dot' referrence. Use the current instruction pointer */
- addr = instruction_ptr + address->offset;
- } else if (address->symbol->type == UNINITIALIZED) {
- /* forward reference */
- addr = address->offset;
- instr->patch_label = address->symbol;
- } else
- addr = address->symbol->info.linfo->address + address->offset;
- f3_instr->opcode_addr = (opcode << 1)
- | ((addr >> 8) & 0x01);
- f3_instr->address = addr & 0xff;
- f3_instr->source = src->symbol->info.rinfo->address
- + src->offset;
- f3_instr->immediate = immed->value;
- symlist_free(&immed->referenced_syms);
- instruction_ptr++;
-}
-
-static void
-test_readable_symbol(symbol)
- symbol_t *symbol;
-{
- if (symbol->info.rinfo->mode == WO) {
- stop("Write Only register specified as source",
- EX_DATAERR);
- /* NOTREACHED */
- }
-}
-
-static void
-test_writable_symbol(symbol)
- symbol_t *symbol;
-{
- if (symbol->info.rinfo->mode == RO) {
- stop("Read Only register specified as destination",
- EX_DATAERR);
- /* NOTREACHED */
- }
-}
-
-static void
-type_check(symbol, expression, opcode)
- symbol_t *symbol;
- expression_t *expression;
- int opcode;
-{
- symbol_node_t *node;
- int and_op;
- char buf[255];
-
- and_op = FALSE;
- if (opcode == AIC_OP_AND || opcode == AIC_OP_JNZ || AIC_OP_JZ)
- and_op = TRUE;
- /*
- * Make sure that we aren't attempting to write something
- * that hasn't been defined. If this is an and operation,
- * this is a mask, so "undefined" bits are okay.
- */
- if (and_op == FALSE
- && (expression->value & ~symbol->info.rinfo->valid_bitmask) != 0) {
- snprintf(buf, sizeof(buf),
- "Invalid bit(s) 0x%x in immediate written to %s",
- expression->value & ~symbol->info.rinfo->valid_bitmask,
- symbol->name);
- stop(buf, EX_DATAERR);
- /* NOTREACHED */
- }
-
- /*
- * Now make sure that all of the symbols referenced by the
- * expression are defined for this register.
- */
- if(symbol->info.rinfo->typecheck_masks != FALSE) {
- for(node = expression->referenced_syms.slh_first;
- node != NULL;
- node = node->links.sle_next) {
- if ((node->symbol->type == MASK
- || node->symbol->type == BIT)
- && symlist_search(&node->symbol->info.minfo->symrefs,
- symbol->name) == NULL) {
- snprintf(buf, sizeof(buf),
- "Invalid bit or mask %s "
- "for register %s",
- node->symbol->name, symbol->name);
- stop(buf, EX_DATAERR);
- /* NOTREACHED */
- }
- }
- }
-}
-
-static void
-make_expression(immed, value)
- expression_t *immed;
- int value;
-{
- SLIST_INIT(&immed->referenced_syms);
- immed->value = value & 0xff;
-}
-
-static void
-add_conditional(symbol)
- symbol_t *symbol;
-{
- static int numoptions = 1;
-
- if (symbol->type == UNINITIALIZED) {
- symbol->type = CONDITIONAL;
- initialize_symbol(symbol);
- symbol->info.condinfo->value = 0x01 << numoptions++;
- symlist_add(&patch_options, symbol, SYMLIST_INSERT_HEAD);
- } else if (symbol->type != CONDITIONAL) {
- stop("Conditional symbol mirrors other symbol",
- EX_DATAERR);
- /* NOTREACHED */
- }
- cur_patch->options |= symbol->info.condinfo->value;
-}
-
-void
-yyerror(string)
- const char *string;
-{
- stop(string, EX_DATAERR);
-}
diff --git a/sys/dev/aic7xxx/aicasm_scan.l b/sys/dev/aic7xxx/aicasm_scan.l
deleted file mode 100644
index 0caf46a8d7db..000000000000
--- a/sys/dev/aic7xxx/aicasm_scan.l
+++ /dev/null
@@ -1,243 +0,0 @@
-%{
-/*
- * Lexical Analyzer for the Aic7xxx SCSI Host adapter sequencer assembler.
- *
- * Copyright (c) 1997 Justin T. Gibbs.
- * 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 immediately at the beginning of the file, without modification,
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $Id: scan.l,v 1.1 1997/03/16 07:08:17 gibbs Exp $
- */
-
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <sysexits.h>
-#include <sys/queue.h>
-#include <sys/types.h>
-
-#include "aic7xxx_asm.h"
-#include "symbol.h"
-#include "y.tab.h"
-%}
-
-PATH [-/A-Za-z0-9_.]*[./][-/A-Za-z0-9_.]*
-WORD [A-Za-z_][-A-Za-z_0-9]*
-SPACE [ \t]+
-
-%x COMMENT
-
-%%
-\n { ++yylineno; }
-"/*" { BEGIN COMMENT; /* Enter comment eating state */ }
-<COMMENT>"/*" { fprintf(stderr, "Warning! Comment within comment."); }
-<COMMENT>\n { ++yylineno; }
-<COMMENT>[^*/\n]* ;
-<COMMENT>"*"+[^*/\n]* ;
-<COMMENT>"/"+[^*/\n]* ;
-<COMMENT>"*"+"/" { BEGIN INITIAL; }
-
-{SPACE} ;
-
- /* Register/SCB/SRAM definition keywords */
-register { return T_REGISTER; }
-const { yylval.value = FALSE; return T_CONST; }
-address { return T_ADDRESS; }
-access_mode { return T_ACCESS_MODE; }
-RW|RO|WO {
- if (strcmp(yytext, "RW") == 0)
- yylval.value = RW;
- else if (strcmp(yytext, "RO") == 0)
- yylval.value = RO;
- else
- yylval.value = WO;
- return T_MODE;
- }
-bit { return T_BIT; }
-mask { return T_MASK; }
-alias { return T_ALIAS; }
-size { return T_SIZE; }
-scb { return T_SCB; }
-scratch_ram { return T_SRAM; }
-accumulator { return T_ACCUM; }
-allones { return T_ALLONES; }
-allzeros { return T_ALLZEROS; }
-none { return T_NONE; }
-sindex { return T_SINDEX; }
-A { return T_A; }
-
- /* Opcodes */
-shl { return T_SHL; }
-shr { return T_SHR; }
-ror { return T_ROR; }
-rol { return T_ROL; }
-mvi { return T_MVI; }
-mov { return T_MOV; }
-clr { return T_CLR; }
-jmp { return T_JMP; }
-jc { return T_JC; }
-jnc { return T_JNC; }
-je { return T_JE; }
-jne { return T_JNE; }
-jz { return T_JZ; }
-jnz { return T_JNZ; }
-call { return T_CALL; }
-add { return T_ADD; }
-adc { return T_ADC; }
-inc { return T_INC; }
-dec { return T_DEC; }
-stc { return T_STC; }
-clc { return T_CLC; }
-cmp { return T_CMP; }
-xor { return T_XOR; }
-test { return T_TEST;}
-and { return T_AND; }
-or { return T_OR; }
-ret { return T_RET; }
-nop { return T_NOP; }
-.if { return T_IF; }
-.else { return T_ELSE; }
-.endif { return T_ENDIF; }
-
- /* Allowed Symbols */
-[-+,:()~|&."{};<>[\]!] { return yytext[0]; }
-
- /* Number processing */
-0[0-7]* {
- yylval.value = strtol(yytext, NULL, 8);
- return T_NUMBER;
- }
-
-0[xX][0-9a-fA-F]+ {
- yylval.value = strtoul(yytext + 2, NULL, 16);
- return T_NUMBER;
- }
-
-[1-9][0-9]* {
- yylval.value = strtol(yytext, NULL, 10);
- return T_NUMBER;
- }
-
- /* Include Files */
-#include { return T_INCLUDE; }
-
- /* For parsing C include files with #define foo */
-#define { yylval.value = TRUE; return T_CONST; }
- /* Throw away macros */
-#define[^\n]*[()]+[^\n]* ;
-{PATH} { yylval.str = strdup(yytext); return T_PATH; }
-
-{WORD} { yylval.sym = symtable_get(yytext); return T_SYMBOL; }
-
-. {
- char buf[255];
-
- snprintf(buf, sizeof(buf), "Invalid character "
- "'%c'", yytext[0]);
- stop(buf, EX_DATAERR);
- }
-%%
-
-typedef struct include {
- YY_BUFFER_STATE buffer;
- int lineno;
- char *filename;
- SLIST_ENTRY(include) links;
-}include_t;
-
-SLIST_HEAD(, include) include_stack;
-
-void
-include_file(file_name, type)
- char *file_name;
- include_type type;
-{
- FILE *newfile;
- include_t *include;
-
- newfile = NULL;
- /* Try the current directory first */
- if (includes_search_curdir != 0 || type == SOURCE_FILE)
- newfile = fopen(file_name, "r");
-
- if (newfile == NULL && type != SOURCE_FILE) {
- path_entry_t include_dir;
- for (include_dir = search_path.slh_first;
- include_dir != NULL;
- include_dir = include_dir->links.sle_next) {
- char fullname[PATH_MAX];
-
- if ((include_dir->quoted_includes_only == TRUE)
- && (type != QUOTED_INCLUDE))
- continue;
-
- snprintf(fullname, sizeof(fullname),
- "%s/%s", include_dir->directory, file_name);
-
- if ((newfile = fopen(fullname, "r")) != NULL)
- break;
- }
- }
-
- if (newfile == NULL) {
- perror(file_name);
- stop("Unable to open input file", EX_SOFTWARE);
- /* NOTREACHED */
- }
- include = (include_t *)malloc(sizeof(include_t));
- if (include == NULL) {
- stop("Unable to allocate include stack entry", EX_SOFTWARE);
- /* NOTREACHED */
- }
- include->buffer = YY_CURRENT_BUFFER;
- include->lineno = yylineno;
- include->filename = yyfilename;
- SLIST_INSERT_HEAD(&include_stack, include, links);
- yy_switch_to_buffer(yy_create_buffer(newfile, YY_BUF_SIZE));
- yylineno = 1;
- yyfilename = strdup(file_name);
-}
-
-int
-yywrap()
-{
- include_t *include;
-
- yy_delete_buffer(YY_CURRENT_BUFFER);
- (void)fclose(yyin);
- if (yyfilename != NULL)
- free(yyfilename);
- include = include_stack.slh_first;
- if (include != NULL) {
- yy_switch_to_buffer(include->buffer);
- yylineno = include->lineno;
- yyfilename = include->filename;
- SLIST_REMOVE_HEAD(&include_stack, links);
- free(include);
- return (0);
- }
- return (1);
-}
diff --git a/sys/dev/aic7xxx/aicasm_symbol.c b/sys/dev/aic7xxx/aicasm_symbol.c
deleted file mode 100644
index e2b93efbd2ee..000000000000
--- a/sys/dev/aic7xxx/aicasm_symbol.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * Aic7xxx SCSI host adapter firmware asssembler symbol table implementation
- *
- * Copyright (c) 1997 Justin T. Gibbs.
- * 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 immediately at the beginning of the file, without modification,
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $Id$
- */
-
-
-#include <sys/types.h>
-
-#include <db.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-
-#include "symbol.h"
-#include "aic7xxx_asm.h"
-
-static DB *symtable;
-
-symbol_t *
-symbol_create(name)
- char *name;
-{
- symbol_t *new_symbol;
-
- new_symbol = (symbol_t *)malloc(sizeof(symbol_t));
- if (new_symbol == NULL) {
- perror("Unable to create new symbol");
- exit(EX_SOFTWARE);
- }
- memset(new_symbol, 0, sizeof(*new_symbol));
- new_symbol->name = strdup(name);
- new_symbol->type = UNINITIALIZED;
- return (new_symbol);
-}
-
-void
-symbol_delete(symbol)
- symbol_t *symbol;
-{
- if (symtable != NULL) {
- DBT key;
-
- key.data = symbol->name;
- key.size = strlen(symbol->name);
- symtable->del(symtable, &key, /*flags*/0);
- }
- switch(symbol->type) {
- case SCBLOC:
- case SRAMLOC:
- case REGISTER:
- if (symbol->info.rinfo != NULL)
- free(symbol->info.rinfo);
- break;
- case ALIAS:
- if (symbol->info.ainfo != NULL)
- free(symbol->info.ainfo);
- break;
- case MASK:
- case BIT:
- if (symbol->info.minfo != NULL) {
- symlist_free(&symbol->info.minfo->symrefs);
- free(symbol->info.minfo);
- }
- break;
- case CONST:
- if (symbol->info.cinfo != NULL)
- free(symbol->info.cinfo);
- break;
- case LABEL:
- if (symbol->info.linfo != NULL)
- free(symbol->info.linfo);
- break;
- case UNINITIALIZED:
- default:
- break;
- }
- free(symbol->name);
- free(symbol);
-}
-
-void
-symtable_open()
-{
- symtable = dbopen(/*filename*/NULL,
- O_CREAT | O_NONBLOCK | O_RDWR, /*mode*/0, DB_HASH,
- /*openinfo*/NULL);
-
- if (symtable == NULL) {
- perror("Symbol table creation failed");
- exit(EX_SOFTWARE);
- /* NOTREACHED */
- }
-}
-
-void
-symtable_close()
-{
- if (symtable != NULL) {
- DBT key;
- DBT data;
-
- while (symtable->seq(symtable, &key, &data, R_FIRST) == 0) {
- symbol_t *cursym;
-
- cursym = *(symbol_t **)data.data;
- symbol_delete(cursym);
- }
- symtable->close(symtable);
- }
-}
-
-/*
- * The semantics of get is to return an uninitialized symbol entry
- * if a lookup fails.
- */
-symbol_t *
-symtable_get(name)
- char *name;
-{
- DBT key;
- DBT data;
- int retval;
-
- key.data = (void *)name;
- key.size = strlen(name);
-
- if ((retval = symtable->get(symtable, &key, &data, /*flags*/0)) != 0) {
- if (retval == -1) {
- perror("Symbol table get operation failed");
- exit(EX_SOFTWARE);
- /* NOTREACHED */
- } else if (retval == 1) {
- /* Symbol wasn't found, so create a new one */
- symbol_t *new_symbol;
-
- new_symbol = symbol_create(name);
- data.data = &new_symbol;
- data.size = sizeof(new_symbol);
- if (symtable->put(symtable, &key, &data,
- /*flags*/0) !=0) {
- perror("Symtable put failed");
- exit(EX_SOFTWARE);
- }
- return (new_symbol);
- } else {
- perror("Unexpected return value from db get routine");
- exit(EX_SOFTWARE);
- /* NOTREACHED */
- }
- }
- return (*(symbol_t **)data.data);
-}
-
-symbol_node_t *
-symlist_search(symlist, symname)
- symlist_t *symlist;
- char *symname;
-{
- symbol_node_t *curnode;
-
- curnode = symlist->slh_first;
- while(curnode != NULL) {
- if (strcmp(symname, curnode->symbol->name) == 0)
- break;
- curnode = curnode->links.sle_next;
- }
- return (curnode);
-}
-
-void
-symlist_add(symlist, symbol, how)
- symlist_t *symlist;
- symbol_t *symbol;
- int how;
-{
- symbol_node_t *newnode;
-
- newnode = (symbol_node_t *)malloc(sizeof(symbol_node_t));
- if (newnode == NULL) {
- stop("symlist_add: Unable to malloc symbol_node", EX_SOFTWARE);
- /* NOTREACHED */
- }
- newnode->symbol = symbol;
- if (how == SYMLIST_SORT) {
- symbol_node_t *curnode;
- int mask;
-
- mask = FALSE;
- switch(symbol->type) {
- case REGISTER:
- case SCBLOC:
- case SRAMLOC:
- break;
- case BIT:
- case MASK:
- mask = TRUE;
- break;
- default:
- stop("symlist_add: Invalid symbol type for sorting",
- EX_SOFTWARE);
- /* NOTREACHED */
- }
-
- curnode = symlist->slh_first;
- if (curnode == NULL
- || (mask && (curnode->symbol->info.minfo->mask >
- newnode->symbol->info.minfo->mask))
- || (!mask && (curnode->symbol->info.rinfo->address >
- newnode->symbol->info.rinfo->address))) {
- SLIST_INSERT_HEAD(symlist, newnode, links);
- return;
- }
-
- while (1) {
- if (curnode->links.sle_next == NULL) {
- SLIST_INSERT_AFTER(curnode, newnode,
- links);
- break;
- } else {
- symbol_t *cursymbol;
-
- cursymbol = curnode->links.sle_next->symbol;
- if ((mask && (cursymbol->info.minfo->mask >
- symbol->info.minfo->mask))
- || (!mask &&(cursymbol->info.rinfo->address >
- symbol->info.rinfo->address))){
- SLIST_INSERT_AFTER(curnode, newnode,
- links);
- break;
- }
- }
- curnode = curnode->links.sle_next;
- }
- } else {
- SLIST_INSERT_HEAD(symlist, newnode, links);
- }
-}
-
-void
-symlist_free(symlist)
- symlist_t *symlist;
-{
- symbol_node_t *node1, *node2;
-
- node1 = symlist->slh_first;
- while (node1 != NULL) {
- node2 = node1->links.sle_next;
- free(node1);
- node1 = node2;
- }
- SLIST_INIT(symlist);
-}
-
-void
-symlist_merge(symlist_dest, symlist_src1, symlist_src2)
- symlist_t *symlist_dest;
- symlist_t *symlist_src1;
- symlist_t *symlist_src2;
-{
- symbol_node_t *node;
-
- *symlist_dest = *symlist_src1;
- while((node = symlist_src2->slh_first) != NULL) {
- SLIST_REMOVE_HEAD(symlist_src2, links);
- SLIST_INSERT_HEAD(symlist_dest, node, links);
- }
-
- /* These are now empty */
- SLIST_INIT(symlist_src1);
- SLIST_INIT(symlist_src2);
-}
-
-void
-symtable_dump(ofile)
- FILE *ofile;
-{
- /*
- * Sort the registers by address with a simple insertion sort.
- * Put bitmasks next to the first register that defines them.
- * Put constants at the end.
- */
- symlist_t registers;
- symlist_t masks;
- symlist_t constants;
- symlist_t aliases;
-
- SLIST_INIT(&registers);
- SLIST_INIT(&masks);
- SLIST_INIT(&constants);
- SLIST_INIT(&aliases);
-
- if (symtable != NULL) {
- DBT key;
- DBT data;
- int flag = R_FIRST;
-
- while (symtable->seq(symtable, &key, &data, flag) == 0) {
- symbol_t *cursym;
-
- cursym = *(symbol_t **)data.data;
- switch(cursym->type) {
- case REGISTER:
- case SCBLOC:
- case SRAMLOC:
- symlist_add(&registers, cursym, SYMLIST_SORT);
- break;
- case MASK:
- case BIT:
- symlist_add(&masks, cursym, SYMLIST_SORT);
- break;
- case CONST:
- if (cursym->info.cinfo->define == FALSE) {
- symlist_add(&constants, cursym,
- SYMLIST_INSERT_HEAD);
- }
- break;
- case ALIAS:
- symlist_add(&aliases, cursym,
- SYMLIST_INSERT_HEAD);
- default:
- break;
- }
- flag = R_NEXT;
- }
-
- /* Put in the masks and bits */
- while (masks.slh_first != NULL) {
- symbol_node_t *curnode;
- symbol_node_t *regnode;
- char *regname;
-
- curnode = masks.slh_first;
- SLIST_REMOVE_HEAD(&masks, links);
-
- regnode =
- curnode->symbol->info.minfo->symrefs.slh_first;
- regname = regnode->symbol->name;
- regnode = symlist_search(&registers, regname);
- SLIST_INSERT_AFTER(regnode, curnode, links);
- }
-
- /* Add the aliases */
- while (aliases.slh_first != NULL) {
- symbol_node_t *curnode;
- symbol_node_t *regnode;
- char *regname;
-
- curnode = aliases.slh_first;
- SLIST_REMOVE_HEAD(&aliases, links);
-
- regname = curnode->symbol->info.ainfo->parent->name;
- regnode = symlist_search(&registers, regname);
- SLIST_INSERT_AFTER(regnode, curnode, links);
- }
-
- /* Output what we have */
- fprintf(ofile,
-"/*
- * DO NOT EDIT - This file is automatically generated.
- */\n");
- while (registers.slh_first != NULL) {
- symbol_node_t *curnode;
- u_int8_t value;
- char *tab_str;
- char *tab_str2;
-
- curnode = registers.slh_first;
- SLIST_REMOVE_HEAD(&registers, links);
- switch(curnode->symbol->type) {
- case REGISTER:
- case SCBLOC:
- case SRAMLOC:
- fprintf(ofile, "\n");
- value = curnode->symbol->info.rinfo->address;
- tab_str = "\t";
- tab_str2 = "\t\t";
- break;
- case ALIAS:
- {
- symbol_t *parent;
-
- parent = curnode->symbol->info.ainfo->parent;
- value = parent->info.rinfo->address;
- tab_str = "\t";
- tab_str2 = "\t\t";
- break;
- }
- case MASK:
- case BIT:
- value = curnode->symbol->info.minfo->mask;
- tab_str = "\t\t";
- tab_str2 = "\t";
- break;
- default:
- value = 0; /* Quiet compiler */
- tab_str = NULL;
- tab_str2 = NULL;
- stop("symtable_dump: Invalid symbol type "
- "encountered", EX_SOFTWARE);
- break;
- }
- fprintf(ofile, "#define%s%-16s%s0x%02x\n",
- tab_str, curnode->symbol->name, tab_str2,
- value);
- free(curnode);
- }
- fprintf(ofile, "\n\n");
-
- while (constants.slh_first != NULL) {
- symbol_node_t *curnode;
-
- curnode = constants.slh_first;
- SLIST_REMOVE_HEAD(&constants, links);
- fprintf(ofile, "#define\t%-8s\t0x%02x\n",
- curnode->symbol->name,
- curnode->symbol->info.cinfo->value);
- free(curnode);
- }
- }
-}
-
diff --git a/sys/dev/aic7xxx/aicasm_symbol.h b/sys/dev/aic7xxx/aicasm_symbol.h
deleted file mode 100644
index cf8fa0071225..000000000000
--- a/sys/dev/aic7xxx/aicasm_symbol.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Aic7xxx SCSI host adapter firmware asssembler symbol table definitions
- *
- * Copyright (c) 1997 Justin T. Gibbs.
- * 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 immediately at the beginning of the file, without modification,
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $Id$
- */
-
-#include <sys/queue.h>
-
-typedef enum {
- UNINITIALIZED,
- REGISTER,
- ALIAS,
- SCBLOC,
- SRAMLOC,
- MASK,
- BIT,
- CONST,
- LABEL,
- CONDITIONAL
-}symtype;
-
-typedef enum {
- RO = 0x01,
- WO = 0x02,
- RW = 0x03
-}amode_t;
-
-struct reg_info {
- u_int8_t address;
- int size;
- amode_t mode;
- u_int8_t valid_bitmask;
- int typecheck_masks;
-};
-
-typedef SLIST_HEAD(symlist, symbol_node) symlist_t;
-
-struct mask_info {
- symlist_t symrefs;
- u_int8_t mask;
-};
-
-struct const_info {
- u_int8_t value;
- int define;
-};
-
-struct alias_info {
- struct symbol *parent;
-};
-
-struct label_info {
- int address;
-};
-
-struct cond_info {
- int value;
-};
-
-typedef struct expression_info {
- symlist_t referenced_syms;
- int value;
-} expression_t;
-
-typedef struct symbol {
- char *name;
- symtype type;
- union {
- struct reg_info *rinfo;
- struct mask_info *minfo;
- struct const_info *cinfo;
- struct alias_info *ainfo;
- struct label_info *linfo;
- struct cond_info *condinfo;
- }info;
-} symbol_t;
-
-typedef struct symbol_ref {
- symbol_t *symbol;
- int offset;
-} symbol_ref_t;
-
-typedef struct symbol_node {
- SLIST_ENTRY(symbol_node) links;
- symbol_t *symbol;
-}symbol_node_t;
-
-typedef struct patch {
- STAILQ_ENTRY(patch) links;
- int negative;
- int begin;
- int end;
- int options;
-} patch_t;
-
-void symbol_delete __P((symbol_t *symbol));
-
-void symtable_open __P((void));
-
-void symtable_close __P((void));
-
-symbol_t *
- symtable_get __P((char *name));
-
-symbol_node_t *
- symlist_search __P((symlist_t *symlist, char *symname));
-
-void
- symlist_add __P((symlist_t *symlist, symbol_t *symbol, int how));
-#define SYMLIST_INSERT_HEAD 0x00
-#define SYMLIST_SORT 0x01
-
-void symlist_free __P((symlist_t *symlist));
-
-void symlist_merge __P((symlist_t *symlist_dest, symlist_t *symlist_src1,
- symlist_t *symlist_src2));
-void symtable_dump __P((FILE *ofile));
diff --git a/sys/i386/include/asm.h b/sys/i386/include/asm.h
deleted file mode 100644
index d700579696a4..000000000000
--- a/sys/i386/include/asm.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- *
- * from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90
- * $Id: asm.h,v 1.1 1997/03/09 10:39:15 bde Exp $
- */
-
-#include <sys/cdefs.h>
-
-#ifdef PIC
-#define PIC_PROLOGUE \
- pushl %ebx; \
- call 1f; \
-1: \
- popl %ebx; \
- addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
-#define PIC_EPILOGUE \
- popl %ebx
-#define PIC_PLT(x) x@PLT
-#define PIC_GOT(x) x@GOT(%ebx)
-#define PIC_GOTOFF(x) x@GOTOFF(%ebx)
-#else
-#define PIC_PROLOGUE
-#define PIC_EPILOGUE
-#define PIC_PLT(x) x
-#define PIC_GOT(x) x
-#define PIC_GOTOFF(x) x
-#endif
-
-/*
- * CNAME and HIDENAME manage the relationship between symbol names in C
- * and the equivalent assembly language names. CNAME is given a name as
- * it would be used in a C program. It expands to the equivalent assembly
- * language name. HIDENAME is given an assembly-language name, and expands
- * to a possibly-modified form that will be invisible to C programs.
- */
-#if defined(__ELF__) /* { */
-#define CNAME(csym) csym
-#define HIDENAME(asmsym) __CONCAT(.,asmsym)
-#else /* } { */
-#define CNAME(csym) __CONCAT(_,csym)
-#define HIDENAME(asmsym) asmsym
-#endif /* } */
-
-
-/* XXX should use align 4,0x90 for -m486. */
-#define _START_ENTRY .text; .align 2,0x90;
-#if 0
-/* Data is not used, except perhaps by non-g prof, which we don't support. */
-#define _MID_ENTRY .data; .align 2; 8:; .long 0; \
- .text; lea 8b,%eax;
-#else
-#define _MID_ENTRY
-#endif
-
-#ifdef PROF
-
-#define ALTENTRY(x) _START_ENTRY \
- .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \
- _MID_ENTRY \
- call HIDENAME(mcount); jmp 9f
-
-#define ENTRY(x) _START_ENTRY \
- .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \
- _MID_ENTRY \
- call HIDENAME(mcount); 9:
-
-
-#define ALTASENTRY(x) _START_ENTRY \
- .globl x; .type x,@function; x:; \
- _MID_ENTRY \
- call HIDENAME(mcount); jmp 9f
-
-#define ASENTRY(x) _START_ENTRY \
- .globl x; .type x,@function; x:; \
- _MID_ENTRY \
- call HIDENAME(mcount); 9:
-
-#else /* !PROF */
-
-#define ENTRY(x) _START_ENTRY .globl CNAME(x); .type CNAME(x),@function; \
- CNAME(x):
-#define ALTENTRY(x) ENTRY(x)
-
-#define ASENTRY(x) _START_ENTRY .globl x; .type x,@function; x:
-#define ALTASENTRY(x) ASENTRY(x)
-
-#endif
-
-/*
- * This header is currently only used in lib/msun/i387.
- * Use it to generate code to select between the generic math functions
- * and the i387 ones.
- */
-#undef ENTRY
-#define ANAME(x) CNAME(__CONCAT(__i387_,x))
-#define ASELNAME(x) CNAME(__CONCAT(__arch_select_,x))
-#define AVECNAME(x) CNAME(__CONCAT(__arch_,x))
-#define GNAME(x) CNAME(__CONCAT(__generic_,x))
-
-/* Don't bother profiling this. */
-#ifdef PIC
-#define ARCH_DISPATCH(x) \
- _START_ENTRY; \
- .globl CNAME(x); .type CNAME(x),@function; CNAME(x): ; \
- PIC_PROLOGUE; \
- movl PIC_GOT(AVECNAME(x)),%eax; \
- PIC_EPILOGUE; \
- jmpl *(%eax)
-
-#define ARCH_SELECT(x) _START_ENTRY; \
- .type ASELNAME(x),@function; \
- ASELNAME(x): \
- PIC_PROLOGUE; \
- call PIC_PLT(CNAME(__get_hw_float)); \
- testl %eax,%eax; \
- movl PIC_GOT(ANAME(x)),%eax; \
- jne 8f; \
- movl PIC_GOT(GNAME(x)),%eax; \
- 8: \
- movl PIC_GOT(AVECNAME(x)),%edx; \
- movl %eax,(%edx); \
- PIC_EPILOGUE; \
- jmpl *%eax
-#else /* !PIC */
-#define ARCH_DISPATCH(x) \
- _START_ENTRY; \
- .globl CNAME(x); .type CNAME(x),@function; CNAME(x): ; \
- jmpl *AVECNAME(x)
-
-#define ARCH_SELECT(x) _START_ENTRY; \
- .type ASELNAME(x),@function; \
- ASELNAME(x): \
- call CNAME(__get_hw_float); \
- testl %eax,%eax; \
- movl $ANAME(x),%eax; \
- jne 8f; \
- movl $GNAME(x),%eax; \
- 8: \
- movl %eax,AVECNAME(x); \
- jmpl *%eax
-#endif /* PIC */
-
-#define ARCH_VECTOR(x) .data; .align 2; \
- .globl AVECNAME(x); \
- .type AVECNAME(x),@object; \
- .size AVECNAME(x),4; \
- AVECNAME(x): .long ASELNAME(x)
-
-#ifdef PROF
-
-#define ALTENTRY(x) ENTRY(x); jmp 9f
-#define ENTRY(x) ARCH_VECTOR(x); ARCH_SELECT(x); ARCH_DISPATCH(x); \
- _START_ENTRY; \
- .globl ANAME(x); .type ANAME(x),@function; ANAME(x):; \
- call HIDENAME(mcount); 9:
-
-#else /* !PROF */
-
-#define ALTENTRY(x) ENTRY(x)
-#define ENTRY(x) ARCH_VECTOR(x); ARCH_SELECT(x); ARCH_DISPATCH(x); \
- _START_ENTRY; \
- .globl ANAME(x); .type ANAME(x),@function; ANAME(x):
-
-#endif /* PROF */
-
-#ifndef RCSID
-#define RCSID(a)
-#endif
diff --git a/sys/net/if_media.c b/sys/net/if_media.c
deleted file mode 100644
index 297176d29016..000000000000
--- a/sys/net/if_media.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/* $NetBSD: if_media.c,v 1.1 1997/03/17 02:55:15 thorpej Exp $ */
-/* $Id$ */
-
-/*
- * Copyright (c) 1997
- * Jonathan Stone and Jason R. Thorpe. All rights reserved.
- *
- * This software is derived from information provided by Matt Thomas.
- *
- * 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 Jonathan Stone
- * and Jason R. Thorpe for the NetBSD Project.
- * 4. The names of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHOR 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.
- */
-
-/*
- * BSD/OS-compatible network interface media selection.
- *
- * Where it is safe to do so, this code strays slightly from the BSD/OS
- * design. Software which uses the API (device drivers, basically)
- * shouldn't notice any difference.
- *
- * Many thanks to Matt Thomas for providing the information necessary
- * to implement this interface.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#include <sys/socket.h>
-#include <sys/sockio.h>
-#include <sys/malloc.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-#include <net/netisr.h>
-
-/*
- * Compile-time options:
- * IFMEDIA_DEBUG:
- * turn on implementation-level debug printfs.
- * Useful for debugging newly-ported drivers.
- */
-
-struct ifmedia_entry *ifmedia_match __P((struct ifmedia *ifm,
- int flags, int mask));
-
-#ifdef IFMEDIA_DEBUG
-int ifmedia_debug = 0;
-static void ifmedia_printword __P((int));
-#endif
-
-/*
- * Initialize if_media struct for a specific interface instance.
- */
-void
-ifmedia_init(ifm, dontcare_mask, change_callback, status_callback)
- struct ifmedia *ifm;
- int dontcare_mask;
- ifm_change_cb_t change_callback;
- ifm_stat_cb_t status_callback;
-{
-
- LIST_INIT(&ifm->ifm_list);
- ifm->ifm_cur = NULL;
- ifm->ifm_media = 0;
- ifm->ifm_mask = dontcare_mask; /* IF don't-care bits */
- ifm->ifm_change = change_callback;
- ifm->ifm_status = status_callback;
-}
-
-/*
- * Add a media configuration to the list of supported media
- * for a specific interface instance.
- */
-void
-ifmedia_add(ifm, mword, data, aux)
- struct ifmedia *ifm;
- int mword;
- int data;
- void *aux;
-{
- register struct ifmedia_entry *entry;
-
-#ifdef IFMEDIA_DEBUG
- if (ifmedia_debug) {
- if (ifm == NULL) {
- printf("ifmedia_add: null ifm\n");
- return;
- }
- printf("Adding entry for ");
- ifmedia_printword(mword);
- }
-#endif
-
- entry = malloc(sizeof(*entry), M_IFADDR, M_NOWAIT);
- if (entry == NULL)
- panic("ifmedia_add: can't malloc entry");
-
- entry->ifm_media = mword;
- entry->ifm_data = data;
- entry->ifm_aux = aux;
-
- LIST_INSERT_HEAD(&ifm->ifm_list, entry, ifm_list);
-}
-
-/*
- * Add an array of media configurations to the list of
- * supported media for a specific interface instance.
- */
-void
-ifmedia_list_add(ifm, lp, count)
- struct ifmedia *ifm;
- struct ifmedia_entry *lp;
- int count;
-{
- int i;
-
- for (i = 0; i < count; i++)
- ifmedia_add(ifm, lp[i].ifm_media, lp[i].ifm_data,
- lp[i].ifm_aux);
-}
-
-/*
- * Set the default active media.
- *
- * Called by device-specific code which is assumed to have already
- * selected the default media in hardware. We do _not_ call the
- * media-change callback.
- */
-void
-ifmedia_set(ifm, target)
- struct ifmedia *ifm;
- int target;
-
-{
- struct ifmedia_entry *match;
-
- match = ifmedia_match(ifm, target, ifm->ifm_mask);
-
- if (match == NULL) {
- printf("ifmedia_set: no match for 0x%x/0x%x\n",
- target, ~ifm->ifm_mask);
- panic("ifmedia_set");
- }
- ifm->ifm_cur = match;
-
-#ifdef IFMEDIA_DEBUG
- if (ifmedia_debug) {
- printf("ifmedia_set: target ");
- ifmedia_printword(target);
- printf("ifmedia_set: setting to ");
- ifmedia_printword(ifm->ifm_cur->ifm_media);
- }
-#endif
-}
-
-/*
- * Device-independent media ioctl support function.
- */
-int
-ifmedia_ioctl(ifp, ifr, ifm, cmd)
- struct ifnet *ifp;
- struct ifreq *ifr;
- struct ifmedia *ifm;
- u_long cmd;
-{
- struct ifmedia_entry *match;
- struct ifmediareq *ifmr = (struct ifmediareq *) ifr;
- int error = 0, sticky;
-
- if (ifp == NULL || ifr == NULL || ifm == NULL)
- return(EINVAL);
-
- switch (cmd) {
-
- /*
- * Set the current media.
- */
- case SIOCSIFMEDIA:
- {
- struct ifmedia_entry *oldentry;
- int oldmedia;
- int newmedia = ifr->ifr_media;
-
- match = ifmedia_match(ifm, newmedia, ifm->ifm_mask);
- if (match == NULL) {
-#ifdef IFMEDIA_DEBUG
- if (ifmedia_debug) {
- printf(
- "ifmedia_ioctl: no media found for 0x%x\n",
- newmedia);
- }
-#endif
- return (ENXIO);
- }
-
- /*
- * If no change, we're done.
- * XXX Automedia may invole software intervention.
- * Keep going in case the the connected media changed.
- * Similarly, if best match changed (kernel debugger?).
- */
- if ((IFM_SUBTYPE(newmedia) != IFM_AUTO) &&
- (newmedia == ifm->ifm_media) &&
- (match == ifm->ifm_cur))
- return 0;
-
- /*
- * We found a match, now make the driver switch to it.
- * Make sure to preserve our old media type in case the
- * driver can't switch.
- */
-#ifdef IFMEDIA_DEBUG
- if (ifmedia_debug) {
- printf("ifmedia_ioctl: switching %s to ",
- ifp->if_xname);
- ifmedia_printword(match->ifm_media);
- }
-#endif
- oldentry = ifm->ifm_cur;
- oldmedia = ifm->ifm_media;
- ifm->ifm_cur = match;
- ifm->ifm_media = newmedia;
- error = (*ifm->ifm_change)(ifp);
- if (error) {
- ifm->ifm_cur = oldentry;
- ifm->ifm_media = oldmedia;
- }
- break;
- }
-
- /*
- * Get list of available media and current media on interface.
- */
- case SIOCGIFMEDIA:
- {
- struct ifmedia_entry *ep;
- int *kptr, count;
-
- kptr = NULL; /* XXX gcc */
-
- ifmr->ifm_active = ifmr->ifm_current = ifm->ifm_cur ?
- ifm->ifm_cur->ifm_media : IFM_NONE;
- ifmr->ifm_mask = ifm->ifm_mask;
- ifmr->ifm_status = 0;
- (*ifm->ifm_status)(ifp, ifmr);
-
- count = 0;
- ep = ifm->ifm_list.lh_first;
-
- if (ifmr->ifm_count != 0) {
- kptr = (int *)malloc(ifmr->ifm_count * sizeof(int),
- M_TEMP, M_WAITOK);
-
- /*
- * Get the media words from the interface's list.
- */
- for (; ep != NULL && count < ifmr->ifm_count;
- ep = ep->ifm_list.le_next, count++)
- kptr[count] = ep->ifm_media;
-
- if (ep != NULL)
- error = E2BIG; /* oops! */
- }
-
- /*
- * If there are more interfaces on the list, count
- * them. This allows the caller to set ifmr->ifm_count
- * to 0 on the first call to know how much space to
- * callocate.
- */
- for (; ep != NULL; ep = ep->ifm_list.le_next)
- count++;
-
- /*
- * We do the copyout on E2BIG, because that's
- * just our way of telling userland that there
- * are more. This is the behavior I've observed
- * under BSD/OS 3.0
- */
- sticky = error;
- if ((error == 0 || error == E2BIG) && ifmr->ifm_count != 0) {
- error = copyout((caddr_t)kptr,
- (caddr_t)ifmr->ifm_ulist,
- ifmr->ifm_count * sizeof(int));
- }
-
- if (error == 0)
- error = sticky;
-
- if (ifmr->ifm_count != 0)
- free(kptr, M_TEMP);
-
- ifmr->ifm_count = count;
- break;
- }
-
- default:
- return (EINVAL);
- }
-
- return (error);
-}
-
-/*
- * Find media entry matching a given ifm word.
- *
- */
-struct ifmedia_entry *
-ifmedia_match(ifm, target, mask)
- struct ifmedia *ifm;
- int target;
- int mask;
-{
- struct ifmedia_entry *match, *next;
-
- match = NULL;
- mask = ~mask;
-
- for (next = ifm->ifm_list.lh_first; next != NULL;
- next = next->ifm_list.le_next) {
- if ((next->ifm_media & mask) == (target & mask)) {
-#if defined(IFMEDIA_DEBUG) || defined(DIAGNOSTIC)
- if (match) {
- printf("ifmedia_match: multiple match for "
- "0x%x/0x%x\n", target, mask);
- }
-#endif
- match = next;
- }
- }
-
- return match;
-}
-
-#ifdef IFMEDIA_DEBUG
-struct ifmedia_description ifm_type_descriptions[] =
- IFM_TYPE_DESCRIPTIONS;
-
-struct ifmedia_description ifm_subtype_ethernet_descriptions[] =
- IFM_SUBTYPE_ETHERNET_DESCRIPTIONS;
-
-struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] =
- IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS;
-
-struct ifmedia_description ifm_subtype_tokenring_descriptions[] =
- IFM_SUBTYPE_TOKENRING_DESCRIPTIONS;
-
-struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
- IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
-
-struct ifmedia_description ifm_subtype_fddi_descriptions[] =
- IFM_SUBTYPE_FDDI_DESCRIPTIONS;
-
-struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
- IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
-
-struct ifmedia_description ifm_subtype_shared_descriptions[] =
- IFM_SUBTYPE_SHARED_DESCRIPTIONS;
-
-struct ifmedia_description ifm_shared_option_descriptions[] =
- IFM_SHARED_OPTION_DESCRIPTIONS;
-
-struct ifmedia_type_to_subtype {
- struct ifmedia_description *subtypes;
- struct ifmedia_description *options;
-};
-
-/* must be in the same order as IFM_TYPE_DESCRIPTIONS */
-struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
- {
- &ifm_subtype_ethernet_descriptions[0],
- &ifm_subtype_ethernet_option_descriptions[0]
- },
- {
- &ifm_subtype_tokenring_descriptions[0],
- &ifm_subtype_tokenring_option_descriptions[0]
- },
- {
- &ifm_subtype_fddi_descriptions[0],
- &ifm_subtype_fddi_option_descriptions[0]
- },
-};
-
-/*
- * print a media word.
- */
-static void
-ifmedia_printword(ifmw)
- int ifmw;
-{
- struct ifmedia_description *desc;
- struct ifmedia_type_to_subtype *ttos;
- int seen_option = 0;
-
- /* Find the top-level interface type. */
- for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
- desc->ifmt_string != NULL; desc++, ttos++)
- if (IFM_TYPE(ifmw) == desc->ifmt_word)
- break;
- if (desc->ifmt_string == NULL) {
- printf("<unknown type>\n");
- return;
- }
- printf(desc->ifmt_string);
-
- /*
- * Check for the shared subtype descriptions first, then the
- * type-specific ones.
- */
- for (desc = ifm_subtype_shared_descriptions;
- desc->ifmt_string != NULL; desc++)
- if (IFM_SUBTYPE(ifmw) == desc->ifmt_word)
- goto got_subtype;
-
- for (desc = ttos->subtypes; desc->ifmt_string != NULL; desc++)
- if (IFM_SUBTYPE(ifmw) == desc->ifmt_word)
- break;
- if (desc->ifmt_string == NULL) {
- printf(" <unknown subtype>\n");
- return;
- }
-
- got_subtype:
- printf(" %s", desc->ifmt_string);
-
- /*
- * Look for shared options.
- */
- for (desc = ifm_shared_option_descriptions;
- desc->ifmt_string != NULL; desc++) {
- if (ifmw & desc->ifmt_word) {
- if (seen_option == 0)
- printf(" <");
- printf("%s%s", seen_option++ ? "," : "",
- desc->ifmt_string);
- }
- }
-
- /*
- * Look for subtype-specific options.
- */
- for (desc = ttos->options; desc->ifmt_string != NULL; desc++) {
- if (ifmw & desc->ifmt_word) {
- if (seen_option == 0)
- printf(" <");
- printf("%s%s", seen_option++ ? "," : "",
- desc->ifmt_string);
- }
- }
- printf("%s\n", seen_option ? ">" : "");
-}
-#endif /* IFMEDIA_DEBUG */
diff --git a/sys/net/if_media.h b/sys/net/if_media.h
deleted file mode 100644
index b79194ff8192..000000000000
--- a/sys/net/if_media.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */
-/* $Id$ */
-
-/*
- * Copyright (c) 1997
- * Jonathan Stone and Jason R. Thorpe. All rights reserved.
- *
- * This software is derived from information provided by Matt Thomas.
- *
- * 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 Jonathan Stone
- * and Jason R. Thorpe for the NetBSD Project.
- * 4. The names of the authors may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHOR 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.
- */
-
-#ifndef _NET_IF_MEDIA_H_
-#define _NET_IF_MEDIA_H_
-
-/*
- * Prototypes and definitions for BSD/OS-compatible network interface
- * media selection.
- *
- * Where it is safe to do so, this code strays slightly from the BSD/OS
- * design. Software which uses the API (device drivers, basically)
- * shouldn't notice any difference.
- *
- * Many thanks to Matt Thomas for providing the information necessary
- * to implement this interface.
- */
-
-#ifdef KERNEL
-
-#include <sys/queue.h>
-
-/*
- * Driver callbacks for media status and change requests.
- */
-typedef int (*ifm_change_cb_t) __P((struct ifnet *ifp));
-typedef void (*ifm_stat_cb_t) __P((struct ifnet *ifp, struct ifmediareq *req));
-
-/*
- * In-kernel representation of a single supported media type.
- */
-struct ifmedia_entry {
- LIST_ENTRY(ifmedia_entry) ifm_list;
- int ifm_media; /* description of this media attachment */
- int ifm_data; /* for driver-specific use */
- void *ifm_aux; /* for driver-specific use */
-};
-
-/*
- * One of these goes into a network interface's softc structure.
- * It is used to keep general media state.
- */
-struct ifmedia {
- int ifm_mask; /* mask of changes we don't care about */
- int ifm_media; /* current user-set media word */
- struct ifmedia_entry *ifm_cur; /* currently selected media */
- LIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */
- ifm_change_cb_t ifm_change; /* media change driver callback */
- ifm_stat_cb_t ifm_status; /* media status driver callback */
-};
-
-/* Initialize an interface's struct if_media field. */
-void ifmedia_init __P((struct ifmedia *ifm, int dontcare_mask,
- ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback));
-
-/* Add one supported medium to a struct ifmedia. */
-void ifmedia_add __P((struct ifmedia *ifm, int mword, int data, void *aux));
-
-/* Add an array (of ifmedia_entry) media to a struct ifmedia. */
-void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp,
- int count);
-
-/* Set default media type on initialization. */
-void ifmedia_set __P((struct ifmedia *ifm, int mword));
-
-/* Common ioctl function for getting/setting media, called by driver. */
-int ifmedia_ioctl __P((struct ifnet *ifp, struct ifreq *ifr,
- struct ifmedia *ifm, u_long cmd));
-
-#endif /*KERNEL */
-
-/*
- * if_media Options word:
- * Bits Use
- * ---- -------
- * 0-3 Media variant
- * 4 RFU
- * 5-7 Media type
- * 8-15 Type specific options
- * 16-19 RFU
- * 20-27 Shared (global) options
- * 28-31 Instance
- */
-
-/*
- * Ethernet
- */
-#define IFM_ETHER 0x00000020
-#define IFM_10_T 3 /* 10BaseT - RJ45 */
-#define IFM_10_2 4 /* 10Base2 - Thinnet */
-#define IFM_10_5 5 /* 10Base5 - AUI */
-#define IFM_100_TX 6 /* 100BaseTX - RJ45 */
-#define IFM_100_FX 7 /* 100BaseFX - Fiber */
-#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */
-#define IFM_100_VG 9 /* 100VG-AnyLAN */
-#define IFM_100_T2 10 /* 100BaseT2 */
-
-/*
- * Token ring
- */
-#define IFM_TOKEN 0x00000040
-#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */
-#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */
-#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */
-#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */
-#define IFM_TOK_ETR 0x00000200 /* Early token release */
-#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */
-#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */
-
-/*
- * FDDI
- */
-#define IFM_FDDI 0x00000060
-#define IFM_FDDI_SMF 3 /* Single-mode fiber */
-#define IFM_FDDI_MMF 4 /* Multi-mode fiber */
-#define IFM_FDDI_UTP 5 /* CDDI / UTP */
-#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */
-
-/*
- * Shared media sub-types
- */
-#define IFM_AUTO 0 /* Autoselect best media */
-#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */
-#define IFM_NONE 2 /* Deselect all media */
-
-/*
- * Shared options
- */
-#define IFM_FDX 0x00100000 /* Force full duplex */
-#define IFM_HDX 0x00200000 /* Force half duplex */
-#define IFM_FLAG0 0x01000000 /* Driver defined flag */
-#define IFM_FLAG1 0x02000000 /* Driver defined flag */
-#define IFM_FLAG2 0x04000000 /* Driver defined flag */
-#define IFM_LOOP 0x08000000 /* Put hardware in loopback */
-
-/*
- * Masks
- */
-#define IFM_NMASK 0x000000e0 /* Network type */
-#define IFM_TMASK 0x0000000f /* Media sub-type */
-#define IFM_IMASK 0xf0000000 /* Instance */
-#define IFM_ISHIFT 28 /* Instance shift */
-#define IFM_OMASK 0x0000ff00 /* Type specific options */
-#define IFM_GMASK 0x0ff00000 /* Global options */
-
-/*
- * Status bits
- */
-#define IFM_AVALID 0x00000001 /* Active bit valid */
-#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
-
-/*
- * Macros to extract various bits of information from the media word.
- */
-#define IFM_TYPE(x) ((x) & IFM_NMASK)
-#define IFM_SUBTYPE(x) ((x) & IFM_TMASK)
-#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
-
-/*
- * NetBSD extension not defined in the BSDI API. This is used in various
- * places to get the canonical description for a given type/subtype.
- *
- * NOTE: all but the top-level type descriptions must contain NO whitespace!
- * Otherwise, parsing these in ifconfig(8) would be a nightmare.
- */
-struct ifmedia_description {
- int ifmt_word; /* word value; may be masked */
- const char *ifmt_string; /* description */
-};
-
-#define IFM_TYPE_DESCRIPTIONS { \
- { IFM_ETHER, "Ethernet" }, \
- { IFM_TOKEN, "Token ring" }, \
- { IFM_FDDI, "FDDI" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \
- { IFM_10_T, "10baseT/UTP" }, \
- { IFM_10_2, "10base2/BNC" }, \
- { IFM_10_5, "10base5/AUI" }, \
- { IFM_100_TX, "100baseTX" }, \
- { IFM_100_FX, "100baseFX" }, \
- { IFM_100_T4, "100baseT4" }, \
- { IFM_100_VG, "100baseVG" }, \
- { IFM_100_T2, "100baseT2" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_ETHERNET_ALIASES { \
- { IFM_10_T, "UTP" }, \
- { IFM_10_T, "10UTP" }, \
- { IFM_10_2, "BNC" }, \
- { IFM_10_2, "10BNC" }, \
- { IFM_10_5, "AUI" }, \
- { IFM_10_5, "10AUI" }, \
- { IFM_100_TX, "100TX" }, \
- { IFM_100_FX, "100FX" }, \
- { IFM_100_T4, "100T4" }, \
- { IFM_100_VG, "100VG" }, \
- { IFM_100_T2, "100T2" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \
- { IFM_TOK_STP4, "DB9/4Mbit" }, \
- { IFM_TOK_STP16, "DB9/16Mbit" }, \
- { IFM_TOK_UTP4, "UTP/4Mbit" }, \
- { IFM_TOK_UTP16, "UTP/16Mbit" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_TOKENRING_ALIASES { \
- { IFM_TOK_STP4, "4STP" }, \
- { IFM_TOK_STP16, "16STP" }, \
- { IFM_TOK_UTP4, "4UTP" }, \
- { IFM_TOK_UTP16, "16UTP" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \
- { IFM_TOK_ETR, "EarlyTokenRelease" }, \
- { IFM_TOK_SRCRT, "SourceRouting" }, \
- { IFM_TOK_ALLR, "AllRoutes" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \
- { IFM_FDDI_SMF, "Single-mode" }, \
- { IFM_FDDI_MMF, "Multi-mode" }, \
- { IFM_FDDI_UTP, "UTP" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_FDDI_ALIASES { \
- { IFM_FDDI_SMF, "SMF" }, \
- { IFM_FDDI_MMF, "MMF" }, \
- { IFM_FDDI_UTP, "CDDI" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \
- { IFM_FDDI_DA, "Dual-attach" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
- { IFM_AUTO, "autoselect" }, \
- { IFM_MANUAL, "manual" }, \
- { IFM_NONE, "none" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SUBTYPE_SHARED_ALIASES { \
- { IFM_AUTO, "auto" }, \
- { 0, NULL }, \
-}
-
-#define IFM_SHARED_OPTION_DESCRIPTIONS { \
- { IFM_FDX, "full-duplex" }, \
- { IFM_HDX, "half-duplex" }, \
- { IFM_FLAG0, "flag0" }, \
- { IFM_FLAG1, "flag1" }, \
- { IFM_FLAG2, "flag2" }, \
- { IFM_LOOP, "hw-loopback" }, \
- { 0, NULL }, \
-}
-
-#endif /* _NET_IF_MEDIA_H_ */
diff --git a/usr.bin/colldef/data/lt_LN.ASCII.src b/usr.bin/colldef/data/lt_LN.ASCII.src
deleted file mode 100644
index 525ebb979707..000000000000
--- a/usr.bin/colldef/data/lt_LN.ASCII.src
+++ /dev/null
@@ -1,6 +0,0 @@
-# ASCII
-#
-# $Id: lt_LN.ISO_8859-1.src,v 1.8 1997/02/22 19:54:39 peter Exp $
-#
-order \
- \x00;...;\xff
diff --git a/usr.bin/ee/Artistic b/usr.bin/ee/Artistic
deleted file mode 100644
index fbf798977589..000000000000
--- a/usr.bin/ee/Artistic
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
- The "Artistic License"
-
- Preamble
-
-The intent of this document is to state the conditions under which a
-Package may be copied, such that the Copyright Holder maintains some
-semblance of artistic control over the development of the package,
-while giving the users of the package the right to use and distribute
-the Package in a more-or-less customary fashion, plus the right to make
-reasonable modifications.
-
-Definitions:
-
- "Package" refers to the collection of files distributed by the
- Copyright Holder, and derivatives of that collection of files
- created through textual modification.
-
- "Standard Version" refers to such a Package if it has not been
- modified, or has been modified in accordance with the wishes
- of the Copyright Holder.
-
- "Copyright Holder" is whoever is named in the copyright or
- copyrights for the package.
-
- "You" is you, if you're thinking about copying or distributing
- this Package.
-
- "Reasonable copying fee" is whatever you can justify on the
- basis of media cost, duplication charges, time of people involved,
- and so on. (You will not be required to justify it to the
- Copyright Holder, but only to the computing community at large
- as a market that must bear the fee.)
-
- "Freely Available" means that no fee is charged for the item
- itself, though there may be fees involved in handling the item.
- It also means that recipients of the item may redistribute it
- under the same conditions they received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you
-duplicate all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications
-derived from the Public Domain or from the Copyright Holder. A Package
-modified in such a way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and
-when you changed that file, and provided that you do at least ONE of the
-following:
-
- a) place your modifications in the Public Domain or otherwise make them
- Freely Available, such as by posting said modifications to Usenet or
- an equivalent medium, or placing the modifications on a major archive
- site such as uunet.uu.net, or by allowing the Copyright Holder to include
- your modifications in the Standard Version of the Package.
-
- b) use the modified Package only within your corporation or organization.
-
- c) rename any non-standard executables so the names do not conflict
- with standard executables, which must also be provided, and provide
- a separate manual page for each non-standard executable that clearly
- documents how it differs from the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or
-executable form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library files,
- together with instructions (in the manual page or equivalent) on where
- to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their corresponding
- Standard Version executables, giving the non-standard executables
- non-standard names, and clearly documenting the differences in manual
- pages (or equivalent), together with instructions on where to get
- the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this
-Package. You may charge any fee you choose for support of this Package.
-You may not charge a fee for this Package itself. However,
-you may distribute this Package in aggregate with other (possibly
-commercial) programs as part of a larger (possibly commercial) software
-distribution provided that you do not advertise this Package as a
-product of your own.
-
-6. The scripts and library files supplied as input to or produced as
-output from the programs of this Package do not automatically fall
-under the copyright of this Package, but belong to whomever generated
-them, and may be sold commercially, and may be aggregated with this
-Package.
-
-7. C subroutines supplied by you and linked into this Package in order
-to emulate subroutines and variables of the language defined by this
-Package shall not be considered part of this Package, but are the
-equivalent of input as in Paragraph 6, provided these subroutines do
-not change the language in any way that would cause it to fail the
-regression tests for the language.
-
-8. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written permission.
-
-9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
- The End
diff --git a/usr.bin/ee/ee.i18n.guide b/usr.bin/ee/ee.i18n.guide
deleted file mode 100644
index 0850c2e7400d..000000000000
--- a/usr.bin/ee/ee.i18n.guide
+++ /dev/null
@@ -1,141 +0,0 @@
-Easy Editor ("ee") provides the ability to translate the messages displayed to
-the user and the commands entered. This is done via message catalogs,
-following X/Open standards. ee only supports eight bit characters.
-
-(The name ee.i18n.guide is for "ee internationalization guide". The i18n
-abbreviation is used because there are 18 characters between the first
-letter ("i") and last ("n") of "internationalization".)
-
-All of the messages, warnings, information, and commands, are contained in the
-message catalog. Each numbered entry represents an individual string used by
-ee. Some strings contain formatting information for formatted print
-statements, which are of the form "%s", or "%d", these must be preserved in
-the translation, or the correct information will not be displayed. For those
-strings containing multiple formatting codes, the order of each item must be
-preserved as well.
-
-Message content
-1 title for modes, or settings menu
-2 - 8 entries for modes menu, each line should be the same length
- (padded with spaces)
-9 - 34 other menu titles and entries
-35 - 56 help screen
-57 - 61 actions assigned to control keys
-62 - 66 commands information
-67 message displayed when info window turned off
-68 indication that no file name was entered when invoking ee
-69 prompt for decimal value of character to be entered
-70 message displaying the print command being invoked
-71 prompt for command
-72 prompt for name of file to be written
-73 prompt for name of file to be read
-74 string used to display the decimal value of the character
- the cursor is on
-75 string displaying an unrecognized command
-76 string indicating that the command entered is not a unique
- substring of a valid command
-77 string indicating the current line number
-78 string for displaying the length of the line
-79 string for displaying the name of the file
-80 - 83 strings showing how to invoke ee, and its options
-84 message indicating that the file entered is a directory, not a
- text file
-85 message informing that the entered file does not yet exist
-86 message informing that the file can't be opened (because of
- permission problems)
-87 message after file has been read with the file name and number
- of lines read
-88 message indicating that the file has been read
-89 message indicating that the file is being read
-90 message indicating that permissions only allow the file to be
- read, not written
-91 message after file has been read with the file name and number
- of lines read
-92 prompt for name of file to be saved (used when no name was
- entered for a file to edit)
-93 message indicating that the file was not written, since no
- name was entered at the prompt
-94 prompt asking user if changes should not be saved ("yes_char"
- will be expected for affirmative response)
-95 "yes" character, single character expected to confirm action
- (can be upper or lower case, will be converted to upper-case
- during test)
-96 prompt
-97 error message
-98 message indicating that the named file is being written
-99 message indicating the name of the file written, the number of
- lines, and the number of characters (order of items must be
- maintained)
-100 search in progress message
-101 message that the string was not found
-102 prompt for search
-103 message that string could not be executed
-104 self-explanatory
-105 message for menus, indicating that the Escape character will
- allow the user to exit the menu
-106 error message indicating the menu won't fit on the screen
-107 self-explanatory
-108 prompt for shell command
-109 message displayed while formatting a paragraph
-110 string which places message for spell checking at top of
- buffer (the portions 'list of unrecognized words' and
- '-=-=-=-=-=-' may be replaced, but the rest must remain the
- same)
-111 message informing that spell checking is in progress
-112 prompt for right margin
-113 error informing user that operation is not permitted in ree
-114 string indicating mode is turned 'on' in modes menu
-115 string indicating mode is turned 'off' in modes menu
-116 - 131 strings used for commands (some also used for initialization)
-132 - 144 strings used for initialization
-145 entry for settings menu for emacs key bindings settings
-146 - 153 help screen entries for emacs key bindings info
-154 - 158 info window entries for emacs key bindings info
-159 string for turning on emacs key bindings in the init file
-160 string for turning off emacs key bindings in the init file
-
-Care should be taken when translating commands and initialization keywords
-because the algorithm used for detecting uniqueness of entered commands
-will not be able to distinguish words that are not unique before the end
-of the shorter word, for example, it would not be able to distinguish the
-command 'abcd' from 'abcde'.
-
-After translating the messages, use the 'gencat' command to create the compiled
-catalog used when running the software. The standard syntax would be:
-
- gencat ee.cat ee.msg
-
-Where ee.msg is the file containing the translations, and ee.cat is the
-compiled catalog. If the file ee.cat does not exist, it will be created.
-Check the documentation for your system for proper syntax.
-
-Message catalog placement varies from system to system. A common location
-for message catalogs is in /usr/lib/nls. In this directory are
-directories with the names of other languages. The default language is
-'C'. There is also an environment variable, named NLSPATH used to
-determine where message catalogs can be found. This variable is similar
-to the PATH variable used for commands, but with some differences. The
-NLSPATH variable must have the ability to handle different names for
-languages and the catalog files, so it has field descriptors for these. A
-typical setting for NLSPATH could be:
-
- NLSPATH=/usr/lib/nls/%L/%N.cat:/usr/local/lib/nls/%L/%N.cat
-
-Where "%L" is the field descriptor for the language (obtained from the
-LANG environment variable) and "%N" is the name of the file (with the
-".cat" appended by the path variable, it is not passed from the requesting
-program). The colon (:) is used to separate paths, so in the above
-example there are two paths possible for message catalogs. You may wish
-to maintain catalogs for applications that are not supported by your
-system vendor in a location unique for you, and this is facilitated by the
-NLSPATH variable. Remember to set and export both the LANG and NLSPATH
-variables for each user that expects to use localization either in a
-system-wide profile or in each user's profile. See your system
-documentation for more information.
-
-The message catalog supplied with ee also uses the '$quote' directive to
-specify a quote around strings to ensure proper padding. This directive
-may not be supported on all systems, and lead to quotes being included in
-the string used in ee, which will cause incorrect behavior. If the
-'$quote' directive is not supported by your system's gencat command, edit
-the msg file to remove the leading and trailing quotation marks.
diff --git a/usr.bin/ee/new_curse.c b/usr.bin/ee/new_curse.c
deleted file mode 100644
index 91c1078948a2..000000000000
--- a/usr.bin/ee/new_curse.c
+++ /dev/null
@@ -1,3574 +0,0 @@
-/*
- | new_curse.c
- |
- | A subset of curses developed for use with ae.
- |
- | written by Hugh Mahon
- |
- | THIS MATERIAL IS PROVIDED "AS IS". THERE ARE
- | NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
- | MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
- | IMPLIED WARRANTIES OF MERCHANTABILITY AND
- | FITNESS FOR A PARTICULAR PURPOSE. Neither
- | Hewlett-Packard nor Hugh Mahon shall be liable
- | for errors contained herein, nor for
- | incidental or consequential damages in
- | connection with the furnishing, performance or
- | use of this material. Neither Hewlett-Packard
- | nor Hugh Mahon assumes any responsibility for
- | the use or reliability of this software or
- | documentation. This software and
- | documentation is totally UNSUPPORTED. There
- | is no support contract available. Hewlett-
- | Packard has done NO Quality Assurance on ANY
- | of the program or documentation. You may find
- | the quality of the materials inferior to
- | supported materials.
- |
- | This software is not a product of Hewlett-Packard, Co., or any
- | other company. No support is implied or offered with this software.
- | You've got the source, and you're on your own.
- |
- | This software may be distributed under the terms of Larry Wall's
- | Artistic license, a copy of which is included in this distribution.
- |
- | This notice must be included with this software and any derivatives.
- |
- | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon
- | All are rights reserved.
- |
- | $Header: /home/ncvs/src/usr.bin/ee/doc/new_curse.c,v 1.1.1.1 1995/08/30 07:28:06 jkh Exp $
- |
- */
-
-char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon",
- "All rights are reserved."};
-
-char * new_curse_name= "@(#) new_curse.c $Revision: 1.1.1.1 $";
-
-#include "new_curse.h"
-#include <signal.h>
-#include <fcntl.h>
-
-#ifdef SYS5
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#ifdef BSD_SELECT
-#include <sys/types.h>
-#include <sys/time.h>
-
-#ifdef SLCT_HDR
-#include <sys/select.h> /* on AIX */
-#endif /* SLCT_HDR */
-
-#endif /* BSD_SELECT */
-
-#ifdef HAS_STDLIB
-#include <stdlib.h>
-#endif
-
-#if defined(__STDC__)
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#ifdef HAS_UNISTD
-#include <unistd.h>
-#endif
-
-#ifdef HAS_SYS_IOCTL
-#include <sys/ioctl.h>
-#endif
-
-
-WINDOW *curscr;
-static WINDOW *virtual_scr;
-WINDOW *stdscr;
-WINDOW *last_window_refreshed;
-
-#ifdef TIOCGWINSZ
- struct winsize ws;
-#endif
-
-#define min(a, b) (a < b ? a : b)
-
-#ifndef CAP
-#define String_Out(table, stack, place) Info_Out(table, stack, place)
-#else
-#define String_Out(table, stack, place) Cap_Out(table, stack, place)
-#endif
-
-#define bw__ 0 /* booleans */
-#define am__ 1
-#define xb__ 2
-#define xs__ 3 /* hp glitch (standout not erased by overwrite) */
-#define xn__ 4
-#define eo__ 5
-#define gn__ 6 /* generic type terminal */
-#define hc__ 7 /* hardcopy terminal */
-#define km__ 8
-#define hs__ 9
-#define in__ 10
-#define da__ 11
-#define db__ 12
-#define mi__ 13 /* safe to move during insert mode */
-#define ms__ 14 /* safe to move during standout mode */
-#define os__ 15
-#define es__ 16
-#define xt__ 17
-#define hz__ 18 /* hazeltine glitch */
-#define ul__ 19
-#define xo__ 20
-#define chts__ 21
-#define nxon__ 22
-#define nrrmc__ 23
-#define npc__ 24
-#define mc5i__ 25
-
-#define co__ 0 /* number of columns */ /* numbers */
-#define it__ 1 /* spaces per tab */
-#define li__ 2 /* number of lines */
-#define lm__ 3
-#define sg__ 4 /* magic cookie glitch */
-#define pb__ 5
-#define vt__ 6
-#define ws__ 7
-
-#define cols__ 0
-#define lines__ 2
-#define xmc__ 4
-#define vt__ 6
-#define wsl__ 7
-#define nlab__ 8
-#define lh__ 9
-#define lw__ 10
-
-#define bt__ 0 /* back tab */ /* strings */
-#define bl__ 1 /* bell */
-#define cr__ 2 /* carriage return */
-#define cs__ 3 /* change scroll region */
-#define ct__ 4 /* clear all tab stops */
-#define cl__ 5 /* clear screen and home cursor */
-#define ce__ 6 /* clear to end of line */
-#define cd__ 7 /* clear to end of display */
-#define ch__ 8 /* set cursor column */
-#define CC__ 9 /* term, settable cmd char in */
-#define cm__ 10 /* screen rel cursor motion, row, column */
-#define do__ 11 /* down one line */
-#define ho__ 12 /* home cursor */
-#define vi__ 13 /* make cursor invisible */
-#define le__ 14 /* move cursor left one space */
-#define CM__ 15 /* memory rel cursor addressing */
-#define ve__ 16 /* make cursor appear normal */
-#define nd__ 17 /* non-destructive space (cursor right) */
-#define ll__ 18 /* last line, first col */
-#define up__ 19 /* cursor up */
-#define vs__ 20
-#define dc__ 21 /* delete character */
-#define dl__ 22 /* delete line */
-#define ds__ 23
-#define hd__ 24
-#define as__ 25
-#define mb__ 26
-#define md__ 27 /* turn on bold */
-#define ti__ 28
-#define dm__ 29 /* turn on delete mode */
-#define mh__ 30 /* half bright mode */
-#define im__ 31 /* insert mode */
-#define mk__ 32
-#define mp__ 33
-#define mr__ 34
-#define so__ 35 /* enter standout mode */
-#define us__ 36
-#define ec__ 37
-#define ae__ 38
-#define me__ 39
-#define te__ 40
-#define ed__ 41
-#define ei__ 42 /* exit insert mode */
-#define se__ 43 /* exit standout mode */
-#define ue__ 44
-#define vb__ 45
-#define ff__ 46
-#define fs__ 47
-#define i1__ 48
-#define i2__ 49
-#define i3__ 50
-#define if__ 51
-#define ic__ 52
-#define al__ 53
-#define ip__ 54
-#define kb__ 55 /* backspace key */
-#define ka__ 56
-#define kC__ 57
-#define kt__ 58
-#define kD__ 59
-#define kL__ 60
-#define kd__ 61
-#define kM__ 62
-#define kE__ 63
-#define kS__ 64
-#define k0__ 65
-#define k1__ 66
-#define kf10__ 67
-#define k2__ 68
-#define k3__ 69
-#define k4__ 70
-#define k5__ 71
-#define k6__ 72
-#define k7__ 73
-#define k8__ 74
-#define k9__ 75
-#define kh__ 76
-#define kI__ 77
-#define kA__ 78
-#define kl__ 79
-#define kH__ 80
-#define kN__ 81
-#define kP__ 82
-#define kr__ 83
-#define kF__ 84
-#define kR__ 85
-#define kT__ 86
-#define ku__ 87 /* key up */
-#define ke__ 88
-#define ks__ 89
-#define l0__ 90
-#define l1__ 91
-#define la__ 92
-#define l2__ 93
-#define l3__ 94
-#define l4__ 95
-#define l5__ 96
-#define l6__ 97
-#define l7__ 98
-#define l8__ 99
-#define l9__ 100
-#define mo__ 101
-#define mm__ 102
-#define nw__ 103
-#define pc__ 104
-#define DC__ 105
-#define DL__ 106
-#define DO__ 107
-#define IC__ 118
-#define SF__ 109
-#define AL__ 110
-#define LE__ 111
-#define RI__ 112
-#define SR__ 113
-#define UP__ 114
-#define pk__ 115
-#define pl__ 116
-#define px__ 117
-#define ps__ 118
-#define pf__ 119
-#define po__ 120
-#define rp__ 121
-#define r1__ 122
-#define r2__ 123
-#define r3__ 124
-#define rf__ 125
-#define rc__ 126
-#define cv__ 127
-#define sc__ 128
-#define sf__ 129
-#define sr__ 130
-#define sa__ 131 /* sgr */
-#define st__ 132
-#define wi__ 133
-#define ta__ 134
-#define ts__ 135
-#define uc__ 136
-#define hu__ 137
-#define iP__ 138
-#define K1__ 139
-#define K2__ 140
-#define K3__ 141
-#define K4__ 142
-#define K5__ 143
-#define pO__ 144
-#define ml__ 145
-#define mu__ 146
-#define rmp__ 145
-#define acsc__ 146
-#define pln__ 147
-#define kcbt__ 148
-#define smxon__ 149
-#define rmxon__ 150
-#define smam__ 151
-#define rmam__ 152
-#define xonc__ 153
-#define xoffc__ 154
-#define enacs__ 155
-#define smln__ 156
-#define rmln__ 157
-#define kbeg__ 158
-#define kcan__ 159
-#define kclo__ 160
-#define kcmd__ 161
-#define kcpy__ 162
-#define kcrt__ 163
-#define kend__ 164
-#define kent__ 165
-#define kext__ 166
-#define kfnd__ 167
-#define khlp__ 168
-#define kmrk__ 169
-#define kmsg__ 170
-#define kmov__ 171
-#define knxt__ 172
-#define kopn__ 173
-#define kopt__ 174
-#define kprv__ 175
-#define kprt__ 176
-#define krdo__ 177
-#define kref__ 178
-#define krfr__ 179
-#define krpl__ 180
-#define krst__ 181
-#define kres__ 182
-#define ksav__ 183
-#define kspd__ 184
-#define kund__ 185
-#define kBEG__ 186
-#define kCAN__ 187
-#define kCMD__ 188
-#define kCPY__ 189
-#define kCRT__ 190
-#define kDC__ 191
-#define kDL__ 192
-#define kslt__ 193
-#define kEND__ 194
-#define kEOL__ 195
-#define kEXT__ 196
-#define kFND__ 197
-#define kHLP__ 198
-#define kHOM__ 199
-#define kIC__ 200
-#define kLFT__ 201
-#define kMSG__ 202
-#define kMOV__ 203
-#define kNXT__ 204
-#define kOPT__ 205
-#define kPRV__ 206
-#define kPRT__ 207
-#define kRDO__ 208
-#define kRPL__ 209
-#define kRIT__ 210
-#define kRES__ 211
-#define kSAV__ 212
-#define kSPD__ 213
-#define kUND__ 214
-#define rfi__ 215
-#define kf11__ 216
-#define kf12__ 217
-#define kf13__ 218
-#define kf14__ 219
-#define kf15__ 220
-#define kf16__ 221
-#define kf17__ 222
-#define kf18__ 223
-#define kf19__ 224
-#define kf20__ 225
-#define kf21__ 226
-#define kf22__ 227
-#define kf23__ 228
-#define kf24__ 229
-#define kf25__ 230
-#define kf26__ 231
-#define kf27__ 232
-#define kf28__ 233
-#define kf29__ 234
-#define kf30__ 235
-#define kf31__ 236
-#define kf32__ 237
-#define kf33__ 238
-#define kf34__ 239
-#define kf35__ 240
-#define kf36__ 241
-#define kf37__ 242
-#define kf38__ 243
-#define kf39__ 244
-#define kf40__ 245
-#define kf41__ 246
-#define kf42__ 247
-#define kf43__ 248
-#define kf44__ 249
-#define kf45__ 250
-#define kf46__ 251
-#define kf47__ 252
-#define kf48__ 253
-#define kf49__ 254
-#define kf50__ 255
-#define kf51__ 256
-#define kf52__ 257
-#define kf53__ 258
-#define kf54__ 259
-#define kf55__ 260
-#define kf56__ 261
-#define kf57__ 262
-#define kf58__ 263
-#define kf59__ 264
-#define kf60__ 265
-#define kf61__ 266
-#define kf62__ 267
-#define kf63__ 268
-#define el1__ 269
-#define mgc__ 270
-#define smgl__ 271
-#define smgr__ 272
-
-#ifdef CAP
-char *Boolean_names[] = {
-"bw", "am", "xb", "xs", "xn", "eo", "gn", "hc", "km", "hs", "in", "da", "db",
-"mi", "ms", "os", "es", "xt", "hz", "ul", "xo", "HC", "nx", "NR", "NP", "5i"
-};
-
-char *Number_names[] = {
-"co#", "it#", "li#", "lm#", "sg#", "pb#", "vt#", "ws#", "Nl#", "lh#", "lw#"
-};
-
-char *String_names[] = {
-"bt=", "bl=", "cr=", "cs=", "ct=", "cl=", "ce=", "cd=", "ch=", "CC=", "cm=",
-"do=", "ho=", "vi=", "le=", "CM=", "ve=", "nd=", "ll=", "up=", "vs=", "dc=",
-"dl=", "ds=", "hd=", "as=", "mb=", "md=", "ti=", "dm=", "mh=", "im=", "mk=",
-"mp=", "mr=", "so=", "us=", "ec=", "ae=", "me=", "te=", "ed=", "ei=", "se=",
-"ue=", "vb=", "ff=", "fs=", "i1=", "i2=", "i3=", "if=", "ic=", "al=", "ip=",
-"kb=", "ka=", "kC=", "kt=", "kD=", "kL=", "kd=", "kM=", "kE=", "kS=", "k0=",
-"k1=", "k;=", "k2=", "k3=", "k4=", "k5=", "k6=", "k7=", "k8=", "k9=", "kh=",
-"kI=", "kA=", "kl=", "kH=", "kN=", "kP=", "kr=", "kF=", "kR=", "kT=", "ku=",
-"ke=", "ks=", "l0=", "l1=", "la=", "l2=", "l3=", "l4=", "l5=", "l6=", "l7=",
-"l8=", "l9=", "mo=", "mm=", "nw=", "pc=", "DC=", "DL=", "DO=", "IC=", "SF=",
-"AL=", "LE=", "RI=", "SR=", "UP=", "pk=", "pl=", "px=", "ps=", "pf=", "po=",
-"rp=", "r1=", "r2=", "r3=", "rf=", "rc=", "cv=", "sc=", "sf=", "sr=", "sa=",
-"st=", "wi=", "ta=", "ts=", "uc=", "hu=", "iP=", "K1=", "K3=", "K2=", "K4=",
-"K5=", "pO=", "rP=", "ac=", "pn=", "kB=", "SX=", "RX=", "SA=", "RA=", "XN=",
-"XF=", "eA=", "LO=", "LF=", "@1=", "@2=", "@3=", "@4=", "@5=", "@6=", "@7=",
-"@8=", "@9=", "@0=", "%1=", "%2=", "%3=", "%4=", "%5=", "%6=", "%7=", "%8=",
-"%9=", "%0=", "&1=", "&2=", "&3=", "&4=", "&5=", "&6=", "&7=", "&8=", "&9=",
-"&0=", "*1=", "*2=", "*3=", "*4=", "*5=", "*6=", "*7=", "*8=", "*9=", "*0=",
-"#1=", "#2=", "#3=", "#4=", "%a=", "%b=", "%c=", "%d=", "%e=", "%f=", "%g=",
-"%h=", "%i=", "%j=", "!1=", "!2=", "!3=", "RF=", "F1=", "F2=", "F3=", "F4=",
-"F5=", "F6=", "F7=", "F8=", "F9=", "FA=", "FB=", "FC=", "FD=", "FE=", "FF=",
-"FG=", "FH=", "FI=", "FJ=", "FK=", "FL=", "FM=", "FN=", "FO=", "FP=", "FQ=",
-"FR=", "FS=", "FT=", "FU=", "FV=", "FW=", "FX=", "FY=", "FZ=", "Fa=", "Fb=",
-"Fc=", "Fd=", "Fe=", "Ff=", "Fg=", "Fh=", "Fi=", "Fj=", "Fk=", "Fl=", "Fm=",
-"Fn=", "Fo=", "Fp=", "Fq=", "Fr=", "cb=", "MC=", "ML=", "MR="
-};
-#endif
-
-char *new_curse = "October 1987";
-
-char in_buff[100]; /* buffer for ungetch */
-int bufp; /* next free position in in_buff */
-
-char *TERMINAL_TYPE = NULL; /* terminal type to be gotten from environment */
-int CFOUND = FALSE;
-int Data_Line_len = 0;
-int Max_Key_len; /* max length of a sequence sent by a key */
-char *Data_Line = NULL;
-char *TERM_PATH = NULL;
-char *TERM_data_ptr = NULL;
-char *Term_File_name = NULL; /* name of file containing terminal description */
-FILE *TFP; /* file pointer to file with terminal des. */
-int Fildes; /* file descriptor for terminfo file */
-int STAND = FALSE; /* is standout mode activated? */
-int TERM_INFO = FALSE; /* is terminfo being used (TRUE), or termcap (FALSE) */
-int Time_Out; /* set when time elapsed while trying to read function key */
-int Curr_x; /* current x position on screen */
-int Curr_y; /* current y position on the screen */
-int LINES;
-int COLS;
-int Move_It; /* flag to move cursor if magic cookie glitch */
-int initialized = FALSE; /* tells whether new_curse is initialized */
-float speed;
-float chars_per_millisecond;
-int Repaint_screen; /* if an operation to change screen impossible, repaint screen */
-int Intr; /* storeage for interrupt character */
-int Parity; /* 0 = no parity, 1 = odd parity, 2 = even parity */
-int Noblock; /* for BSD systems */
-int Num_bits; /* number of bits per character */
-int Flip_Bytes; /* some systems have byte order reversed */
-int interrupt_flag = FALSE; /* set true if SIGWINCH received */
-
-#ifndef CAP
-char *Strings;
-#endif
-
-struct KEYS {
- int length; /* length of string sent by key */
- char *string; /* string sent by key */
- int value; /* CURSES value of key (9-bit) */
- };
-
-struct KEY_STACK {
- struct KEYS *element;
- struct KEY_STACK *next;
- };
-
-struct KEY_STACK *KEY_TOS = NULL;
-struct KEY_STACK *KEY_POINT;
-
-struct Parameters {
- int value;
- struct Parameters *next;
- };
-
-int Key_vals[] = {
- 0407, 0526, 0515, 0525, 0512, 0510, 0402, 0514, 0517, 0516, 0410, 0411,
- 0422, 0412, 0413, 0414, 0415, 0416, 0417, 0420, 0421, 0406, 0513, 0511,
- 0404, 0533, 0522, 0523, 0405, 0520, 0521, 0524, 0403,
- 0534, 0535, 0536, 0537, 0540, 0541, 0542, 0543, 0544, 0545, 0546, 0547,
- 0550, 0527, 0551, 0552, 0553, 0554, 0555, 0556, 0557, 0560, 0561, 0562,
- 0532, 0563, 0564, 0565, 0566, 0567, 0570, 0571, 0627, 0630, 0572, 0573,
- 0574, 0575, 0576, 0577, 0600, 0601, 0602, 0603, 0604, 0605, 0606, 0607,
- 0610, 0611, 0612, 0613, 0614, 0615, 0616, 0617, 0620, 0621, 0622, 0623,
- 0624, 0625, 0626, 0423, 0424, 0425, 0426, 0427, 0430, 0431,
- 0432, 0433, 0434, 0435, 0436, 0437, 0440, 0441, 0442, 0443, 0444, 0445,
- 0446, 0447, 0450, 0451, 0452, 0453, 0454, 0455, 0456, 0457, 0460, 0461,
- 0462, 0463, 0464, 0465, 0466, 0467, 0470, 0471, 0472, 0473, 0474, 0475,
- 0476, 0477, 0500, 0501, 0502, 0503, 0504, 0505, 0506, 0507
-};
-
-int attributes_set[9];
-
-#ifdef SYS5
-struct termio Terminal;
-struct termio Saved_tty;
-#else
-struct sgttyb Terminal;
-struct sgttyb Saved_tty;
-#endif
-
-char *tc_;
-
-int Booleans[128];
-int Numbers[128];
-char *String_table[1024];
-
-int *virtual_lines;
-
-static char nc_scrolling_ability = FALSE;
-
-#ifdef CAP
-
-#if __STDC__ || defined(__cplusplus)
-#define P_(s) s
-#else
-#define P_(s) ()
-#endif /* __STDC__ */
-
-int tc_Get_int P_((int));
-void CAP_PARSE P_((void));
-void Find_term P_((void));
-
-#undef P_
-
-#endif /* CAP */
-
-
-#ifndef __STDC__
-#ifndef HAS_STDLIB
-extern char *fgets();
-extern char *malloc();
-extern char *getenv();
-FILE *fopen(); /* declaration for open function */
-#endif /* HAS_STDLIB */
-#endif /* __STDC__ */
-
-#ifdef SIGWINCH
-
-/*
- | Copy the contents of one window to another.
- */
-
-void
-copy_window(origin, destination)
-WINDOW *origin, *destination;
-{
- int row, column;
- struct _line *orig, *dest;
-
- orig = origin->first_line;
- dest = destination->first_line;
-
- for (row = 0;
- row < (min(origin->Num_lines, destination->Num_lines));
- row++)
- {
- for (column = 0;
- column < (min(origin->Num_cols, destination->Num_cols));
- column++)
- {
- dest->row[column] = orig->row[column];
- dest->attributes[column] = orig->attributes[column];
- }
- dest->changed = orig->changed;
- dest->scroll = orig->scroll;
- dest->last_char = min(orig->last_char, destination->Num_cols);
- orig = orig->next_screen;
- dest = dest->next_screen;
- }
- destination->LX = min((destination->Num_cols - 1), origin->LX);
- destination->LY = min((destination->Num_lines - 1), origin->LY);
- destination->Attrib = origin->Attrib;
- destination->scroll_up = origin->scroll_up;
- destination->scroll_down = origin->scroll_down;
- destination->SCROLL_CLEAR = origin->SCROLL_CLEAR;
-}
-
-void
-reinitscr(foo)
-int foo;
-{
- WINDOW *local_virt;
- WINDOW *local_std;
- WINDOW *local_cur;
-
- signal(SIGWINCH, reinitscr);
-#ifdef TIOCGWINSZ
- if (ioctl(0, TIOCGWINSZ, &ws) >= 0)
- {
- if (ws.ws_row == LINES && ws.ws_col == COLS)
- return;
- if (ws.ws_row > 0)
- LINES = ws.ws_row;
- if (ws.ws_col > 0)
- COLS = ws.ws_col;
- }
-#endif /* TIOCGWINSZ */
- local_virt = newwin(LINES, COLS, 0, 0);
- local_std = newwin(LINES, COLS, 0, 0);
- local_cur = newwin(LINES, COLS, 0, 0);
- copy_window(virtual_scr, local_virt);
- copy_window(stdscr, local_std);
- copy_window(curscr, local_cur);
- delwin(virtual_scr);
- delwin(stdscr);
- delwin(curscr);
- virtual_scr = local_virt;
- stdscr = local_std;
- curscr = local_cur;
- free(virtual_lines);
- virtual_lines = (int *) malloc(LINES * (sizeof(int)));
- interrupt_flag = TRUE;
-}
-#endif /* SIGWINCH */
-
-void
-initscr() /* initialize terminal for operations */
-{
- int value;
- char *lines_string;
- char *columns_string;
-#ifdef CAP
- char *pointer;
-#endif /* CAP */
-
-#ifdef DIAG
-printf("starting initscr \n");fflush(stdout);
-#endif
- if (initialized)
- return;
-#ifdef BSD_SELECT
- setbuf(stdin, NULL);
-#endif /* BSD_SELECT */
- Flip_Bytes = FALSE;
- Parity = 0;
- Time_Out = FALSE;
- bufp = 0;
- Move_It = FALSE;
- Noblock = FALSE;
-#ifdef SYS5
- value = ioctl(0, TCGETA, &Terminal);
- if (Terminal.c_cflag & PARENB)
- {
- if (Terminal.c_cflag & PARENB)
- Parity = 1;
- else
- Parity = 2;
- }
- if ((Terminal.c_cflag & CS8) == CS8)
- {
- Num_bits = 8;
- }
- else if ((Terminal.c_cflag & CS7) == CS7)
- Num_bits = 7;
- else if ((Terminal.c_cflag & CS6) == CS6)
- Num_bits = 6;
- else
- Num_bits = 5;
- value = Terminal.c_cflag & 037;
- switch (value) {
- case 01: speed = 50.0;
- break;
- case 02: speed = 75.0;
- break;
- case 03: speed = 110.0;
- break;
- case 04: speed = 134.5;
- break;
- case 05: speed = 150.0;
- break;
- case 06: speed = 200.0;
- break;
- case 07: speed = 300.0;
- break;
- case 010: speed = 600.0;
- break;
- case 011: speed = 900.0;
- break;
- case 012: speed = 1200.0;
- break;
- case 013: speed = 1800.0;
- break;
- case 014: speed = 2400.0;
- break;
- case 015: speed = 3600.0;
- break;
- case 016: speed = 4800.0;
- break;
- case 017: speed = 7200.0;
- break;
- case 020: speed = 9600.0;
- break;
- case 021: speed = 19200.0;
- break;
- case 022: speed = 38400.0;
- break;
- default: speed = 0.0;
- }
-#else
- value = ioctl(0, TIOCGETP, &Terminal);
- if (Terminal.sg_flags & EVENP)
- Parity = 2;
- else if (Terminal.sg_flags & ODDP)
- Parity = 1;
- value = Terminal.sg_ospeed;
- switch (value) {
- case 01: speed = 50.0;
- break;
- case 02: speed = 75.0;
- break;
- case 03: speed = 110.0;
- break;
- case 04: speed = 134.5;
- break;
- case 05: speed = 150.0;
- break;
- case 06: speed = 200.0;
- break;
- case 07: speed = 300.0;
- break;
- case 010: speed = 600.0;
- break;
- case 011: speed = 1200.0;
- break;
- case 012: speed = 1800.0;
- break;
- case 013: speed = 2400.0;
- break;
- case 014: speed = 4800.0;
- break;
- case 015: speed = 9600.0;
- break;
- default: speed = 0.0;
- }
-#endif
- chars_per_millisecond = (0.001 * speed) / 8.0;
- TERMINAL_TYPE = getenv("TERM");
- if (TERMINAL_TYPE == NULL)
- {
- printf("unknown terminal type\n");
- exit(0);
- }
-#ifndef CAP
- Fildes = -1;
- TERM_PATH = getenv("TERMINFO");
- if (TERM_PATH != NULL)
- {
- Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
- Term_File_name = malloc(Data_Line_len);
- sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
- Fildes = open(Term_File_name, O_RDONLY);
- }
- if (Fildes == -1)
- {
- TERM_PATH = "/usr/lib/terminfo";
- Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
- Term_File_name = malloc(Data_Line_len);
- sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
- Fildes = open(Term_File_name, O_RDONLY);
- }
- if (Fildes == -1)
- {
- TERM_PATH = "/usr/share/lib/terminfo";
- Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
- Term_File_name = malloc(Data_Line_len);
- sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
- Fildes = open(Term_File_name, O_RDONLY);
- }
- if (Fildes == -1)
- {
- free(Term_File_name);
- Term_File_name = NULL;
- }
- else
- TERM_INFO = INFO_PARSE();
-#else
- /*
- | termcap information can be in the TERMCAP env variable, if so
- | use that, otherwise check the /etc/termcap file
- */
- if ((pointer = Term_File_name = getenv("TERMCAP")) != NULL)
- {
- if (*Term_File_name != '/')
- Term_File_name = "/etc/termcap";
- }
- else
- {
- Term_File_name = "/etc/termcap";
- }
- if ((TFP = fopen(Term_File_name, "r")) == NULL)
- {
- printf("unable to open /etc/termcap file \n");
- exit(0);
- }
- for (value = 0; value < 1024; value++)
- String_table[value] = NULL;
- for (value = 0; value < 128; value++)
- Booleans[value] = 0;
- for (value = 0; value < 128; value++)
- Numbers[value] = 0;
- Data_Line = malloc(512);
- if (pointer && *pointer != '/')
- {
- TERM_data_ptr = pointer;
- CAP_PARSE();
- }
- else
- {
- Find_term();
- CAP_PARSE();
- }
-#endif
- if (String_table[pc__] == NULL)
- String_table[pc__] = "\0";
- if ((String_table[cm__] == NULL) || (Booleans[hc__]))
- {
- fprintf(stderr, "sorry, unable to use this terminal type for screen editing\n");
- exit(0);
- }
- Key_Get();
- LINES = Numbers[li__];
- COLS = Numbers[co__];
- if ((lines_string = getenv("LINES")) != NULL)
- {
- value = atoi(lines_string);
- if (value > 0)
- LINES = value;
- }
- if ((columns_string = getenv("COLUMNS")) != NULL)
- {
- value = atoi(columns_string);
- if (value > 0)
- COLS = value;
- }
-#ifdef TIOCGWINSZ
- /*
- | get the window size
- */
- if (ioctl(0, TIOCGWINSZ, &ws) >= 0)
- {
- if (ws.ws_row > 0)
- LINES = ws.ws_row;
- if (ws.ws_col > 0)
- COLS = ws.ws_col;
- }
-#endif
- virtual_scr = newwin(LINES, COLS, 0, 0);
- stdscr = newwin(LINES, COLS, 0, 0);
- curscr = newwin(LINES, COLS, 0, 0);
- wmove(stdscr, 0, 0);
- werase(stdscr);
- Repaint_screen = TRUE;
- initialized = TRUE;
- virtual_lines = (int *) malloc(LINES * (sizeof(int)));
-
-#ifdef SIGWINCH
- /*
- | reset size of windows and LINES and COLS if term window
- | changes size
- */
- signal(SIGWINCH, reinitscr);
-#endif /* SIGWINCH */
-
- /*
- | check if scrolling is available
- */
-
- nc_scrolling_ability = ((String_table[al__] != NULL) &&
- (String_table[dl__])) || ((String_table[cs__])
- && (String_table[sr__]));
-
-}
-
-#ifndef CAP
-int
-Get_int() /* get a two-byte integer from the terminfo file */
-{
- int High_byte;
- int Low_byte;
- int temp;
-
- Low_byte = *((unsigned char *) TERM_data_ptr++);
- High_byte = *((unsigned char *) TERM_data_ptr++);
- if (Flip_Bytes)
- {
- temp = Low_byte;
- Low_byte = High_byte;
- High_byte = temp;
- }
- if ((High_byte == 255) && (Low_byte == 255))
- return (-1);
- else
- return(Low_byte + (High_byte * 256));
-}
-
-int
-INFO_PARSE() /* parse off the data in the terminfo data file */
-{
- int offset;
- int magic_number = 0;
- int counter = 0;
- int Num_names = 0;
- int Num_bools = 0;
- int Num_ints = 0;
- int Num_strings = 0;
- int string_table_len = 0;
- char *temp_ptr;
-
- TERM_data_ptr = Data_Line = malloc((10240 * (sizeof(char))));
- Data_Line_len = read(Fildes, Data_Line, 10240);
- if ((Data_Line_len >= 10240) || (Data_Line_len < 0))
- return(0);
- /*
- | get magic number
- */
- magic_number = Get_int();
- /*
- | if magic number not right, reverse byte order and check again
- */
- if (magic_number != 282)
- {
- Flip_Bytes = TRUE;
- TERM_data_ptr--;
- TERM_data_ptr--;
- magic_number = Get_int();
- if (magic_number != 282)
- return(0);
- }
- /*
- | get the number of each type in the terminfo data file
- */
- Num_names = Get_int();
- Num_bools = Get_int();
- Num_ints = Get_int();
- Num_strings = Get_int();
- string_table_len = Get_int();
- Strings = malloc(string_table_len);
- while (Num_names > 0)
- {
- TERM_data_ptr++;
- Num_names--;
- }
- counter = 0;
- while (Num_bools)
- {
- Num_bools--;
- Booleans[counter++] = *TERM_data_ptr++;
- }
- if (((unsigned int) TERM_data_ptr) & 1) /* force alignment */
- TERM_data_ptr++;
- counter = 0;
- while (Num_ints)
- {
- Num_ints--;
- Numbers[counter] = Get_int();
- counter++;
- }
- temp_ptr = TERM_data_ptr + Num_strings + Num_strings;
- memcpy(Strings, temp_ptr, string_table_len);
- counter = bt__;
- while (Num_strings)
- {
- Num_strings--;
- if ((offset=Get_int()) != -1)
- {
- if (String_table[counter] == NULL)
- String_table[counter] = Strings + offset;
- }
- else
- String_table[counter] = NULL;
- counter++;
- }
- close(Fildes);
- free(Data_Line);
- return(TRUE);
-}
-#endif /* ifndef CAP */
-
-int
-AtoI() /* convert ascii text to integers */
-{
- int Temp;
-
- Temp = 0;
- while ((*TERM_data_ptr >= '0') && (*TERM_data_ptr <= '9'))
- {
- Temp = (Temp * 10) + (*TERM_data_ptr - '0');
- TERM_data_ptr++;
- }
- return(Temp);
-}
-
-void
-Key_Get() /* create linked list with all key sequences obtained from terminal database */
-{
- int Counter;
- int Klen;
- int key_def;
- struct KEY_STACK *Spoint;
-
- Max_Key_len = 0;
- Counter = 0;
- key_def = kb__;
- while (key_def <= kf63__)
- {
- if (key_def == ke__)
- key_def = K1__;
- else if (key_def == (K5__ + 1))
- key_def = kcbt__;
- else if (key_def == (kcbt__ + 1))
- key_def = kbeg__;
- else if (key_def == (kUND__ + 1))
- key_def = kf11__;
- if (String_table[key_def] != NULL)
- {
- if (KEY_TOS == NULL)
- Spoint = KEY_TOS = (struct KEY_STACK *) malloc(sizeof(struct KEY_STACK));
- else
- {
- Spoint = KEY_TOS;
- while (Spoint->next != NULL)
- Spoint = Spoint->next;
- Spoint->next = (struct KEY_STACK *) malloc(sizeof(struct KEY_STACK));
- Spoint = Spoint->next;
- }
- Spoint->next = NULL;
- Spoint->element = (struct KEYS *) malloc(sizeof(struct KEYS));
- Spoint->element->string = String_table[key_def];
- Spoint->element->length = strlen(String_table[key_def]);
- Spoint->element->value = Key_vals[Counter];
- Klen = strlen(Spoint->element->string);
- if (Klen > Max_Key_len)
- Max_Key_len = Klen;
- /*
- | Some terminal types accept keystrokes of the form
- | \E[A and \EOA, substituting '[' for 'O'. Make a
- | duplicate of such key strings (since the
- | database will only have one version) so new_curse
- | can understand both.
- */
- if ((Spoint->element->length > 1) &&
- ((String_table[key_def][1] == '[') ||
- (String_table[key_def][1] == 'O')))
- {
- Spoint->next = (struct KEY_STACK *) malloc(sizeof(struct KEY_STACK));
- Spoint = Spoint->next;
- Spoint->next = NULL;
- Spoint->element = (struct KEYS *) malloc(sizeof(struct KEYS));
- Spoint->element->length = strlen(String_table[key_def]);
- Spoint->element->string = malloc(Spoint->element->length + 1);
- strcpy(Spoint->element->string, String_table[key_def]);
- Spoint->element->value = Key_vals[Counter];
- Klen = strlen(Spoint->element->string);
- if (Klen > Max_Key_len)
- Max_Key_len = Klen;
-
- if (String_table[key_def][1] == '[')
- Spoint->element->string[1] = 'O';
- else
- Spoint->element->string[1] = '[';
- }
- }
- key_def++;
- Counter++;
- }
-}
-
-#ifdef CAP
-char *
-String_Get(param) /* read the string */
-char *param;
-{
- char *String;
- char *Temp;
- int Counter;
-
- if (param == NULL)
- {
- while (*TERM_data_ptr != '=')
- TERM_data_ptr++;
- Temp = ++TERM_data_ptr;
- Counter = 1;
- while ((*Temp != ':') && (*Temp != (char)NULL))
- {
- Counter++;
- Temp++;
- }
- if (Counter == 1) /* no data */
- return(NULL);
- String = Temp = malloc(Counter);
- while ((*TERM_data_ptr != ':') && (*TERM_data_ptr != (char)NULL))
- {
- if (*TERM_data_ptr == '\\')
- {
- TERM_data_ptr++;
- if (*TERM_data_ptr == 'n')
- *Temp = '\n';
- else if (*TERM_data_ptr == 't')
- *Temp = '\t';
- else if (*TERM_data_ptr == 'b')
- *Temp = '\b';
- else if (*TERM_data_ptr == 'r')
- *Temp = '\r';
- else if (*TERM_data_ptr == 'f')
- *Temp = '\f';
- else if ((*TERM_data_ptr == 'e') || (*TERM_data_ptr == 'E'))
- *Temp = '\033'; /* escape */
- else if (*TERM_data_ptr == '\\')
- *Temp = '\\';
- else if (*TERM_data_ptr == '\'')
- *Temp = '\'';
- else if ((*TERM_data_ptr >= '0') && (*TERM_data_ptr <= '9'))
- {
- Counter = 0;
- while ((*TERM_data_ptr >= '0') && (*TERM_data_ptr <= '9'))
- {
- Counter = (8 * Counter) + (*TERM_data_ptr - '0');
- TERM_data_ptr++; /* ? */
- }
- *Temp = Counter;
- TERM_data_ptr--;
- }
- TERM_data_ptr++;
- Temp++;
- }
- else if (*TERM_data_ptr == '^')
- {
- TERM_data_ptr++;
- if ((*TERM_data_ptr >= '@') && (*TERM_data_ptr <= '_'))
- *Temp = *TERM_data_ptr - '@';
- else if (*TERM_data_ptr == '?')
- *Temp = 127;
- TERM_data_ptr++;
- Temp++;
- }
- else
- *Temp++ = *TERM_data_ptr++;
- }
- *Temp = (char)NULL;
- param = String;
- }
- else
- {
- while ((*TERM_data_ptr != (char)NULL) && (*TERM_data_ptr != ':'))
- TERM_data_ptr++;
- }
- return(param);
-}
-
-int
-tc_Get_int(param) /* read the integer */
-int param;
-{
- int Itemp;
-
- if (param == 0)
- {
- while ((*TERM_data_ptr != (char)NULL) && (*TERM_data_ptr != '#'))
- TERM_data_ptr++;
- TERM_data_ptr++;
- Itemp = AtoI();
- param = Itemp;
- }
- else
- {
- while (*TERM_data_ptr != ':')
- TERM_data_ptr++;
- }
- return(param);
-}
-
-void
-Find_term() /* find terminal description in termcap file */
-{
- char *Name;
- char *Ftemp;
-
- Ftemp = Name = malloc(strlen(TERMINAL_TYPE + 1) + 1);
- strcpy(Name, TERMINAL_TYPE);
- while (*Ftemp != (char)NULL)
- Ftemp++;
- *Ftemp++ = '|';
- *Ftemp = (char)NULL;
- CFOUND = FALSE;
- Data_Line_len = strlen(TERMINAL_TYPE) + 1;
- while ((!CFOUND) && ((TERM_data_ptr=fgets(Data_Line, 512, TFP)) != NULL))
- {
- if ((*TERM_data_ptr != ' ') && (*TERM_data_ptr != '\t') && (*TERM_data_ptr != '#'))
- {
- while ((!CFOUND) && (*TERM_data_ptr != (char)NULL))
- {
- CFOUND = !strncmp(TERM_data_ptr, Name, Data_Line_len);
- while ((*TERM_data_ptr != (char)NULL) && (*TERM_data_ptr != '|') && (*TERM_data_ptr != '#') && (*TERM_data_ptr != ':'))
- TERM_data_ptr++;
- if (*TERM_data_ptr == '|')
- TERM_data_ptr++;
- else if (!CFOUND)
- *TERM_data_ptr = (char)NULL;
- }
- }
- }
- if (!CFOUND)
- {
- printf("terminal type %s not found\n", TERMINAL_TYPE);
- exit(0);
- }
-}
-
-void
-CAP_PARSE() /* parse off the data in the termcap data file */
-{
- int offset;
- int found;
-
- do
- {
- while (*TERM_data_ptr != (char)NULL)
- {
- for (found = FALSE, offset = 0; (!found) && (offset < 26); offset++)
- {
- if (!strncmp(TERM_data_ptr, Boolean_names[offset], 2))
- {
- found = TRUE;
- Booleans[offset] = TRUE;
- }
- }
- if (!found)
- {
- for (found = FALSE, offset = 0; (!found) && (offset < lw__); offset++)
- {
- if (!strncmp(TERM_data_ptr, Number_names[offset], 3))
- {
- found = TRUE;
- Numbers[offset] = tc_Get_int(Numbers[offset]);
- }
- }
- }
- if (!found)
- {
- for (found = FALSE, offset = 0; (!found) && (offset < smgr__); offset++)
- {
- if (!strncmp(TERM_data_ptr, String_names[offset], 3))
- {
- found = TRUE;
- String_table[offset] = String_Get(String_table[offset]);
- }
- }
- }
-
- if (!strncmp(TERM_data_ptr, "tc=", 3))
- tc_ = String_Get(NULL);
- while ((*TERM_data_ptr != ':') && (*TERM_data_ptr != (char)NULL))
- TERM_data_ptr++;
- if (*TERM_data_ptr == ':')
- TERM_data_ptr++;
- }
- } while (((TERM_data_ptr = fgets(Data_Line, 512, TFP)) != NULL) && ((*TERM_data_ptr == ' ') || (*TERM_data_ptr == '\t')));
- if (tc_ != NULL)
- {
- TERMINAL_TYPE = tc_;
- rewind(TFP);
- Find_term();
- free(tc_);
- tc_ = NULL;
- CAP_PARSE();
- }
- else
- fclose(TFP);
-}
-#endif /* ifdef CAP */
-
-struct _line *
-Screenalloc(columns)
-int columns;
-{
- int i;
- struct _line *tmp;
-
- tmp = (struct _line *) malloc(sizeof (struct _line));
- tmp->row = malloc(columns + 1);
- tmp->attributes = malloc(columns + 1);
- tmp->prev_screen = NULL;
- tmp->next_screen = NULL;
- for (i = 0; i < columns; i++)
- {
- tmp->row[i] = ' ';
- tmp->attributes[i] = (char) NULL;
- }
- tmp->scroll = tmp->changed = FALSE;
- tmp->row[0] = (char) NULL;
- tmp->attributes[0] = (char) NULL;
- tmp->row[columns] = (char) NULL;
- tmp->attributes[columns] = (char) NULL;
- tmp->last_char = 0;
- return(tmp);
-}
-
-WINDOW *newwin(lines, cols, start_l, start_c)
-int lines, cols; /* number of lines and columns to be in window */
-int start_l, start_c; /* starting line and column to be inwindow */
-{
- WINDOW *Ntemp;
- struct _line *temp_screen;
- int i;
-
- Ntemp = (WINDOW *) malloc(sizeof(WINDOW));
- Ntemp->SR = start_l;
- Ntemp->SC = start_c;
- Ntemp->Num_lines = lines;
- Ntemp->Num_cols = cols;
- Ntemp->LX = 0;
- Ntemp->LY = 0;
- Ntemp->scroll_down = Ntemp->scroll_up = 0;
- Ntemp->SCROLL_CLEAR = FALSE;
- Ntemp->Attrib = FALSE;
- Ntemp->first_line = temp_screen = Screenalloc(cols);
- Ntemp->first_line->number = 0;
- for (i = 1; i < lines; i++)
- {
- temp_screen->next_screen = Screenalloc(cols);
- temp_screen->next_screen->number = i;
- temp_screen->next_screen->prev_screen = temp_screen;
- temp_screen = temp_screen->next_screen;
- }
- Ntemp->first_line->prev_screen = NULL;
- temp_screen->next_screen = NULL;
- return(Ntemp);
-}
-
-#ifdef CAP
-void
-Cap_Out(string, p_list, place) /* interpret the output string if necessary */
-char *string;
-int p_list[]; /* stack of values */
-int place; /* place keeper of top of stack */
-{
- char *Otemp; /* temporary string pointer to parse output */
- int delay;
- int p1, p2, temp;
- float chars;
-
- if (string == NULL)
- return;
-
- if (p_list != NULL)
- {
- p1 = p_list[--place];
- p2 = p_list[--place];
- }
- delay = 0;
- Otemp = string;
- if ((*Otemp >= '0') && (*Otemp <= '9'))
- {
- delay = atoi(Otemp);
- while ((*Otemp >= '0') && (*Otemp <= '9'))
- Otemp++;
- if (*Otemp == '*')
- Otemp++;
- }
- while (*Otemp != (char)NULL)
- {
- if (*Otemp == '%')
- {
- Otemp++;
- if ((*Otemp == 'd') || (*Otemp == '2') || (*Otemp == '3') || (*Otemp == '.') || (*Otemp == '+'))
- {
- if (*Otemp == 'd')
- printf("%d", p1);
- else if (*Otemp == '2')
- printf("%02d", p1);
- else if (*Otemp == '3')
- printf("%03d", p1);
- else if (*Otemp == '+')
- {
- Otemp++;
- p1 += *Otemp;
- putchar(p1);
- }
- else if (*Otemp == '.')
- putchar(p1);
- p1 = p2;
- p2 = 0;
- }
- else if (*Otemp == '>')
- {
- Otemp++;
- if (p1 > *Otemp)
- {
- Otemp++;
- p1 += *Otemp;
- }
- else
- Otemp++;
- }
- else if (*Otemp == 'r')
- {
- temp = p1;
- p1 = p2;
- p2 = temp;
- }
- else if (*Otemp == 'i')
- {
- p1++;
- p2++;
- }
- else if (*Otemp == '%')
- putchar(*Otemp);
- else if (*Otemp == 'n')
- {
- p1 ^= 0140;
- p2 ^= 0140;
- }
- else if (*Otemp == 'B')
- {
- p1 = (16 * (p1/10)) + (p1 % 10);
- p2 = (16 * (p2/10)) + (p2 % 10);
- }
- else if (*Otemp == 'D')
- {
- p1 = (p1 - 2 * (p1 % 16));
- p2 = (p2 - 2 * (p2 % 16));
- }
- }
- else
- putchar (*Otemp);
- Otemp++;
- }
- if (delay != 0)
- {
- chars = delay * chars_per_millisecond;
- delay = chars;
- if ((chars - delay) > 0.0)
- delay++;
- for (; delay > 0; delay--)
- putchar(*String_table[pc__]);
- }
- fflush(stdout);
-}
-
-#else
-
- char *Otemp; /* temporary string pointer to parse output */
- float chars;
- int p[10];
- int variable[27];
-
-int
-Operation(Temp_Stack, place) /* handle conditional operations */
-int Temp_Stack[];
-int place;
-{
- int temp;
-
- if (*Otemp == 'd')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- printf("%d", temp);
- }
- else if (!strncmp(Otemp, "2d", 2))
- {
- temp = Temp_Stack[--place];
- printf("%2d", temp);
- Otemp++;
- Otemp++;
- }
- else if (!strncmp(Otemp, "3d", 2))
- {
- temp = Temp_Stack[--place];
- printf("%0d", temp);
- Otemp++;
- Otemp++;
- }
- else if (!strncmp(Otemp, "02d", 3))
- {
- temp = Temp_Stack[--place];
- printf("%02d", temp);
- Otemp++;
- Otemp++;
- Otemp++;
- }
- else if (!strncmp(Otemp, "03d", 3))
- {
- temp = Temp_Stack[--place];
- printf("%03d", temp);
- Otemp++;
- Otemp++;
- Otemp++;
- }
- else if (*Otemp == '+')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp += Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '-')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp -= Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '*')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp *= Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '/')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp /= Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == 'm')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp %= Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '&')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp &= Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '|')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp |= Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '^')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp ^= Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '=')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp = (temp == Temp_Stack[--place]);
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '>')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp = temp > Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == '<')
- {
- Otemp++;
- temp = Temp_Stack[--place];
- temp = temp < Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- }
- else if (*Otemp == 'c')
- {
- Otemp++;
- putchar(Temp_Stack[--place]);
- }
- else if (*Otemp == 'i')
- {
- Otemp++;
- p[1]++;
- p[2]++;
- }
- else if (*Otemp == '%')
- {
- putchar(*Otemp);
- Otemp++;
- }
- else if (*Otemp == '!')
- {
- temp = ! Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- Otemp++;
- }
- else if (*Otemp == '~')
- {
- temp = ~Temp_Stack[--place];
- Temp_Stack[place++] = temp;
- Otemp++;
- }
- else if (*Otemp == 'p')
- {
- Otemp++;
- Temp_Stack[place++] = p[*Otemp - '0'];
- Otemp++;
- }
- else if (*Otemp == 'P')
- {
- Otemp++;
- Temp_Stack[place++] = variable[*Otemp - 'a'];
- Otemp++;
- }
- else if (*Otemp == 'g')
- {
- Otemp++;
- variable[*Otemp - 'a'] = Temp_Stack[--place];
- Otemp++;
- }
- else if (*Otemp == '\'')
- {
- Otemp++;
- Temp_Stack[place++] = *Otemp;
- Otemp++;
- Otemp++;
- }
- else if (*Otemp == '{')
- {
- Otemp++;
- temp = atoi(Otemp);
- Temp_Stack[place++] = temp;
- while (*Otemp != '}')
- Otemp++;
- Otemp++;
- }
- return(place);
-}
-
-void
-Info_Out(string, p_list, place) /* interpret the output string if necessary */
-char *string;
-int p_list[];
-int place;
-{
- char *tchar;
- int delay;
- int temp;
- int Cond_FLAG;
- int EVAL;
- int Cond_Stack[128];
- int Cond_place;
- int Stack[128];
- int Top_of_stack;
-
- if (string == NULL)
- return;
-
- Cond_FLAG = FALSE;
- Cond_place = 0;
- Top_of_stack = 0;
- p[0] = 0;
- p[1] = 0;
- p[2] = 0;
- p[3] = 0;
- p[4] = 0;
- p[5] = 0;
- p[6] = 0;
- p[7] = 0;
- p[8] = 0;
- p[9] = 0;
- if (p_list != NULL)
- {
- for (temp = 1; (place != 0); temp++)
- {
- p[temp] = p_list[--place];
- }
- }
- delay = 0;
- Otemp = string;
- while (*Otemp != (char) NULL)
- {
- if (*Otemp == '%')
- {
- Otemp++;
- if ((*Otemp == '?') || (*Otemp == 't') || (*Otemp == 'e') || (*Otemp == ';'))
- {
- if (*Otemp == '?')
- {
- Otemp++;
- Cond_FLAG = TRUE;
- EVAL = TRUE;
- while (EVAL)
- {
- /*
- | find the end of the
- | conditional statement
- */
- while ((strncmp(Otemp, "%t", 2)) && (*Otemp != (char) NULL))
- {
- /*
- | move past '%'
- */
- Otemp++;
- Cond_place = Operation(Cond_Stack, Cond_place);
- }
-
- /*
- | if condition is true
- */
- if ((Cond_place > 0) && (Cond_Stack[Cond_place-1]))
- {
- /*
- | end conditional
- | parsing
- */
- EVAL = FALSE;
- Otemp++;
- Otemp++;
- }
- else /* condition is false */
- {
- /*
- | find 'else' or end
- | of if statement
- */
- while ((strncmp(Otemp, "%e", 2)) && (strncmp(Otemp, "%;", 2)) && (*Otemp != (char) NULL))
- Otemp++;
- /*
- | if an 'else' found
- */
- if ((*Otemp != (char) NULL) && (!strncmp(Otemp, "%e", 2)))
- {
- Otemp++;
- Otemp++;
- tchar = Otemp;
- /*
- | check for 'then' part
- */
- while ((*tchar != (char) NULL) && (strncmp(tchar, "%t", 2)) && (strncmp(tchar, "%;", 2)))
- tchar++;
- /*
- | if end of string
- */
- if (*tchar == (char) NULL)
- {
- EVAL = FALSE;
- Cond_FLAG = FALSE;
- Otemp = tchar;
- }
- /*
- | if end of if found,
- | set up to parse
- | info
- */
- else if (!strncmp(tchar, "%;", 2))
- EVAL = FALSE;
- /*
- | otherwise, check
- | conditional in
- | 'else'
- */
- }
- /*
- | if end of if found,
- | get out of if
- | statement
- */
- else if ((*Otemp != (char) NULL) && (!strncmp(Otemp, "%;", 2)))
- {
- EVAL = FALSE;
- Otemp++;
- Otemp++;
- }
- else /* Otemp == NULL */
- {
- EVAL = FALSE;
- Cond_FLAG = FALSE;
- }
- }
- }
- }
- else
- {
- Otemp++;
- Cond_FLAG = FALSE;
- if (*Otemp != ';')
- {
- while ((*Otemp != (char) NULL) && (strncmp(Otemp, "%;", 2)))
- Otemp++;
- if (*Otemp != (char) NULL)
- {
- Otemp++;
- Otemp++;
- }
- }
- else
- Otemp++;
- }
- }
- else
- {
- Top_of_stack = Operation(Stack, Top_of_stack);
- }
- }
- else if (!strncmp(Otemp, "$<", 2))
- {
- Otemp++;
- Otemp++;
- delay = atoi(Otemp);
- while (*Otemp != '>')
- Otemp++;
- Otemp++;
- chars = delay * chars_per_millisecond;
- delay = chars;
- if ((chars - delay) > 0.0)
- delay++;
- if (String_table[pc__] == NULL)
- temp = 0;
- else
- temp = *String_table[pc__];
- for (; delay > 0; delay--)
- putc(temp, stdout);
- }
- else
- {
- putchar(*Otemp);
- Otemp++;
- }
- }
- fflush(stdout);
-}
-#endif
-
-void
-wmove(window, row, column) /* move cursor to indicated position in window */
-WINDOW *window;
-int row, column;
-{
- if ((row < window->Num_lines) && (column < window->Num_cols))
- {
- window->LX = column;
- window->LY = row;
- }
-}
-
-void
-clear_line(line, column, cols)
-struct _line *line;
-int column;
-int cols;
-{
- int j;
-
- if (column > line->last_char)
- line->row[line->last_char] = ' ';
- line->last_char = column;
- line->row[column] = (char) NULL;
- line->attributes[column] = (char) NULL;
- line->changed = TRUE;
- for (j = column + 1; j < cols; j++)
- {
- line->row[j] = ' ';
- line->attributes[j] = (char) NULL;
- }
-}
-
-void
-werase(window) /* clear the specified window */
-WINDOW *window;
-{
- int i;
- struct _line *tmp;
-
- window->SCROLL_CLEAR = CLEAR;
- window->scroll_up = window->scroll_down = 0;
- for (i = 0, tmp = window->first_line; i < window->Num_lines; i++, tmp = tmp->next_screen)
- clear_line(tmp, 0, window->Num_cols);
-}
-
-void
-wclrtoeol(window) /* erase from current cursor position to end of line */
-WINDOW *window;
-{
- int column, row;
- struct _line *tmp;
-
- window->SCROLL_CLEAR = CHANGE;
- column = window->LX;
- row = window->LY;
- for (row = 0, tmp = window->first_line; row < window->LY; row++)
- tmp = tmp->next_screen;
- clear_line(tmp, column, window->Num_cols);
-}
-
-void
-wrefresh(window) /* flush all previous output */
-WINDOW *window;
-{
- wnoutrefresh(window);
-#ifdef DIAG
-{
- struct _line *temp;
- int value;
- fprintf(stderr, "columns=%d, lines=%d, SC=%d, SR=%d\n",window->Num_cols, window->Num_lines, window->SC, window->SR);
- for (value = 0, temp = window->first_line; value < window->Num_lines; value++, temp = temp->next_screen)
- {
- if (temp->number == -1)
- fprintf(stderr, "line moved ");
- if (temp->scroll)
- fprintf(stderr, "scroll_x is set: ");
- fprintf(stderr, "lc%d=%s|\n", temp->last_char, temp->row);
- }
- fprintf(stderr, "+-------------------- virtual screen ----------------------------------------+\n");
- fprintf(stderr, "columns=%d, lines=%d \n",virtual_scr->Num_cols, virtual_scr->Num_lines);
- for (value = 0, temp = virtual_scr->first_line; value < virtual_scr->Num_lines; value++, temp = temp->next_screen)
- {
- if (temp->number == -1)
- fprintf(stderr, "line moved ");
- if (temp->scroll)
- fprintf(stderr, "scroll_x is set: ");
- fprintf(stderr, "lc%d=%s|\n", temp->last_char, temp->row);
- }
- fprintf(stderr, "columns=%d, lines=%d \n",curscr->Num_cols, curscr->Num_lines);
- for (value = 0, temp = curscr->first_line; value < curscr->Num_lines; value++, temp = temp->next_screen)
- fprintf(stderr, "line=%s|\n", temp->row);
-}
-#endif
- doupdate();
- virtual_scr->SCROLL_CLEAR = FALSE;
- virtual_scr->scroll_down = virtual_scr->scroll_up = 0;
- fflush(stdout);
-}
-
-void
-touchwin(window)
-WINDOW *window;
-{
- struct _line *user_line;
- int line_counter = 0;
-
- for (line_counter = 0, user_line = window->first_line;
- line_counter < window->Num_lines; line_counter++)
- {
- user_line->changed = TRUE;
- }
- window->SCROLL_CLEAR = TRUE;
-}
-
-void
-wnoutrefresh(window)
-WINDOW *window;
-{
- struct _line *user_line;
- struct _line *virtual_line;
- int line_counter = 0;
- int user_col = 0;
- int virt_col = 0;
-
- if (window->SR >= virtual_scr->Num_lines)
- return;
- user_line = window->first_line;
- virtual_line = virtual_scr->first_line;
- virtual_scr->SCROLL_CLEAR = window->SCROLL_CLEAR;
- virtual_scr->LX = window->LX + window->SC;
- virtual_scr->LY = window->LY + window->SR;
- virtual_scr->scroll_up = window->scroll_up;
- virtual_scr->scroll_down = window->scroll_down;
- if ((last_window_refreshed == window) && (!window->SCROLL_CLEAR))
- return;
- for (line_counter = 0; line_counter < window->SR; line_counter++)
- {
- virtual_line = virtual_line->next_screen;
- }
- for (line_counter = 0; (line_counter < window->Num_lines)
- && ((line_counter + window->SR) < virtual_scr->Num_lines);
- line_counter++)
- {
- if ((last_window_refreshed != window) || (user_line->changed) || ((SCROLL | CLEAR) & window->SCROLL_CLEAR))
- {
- for (user_col = 0, virt_col = window->SC;
- (virt_col < virtual_scr->Num_cols)
- && (user_col < window->Num_cols);
- virt_col++, user_col++)
- {
- virtual_line->row[virt_col] = user_line->row[user_col];
- virtual_line->attributes[virt_col] = user_line->attributes[user_col];
- }
- }
- if (virtual_scr->Num_cols != window->Num_cols)
- {
- if (virtual_line->last_char < (user_line->last_char + window->SC))
- {
- if (virtual_line->row[virtual_line->last_char] == (char) NULL)
- virtual_line->row[virtual_line->last_char] = ' ';
- virtual_line->last_char =
- min(virtual_scr->Num_cols,
- (user_line->last_char + window->SC));
- }
- else if (virtual_line->last_char > (user_line->last_char + window->SC))
- {
- virtual_line->row[min(virtual_scr->Num_cols,
- (user_line->last_char + window->SC))] = ' ';
- }
- }
- else
- virtual_line->last_char = user_line->last_char;
- virtual_line->row[virtual_line->last_char] = (char) NULL;
- virtual_line->changed = user_line->changed;
- virtual_line = virtual_line->next_screen;
- user_line = user_line->next_screen;
- }
- window->SCROLL_CLEAR = FALSE;
- window->scroll_up = window->scroll_down = 0;
- last_window_refreshed = window;
-}
-
-void
-flushinp() /* flush input */
-{
-}
-
-void
-ungetch(c) /* push a character back on input */
-int c;
-{
- if (bufp < 100)
- in_buff[bufp++] = c;
-}
-
-#ifdef BSD_SELECT
-int
-timed_getchar()
-{
- struct timeval tv;
- fd_set fds;
- int ret_val;
- int nfds = 1;
- char temp;
-
- FD_ZERO(&fds);
- tv.tv_sec = 0;
- tv.tv_usec = 500000; /* half a second */
- FD_SET(0, &fds);
- Time_Out = FALSE; /* just in case */
-
- ret_val = select(nfds, &fds, 0, 0, &tv);
-
- /*
- | if ret_val is less than zero, there was no input
- | otherwise, get a character and return it
- */
-
- if (ret_val <= 0)
- {
- Time_Out = TRUE;
- return(-1);
- }
-
- return(read(0, &temp, 1)? temp : -1);
-}
-#endif
-
-int
-wgetch(window) /* get character from specified window */
-WINDOW *window;
-{
- int in_value;
- char temp;
-#ifndef SYS5
- int old_arg;
-#endif /* SYS5 */
-
-#ifdef BSD_SELECT
- if (Noblock)
- in_value = ((bufp > 0) ? in_buff[--bufp] : timed_getchar());
- else
- in_value = ((bufp > 0) ? in_buff[--bufp] : read(0, &temp, 1)? temp : -1);
-#else /* BSD_SELECT */
-#ifdef SYS5
- in_value = ((bufp > 0) ? in_buff[--bufp] :
- (read(0, &temp, 1)> 0) ? temp : -1);
-#else /* SYS5 */
- if (Noblock)
- {
- Time_Out = FALSE;
- old_arg = fcntl(0, F_GETFL, 0);
- in_value = fcntl(0, F_SETFL, old_arg | FNDELAY);
- }
- in_value = ((bufp > 0) ? in_buff[--bufp] : read(0, &temp, 1)? temp : -1);
- if (Noblock)
- {
- fcntl(0, F_SETFL, old_arg);
- if (Time_Out)
- in_value = -1;
- }
-#endif /* SYS5 */
-#endif /* BSD_SELECT */
-
- if (in_value != -1)
- {
- in_value &= 0xff;
- if ((Parity) && (Num_bits < 8))
- /* strip eighth bit if parity in use */
- in_value &= 0177;
- }
- else if (interrupt_flag)
- {
- interrupt_flag = FALSE;
- in_value = wgetch(window);
- }
-
- if ((in_value == '\033') || (in_value == '\037'))/* escape character */
- in_value = Get_key(in_value);
- return(in_value);
-}
-
-#ifndef BSD_SELECT
-void
-Clear(arg) /* notify that time out has occurred */
-int arg;
-{
- Time_Out = TRUE;
-#ifdef DEBUG
-fprintf(stderr, "inside Clear()\n");
-fflush(stderr);
-#endif /* DEBUG */
-}
-#endif /* BSD_SELECT */
-
-int
-Get_key(first_char) /* try to decode key sequence */
-int first_char; /* first character of sequence */
-{
- int in_char;
- int Count;
- char string[128];
- char *Gtemp;
- int Found;
-#ifdef SYS5
- struct termio Gterminal;
-#else
- struct sgttyb Gterminal;
-#endif
- struct KEY_STACK *St_point;
-#if (!defined( BSD_SELECT)) || (!defined(SYS5))
- int value;
-#endif /* BSD_SELECT */
-
- Count = 0;
- Gtemp = string;
- string[Count++] = first_char;
- string[Count] = (char) NULL;
- Time_Out = FALSE;
-#ifndef BSD_SELECT
- signal(SIGALRM, Clear);
- value = alarm(1);
-#endif /* BSD_SELECT */
- Noblock = TRUE;
-#ifdef SYS5
- Gterminal.c_cc[VTIME] = 0; /* timeout value */
- Gterminal.c_lflag &= ~ICANON; /* disable canonical operation */
- Gterminal.c_lflag &= ~ECHO; /* disable echo */
-#endif
- Count = 1;
- Found = FALSE;
- while ((Count < Max_Key_len) && (!Time_Out) && (!Found))
- {
- in_char = wgetch(stdscr);
-#ifdef DEBUG
-fprintf(stderr, "back in GetKey()\n");
-fflush(stderr);
-#endif /* DEBUG */
- if (in_char != -1)
- {
- string[Count++] = in_char;
- string[Count] = (char) NULL;
- St_point = KEY_TOS;
- while ((St_point != NULL) && (!Found))
- {
- if (!strcmp(string, St_point->element->string))
- Found = TRUE;
- else
- St_point = St_point->next;
- }
- }
- }
-#ifndef BSD_SELECT
- if (!Time_Out)
- value = alarm(0);
-#endif /* BSD_SELECT */
-#ifdef SYS5
-/* value = ioctl(0, TCSETA, &Terminal);*/
-#else
- value = ioctl(0, TIOCSETP, &Terminal);
-/* value = fcntl(0, F_SETFL, old_arg);*/
-#endif
- Noblock = FALSE;
- if (Found)
- {
- return(St_point->element->value);
- }
- else
- {
- while (Count > 1)
- {
- if ((string[--Count] != -1) &&
- ((unsigned char) (string[Count]) != 255))
- {
-#ifdef DIAG
-fprintf(stderr, "ungetting character %d\n", string[Count]);fflush(stdout);
-#endif
- ungetch(string[Count]);
- }
- }
- return(first_char);
- }
-}
-
-void
-waddch(window, c) /* output the character in the specified window */
-WINDOW *window;
-int c;
-{
- int row, column;
- int shift; /* number of spaces to shift if a tab */
- struct _line *tmpline;
-
-#ifdef DIAG
-/*printf("starting waddch \n");fflush(stdout);*/
-#endif
- row = window->LY;
- column = window->LX;
- if (c == '\t')
- {
- shift = (column + 1) % 8;
- if (shift == 0)
- shift++;
- else
- shift = 9 - shift;
- while (shift > 0)
- {
- shift--;
- waddch(window, ' ');
- }
- }
- else if ((column < window->Num_cols) && (row < window->Num_lines))
- {
- if ((c == '~') && (Booleans[hz__]))
- c = '@';
-
- if (( c != '\b') && (c != '\n') && (c != '\r'))
- {
- row = 0;
- tmpline = window->first_line;
- while (row < window->LY)
- {
- row++;
- tmpline = tmpline->next_screen;
- }
- tmpline->row[column] = c;
- tmpline->attributes[column] = window->Attrib;
- tmpline->changed = TRUE;
- if (column >= tmpline->last_char)
- {
- if (column > tmpline->last_char)
- tmpline->row[tmpline->last_char] = ' ';
- tmpline->row[column + 1] = (char) NULL;
- tmpline->attributes[column + 1] = (char) NULL;
- tmpline->last_char = column + 1;
- }
- }
- if (c == '\n')
- {
- wclrtoeol(window);
- window->LX = window->Num_cols;
- }
- else if (c == '\r')
- window->LX = 0;
- else if (c == '\b')
- window->LX--;
- else
- window->LX++;
- }
- if (window->LX >= window->Num_cols)
- {
- window->LX = 0;
- window->LY++;
- if (window->LY >= window->Num_lines)
- {
- window->LY = window->Num_lines - 1;
-/* window->LY = row;
- wmove(window, 0, 0);
- wdeleteln(window);
- wmove(window, row, 0);*/
- }
- }
- window->SCROLL_CLEAR = CHANGE;
-}
-
-void
-winsertln(window) /* insert a blank line into the specified window */
-WINDOW *window;
-{
- int row, column;
- struct _line *tmp;
- struct _line *tmp1;
-
- window->scroll_down += 1;
- window->SCROLL_CLEAR = SCROLL;
- column = window->LX;
- row = window->LY;
- for (row = 0, tmp = window->first_line; (row < window->Num_lines) && (tmp->next_screen != NULL); row++)
- tmp = tmp->next_screen;
- if (tmp->prev_screen != NULL)
- tmp->prev_screen->next_screen = NULL;
- tmp1 = tmp;
- clear_line(tmp1, 0, window->Num_cols);
- tmp1->number = -1;
- for (row = 0, tmp = window->first_line; (row < window->LY) && (tmp->next_screen != NULL); row++)
- tmp = tmp->next_screen;
- if ((window->LY == (window->Num_lines - 1)) && (window->Num_lines > 1))
- {
- tmp1->next_screen = tmp->next_screen;
- tmp->next_screen = tmp1;
- tmp->changed = TRUE;
- tmp->next_screen->prev_screen = tmp;
- }
- else if (window->Num_lines > 1)
- {
- if (tmp->prev_screen != NULL)
- tmp->prev_screen->next_screen = tmp1;
- tmp1->prev_screen = tmp->prev_screen;
- tmp->prev_screen = tmp1;
- tmp1->next_screen = tmp;
- tmp->changed = TRUE;
- tmp->scroll = DOWN;
- }
- if (window->LY == 0)
- window->first_line = tmp1;
-}
-
-void
-wdeleteln(window) /* delete a line in the specified window */
-WINDOW *window;
-{
- int row, column;
- struct _line *tmp;
- struct _line *tmpline;
-
- if (window->Num_lines > 1)
- {
- window->scroll_up += 1;
- window->SCROLL_CLEAR = SCROLL;
- column = window->LX;
- row = window->LY;
- for (row = 0, tmp = window->first_line; row < window->LY; row++)
- tmp = tmp->next_screen;
- if (window->LY == 0)
- window->first_line = tmp->next_screen;
- if (tmp->prev_screen != NULL)
- tmp->prev_screen->next_screen = tmp->next_screen;
- if (tmp->next_screen != NULL)
- {
- tmp->next_screen->changed = TRUE;
- tmp->next_screen->scroll = UP;
- tmp->next_screen->prev_screen = tmp->prev_screen;
- }
- tmpline = tmp;
- clear_line(tmpline, 0, window->Num_cols);
- tmpline->number = -1;
- for (row = 0, tmp = window->first_line; tmp->next_screen != NULL; row++)
- tmp = tmp->next_screen;
- if (tmp != NULL)
- {
- tmp->next_screen = tmpline;
- tmp->next_screen->prev_screen = tmp;
- tmp->changed = TRUE;
- tmp = tmp->next_screen;
- }
- else
- tmp = tmpline;
- tmp->next_screen = NULL;
- }
- else
- {
- clear_line(window->first_line, 0, window->Num_cols);
- }
-}
-
-void
-wclrtobot(window) /* delete from current position to end of the window */
-WINDOW *window;
-{
- int row, column;
- struct _line *tmp;
-
- window->SCROLL_CLEAR |= CLEAR;
- column = window->LX;
- row = window->LY;
- for (row = 0, tmp = window->first_line; row < window->LY; row++)
- tmp = tmp->next_screen;
- clear_line(tmp, column, window->Num_cols);
- for (row = (window->LY + 1); row < window->Num_lines; row++)
- {
- tmp = tmp->next_screen;
- clear_line(tmp, 0, window->Num_cols);
- }
- wmove(window, row, column);
-}
-
-void
-wstandout(window) /* begin standout mode in window */
-WINDOW *window;
-{
- if (Numbers[sg__] < 1) /* if not magic cookie glitch */
- window->Attrib |= A_STANDOUT;
-}
-
-void
-wstandend(window) /* end standout mode in window */
-WINDOW *window;
-{
- window->Attrib &= ~A_STANDOUT;
-}
-
-void
-waddstr(window, string) /* write 'string' in window */
-WINDOW *window;
-char *string;
-{
- char *wstring;
-
- for (wstring = string; *wstring != (char) NULL; wstring++)
- waddch(window, *wstring);
-}
-
-void
-clearok(window, flag) /* erase screen and redraw at next refresh */
-WINDOW *window;
-int flag;
-{
- Repaint_screen = TRUE;
-}
-
-void
-echo() /* turn on echoing */
-{
- int value;
-
-#ifdef SYS5
- Terminal.c_lflag |= ECHO; /* enable echo */
- value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
-#else
- Terminal.sg_flags |= ECHO; /* enable echo */
- value = ioctl(0, TIOCSETP, &Terminal); /* set characteristics */
-#endif
-}
-
-void
-noecho() /* turn off echoing */
-{
- int value;
-
-#ifdef SYS5
- Terminal.c_lflag &= ~ECHO; /* disable echo */
- value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
-#else
- Terminal.sg_flags &= ~ECHO; /* disable echo */
- value = ioctl(0, TIOCSETP, &Terminal); /* set characteristics */
-#endif
-}
-
-void
-raw() /* set to read characters immediately */
-{
- int value;
-
-#ifdef SYS5
- Intr = Terminal.c_cc[VINTR]; /* get the interrupt character */
- Terminal.c_lflag &= ~ICANON; /* disable canonical operation */
- Terminal.c_lflag &= ~ISIG; /* disable signal checking */
-#ifdef FLUSHO
- Terminal.c_lflag &= ~FLUSHO;
-#endif
-#ifdef PENDIN
- Terminal.c_lflag &= ~PENDIN;
-#endif
-#ifdef IEXTEN
- Terminal.c_lflag &= ~IEXTEN;
-#endif
- Terminal.c_cc[VMIN] = 1; /* minimum of one character */
- Terminal.c_cc[VTIME] = 255; /* timeout value */
- Terminal.c_cc[VINTR] = 0; /* eliminate interrupt */
- value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
-#else
- Terminal.sg_flags |= RAW; /* enable raw mode */
- value = ioctl(0, TIOCSETP, &Terminal); /* set characteristics */
-#endif
-}
-
-void
-noraw() /* set to normal character read mode */
-{
- int value;
-
-#ifdef SYS5
- Terminal.c_lflag |= ICANON; /* enable canonical operation */
- Terminal.c_lflag |= ISIG; /* enable signal checking */
- Terminal.c_cc[VEOF] = 4; /* EOF character = 4 */
- Terminal.c_cc[VEOL] = (char) NULL; /* EOL = 0 */
- Terminal.c_cc[VINTR] = Intr; /* reset interrupt char */
- value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
-#else
- Terminal.sg_flags &= ~RAW; /* disable raw mode */
- value = ioctl(0, TIOCSETP, &Terminal); /* set characteristics */
-/* old_arg = fcntl(0, F_GETFL, 0);
- value = fcntl(0, F_SETFL, old_arg & ~FNDELAY);*/
-#endif
-}
-
-void
-nl()
-{
- int value;
-
-#ifdef SYS5
- Terminal.c_iflag |= ICRNL; /* enable carriage-return to line-feed mapping */
- value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
-#endif
-}
-
-void
-nonl()
-{
- int value;
-
-#ifdef SYS5
- Terminal.c_iflag &= ~ICRNL; /* disable carriage-return to line-feed mapping */
- Terminal.c_iflag &= ~IGNCR; /* do not ignore carriage-return */
- value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
-#endif
-}
-
-void
-saveterm()
-{
-}
-
-void
-fixterm()
-{
-}
-
-void
-resetterm()
-{
-}
-
-void
-nodelay(window, flag)
-WINDOW *window;
-int flag;
-{
-}
-
-void
-idlok(window, flag)
-WINDOW *window;
-int flag;
-{
-}
-
-void
-keypad(window, flag)
-WINDOW *window;
-int flag;
-{
- if (flag)
- String_Out(String_table[ks__], NULL, 0);
- else
- String_Out(String_table[ke__], NULL, 0);
-}
-
-void
-savetty() /* save current tty stats */
-{
- int value;
-
-#ifdef SYS5
- value = ioctl(0, TCGETA, &Saved_tty); /* set characteristics */
-#else
- value = ioctl(0, TIOCGETP, &Saved_tty); /* set characteristics */
-#endif
-}
-
-void
-resetty() /* restore previous tty stats */
-{
- int value;
-
-#ifdef SYS5
- value = ioctl(0, TCSETA, &Saved_tty); /* set characteristics */
-#else
- value = ioctl(0, TIOCSETP, &Saved_tty); /* set characteristics */
-#endif
-}
-
-void
-endwin() /* end windows */
-{
- keypad(stdscr, FALSE);
- free(stdscr);
- initialized = FALSE;
- delwin(curscr);
- delwin(virtual_scr);
- delwin(stdscr);
-#ifndef SYS5
-{
- int old_arg, value;
-/* old_arg = fcntl(0, F_GETFL, 0);
- value = fcntl(0, F_SETFL, old_arg & ~FNDELAY);*/
-}
-#endif
-}
-
-void
-delwin(window) /* delete the window structure */
-WINDOW *window;
-{
- int i;
-
- for (i = 1; (i < window->Num_lines) && (window->first_line->next_screen != NULL); i++)
- {
- window->first_line = window->first_line->next_screen;
- free(window->first_line->prev_screen->row);
- free(window->first_line->prev_screen->attributes);
- free(window->first_line->prev_screen);
- }
- if (window == last_window_refreshed)
- last_window_refreshed = 0;
- if (window->first_line != NULL)
- {
- free(window->first_line->row);
- free(window->first_line->attributes);
- free(window->first_line);
- free(window);
- }
-}
-
-#ifndef __STDC__
-void
-wprintw(va_alist)
-va_dcl
-#else /* __STDC__ */
-void
-wprintw(WINDOW *window, const char *format, ...)
-#endif /* __STDC__ */
-{
-#ifndef __STDC__
- WINDOW *window;
- char *format;
- va_list ap;
-#else
- va_list ap;
-#endif
- int value;
- char *fpoint;
- char *wtemp;
-
-#ifndef __STDC__
- va_start(ap);
- window = va_arg(ap, WINDOW *);
- format = va_arg(ap, char *);
-#else /* __STDC__ */
- va_start(ap, format);
-#endif /* __STDC__ */
-
- fpoint = (char *) format;
- while (*fpoint != (char) NULL)
- {
- if (*fpoint == '%')
- {
- fpoint++;
- if (*fpoint == 'd')
- {
- value = va_arg(ap, int);
- iout(window, value);
- }
- else if (*fpoint == 'c')
- {
- value = va_arg(ap, int);
- waddch(window, value);
- }
- else if (*fpoint == 's')
- {
- wtemp = va_arg(ap, char *);
- waddstr(window, wtemp);
- }
- fpoint++;
- }
- else if (*fpoint == '\\')
- {
- fpoint++;
- if (*fpoint == 'n')
- waddch(window, '\n');
- else if ((*fpoint >= '0') && (*fpoint <= '9'))
- {
- value = 0;
- while ((*fpoint >= '0') && (*fpoint <= '9'))
- {
- value = (value * 8) + (*fpoint - '0');
- fpoint++;
- }
- waddch(window, value);
- }
- fpoint++;
- }
- else
- waddch(window, *fpoint++);
- }
-#ifdef __STDC__
- va_end(ap);
-#endif /* __STDC__ */
-}
-
-void
-iout(window, value) /* output characters */
-WINDOW *window;
-int value;
-{
- int i;
-
- if ((i = value / 10) != 0)
- iout(window, i);
- waddch(window, ((value % 10) + '0'));
-}
-
-int
-Comp_line(line1, line2) /* compare lines */
-struct _line *line1;
-struct _line *line2;
-{
- int count1, count2;
- int i;
- char *att1, *att2;
- char *c1, *c2;
-
- c1 = line1->row;
- c2 = line2->row;
- att1 = line1->attributes;
- att2 = line2->attributes;
- count2 = strlen(c1) + 1;
- count1 = strlen(c2) + 1;
- if (count1 > count2)
- {
- i = count2;
- count2 = count1;
- count1 = i;
- }
- if (count2 > (count1 + count1))
- return(2);
- i = 0;
- while ((c1[i] != (char) NULL) && (c2[i] != (char) NULL) && (c1[i] == c2[i]) && (att1[i] == att2[i]))
- i++;
- count1 = i + 1;
- if ((count1 == 1) && (count2 == 1))
- count1 = 0; /* both lines blank */
- else if (count2 == count1)
- count1 = -1; /* equal */
- else
- count1 = count2 / count1; /* lines unequal */
- return(count1);
-}
-
-struct _line *
-Insert_line(row, end_row, window) /* insert line into screen */
-int row;
-int end_row;
-WINDOW *window;
-{
- int i;
- struct _line *tmp;
- struct _line *tmp1;
-
- for (i = 0, tmp = curscr->first_line; i < window->SR; i++)
- tmp = tmp->next_screen;
- if ((end_row + window->SR) == 0)
- curscr->first_line = curscr->first_line->next_screen;
- top_of_win = tmp;
- /*
- | find bottom line to delete
- */
- for (i = 0, tmp = top_of_win; (tmp->next_screen != NULL) && (i < end_row); i++)
- tmp = tmp->next_screen;
- if (tmp->prev_screen != NULL)
- tmp->prev_screen->next_screen = tmp->next_screen;
- if (tmp->next_screen != NULL)
- tmp->next_screen->prev_screen = tmp->prev_screen;
- tmp1 = tmp;
- /*
- | clear deleted line
- */
- clear_line(tmp, 0, window->Num_cols);
- tmp1->number = -1;
- for (i = 0, tmp = curscr->first_line; (tmp->next_screen != NULL) && (i < window->SR); i++)
- tmp = tmp->next_screen;
- top_of_win = tmp;
- for (i = 0, tmp = top_of_win; i < row; i++)
- tmp = tmp->next_screen;
- if ((tmp->prev_screen != NULL) && (window->Num_lines > 0))
- tmp->prev_screen->next_screen = tmp1;
- tmp1->prev_screen = tmp->prev_screen;
- tmp->prev_screen = tmp1;
- tmp1->next_screen = tmp;
- if ((row + window->SR) == 0)
- curscr->first_line = tmp1;
- if (tmp1->next_screen != NULL)
- tmp1 = tmp1->next_screen;
-
- if ((!String_table[cs__]) && (end_row < window->Num_lines))
- {
- Position(window, (window->SR + end_row), 0);
- String_Out(String_table[dl__], NULL, 0);
- }
- Position(window, (window->SR + row), 0);
- if (String_table[al__] != NULL)
- String_Out(String_table[al__], NULL, 0);
- else
- String_Out(String_table[sr__], NULL, 0);
-
- for (i = 0, top_of_win = curscr->first_line; (top_of_win->next_screen != NULL) && (i < window->SR); i++)
- top_of_win = top_of_win->next_screen;
- return(tmp1);
-}
-
-
-struct _line *
-Delete_line(row, end_row, window) /* delete a line on screen */
-int row;
-int end_row;
-WINDOW *window;
-{
- int i;
- struct _line *tmp;
- struct _line *tmp1;
- struct _line *tmp2;
-
- i = 0;
- tmp = curscr->first_line;
- while (i < window->SR)
- {
- i++;
- tmp = tmp->next_screen;
- }
- /*
- | find line to delete
- */
- top_of_win = tmp;
- if ((row + window->SR) == 0)
- curscr->first_line = top_of_win->next_screen;
- for (i = 0, tmp = top_of_win; i < row; i++)
- tmp = tmp->next_screen;
- if (tmp->prev_screen != NULL)
- tmp->prev_screen->next_screen = tmp->next_screen;
- if (tmp->next_screen != NULL)
- tmp->next_screen->prev_screen = tmp->prev_screen;
- tmp2 = tmp->next_screen;
- tmp1 = tmp;
- /*
- | clear deleted line
- */
- clear_line(tmp1, 0, window->Num_cols);
- tmp1->number = -1;
- /*
- | find location to insert deleted line
- */
- for (i = 0, tmp = curscr->first_line; (tmp->next_screen != NULL) && (i < window->SR); i++)
- tmp = tmp->next_screen;
- top_of_win = tmp;
- for (i = 0, tmp = top_of_win; (i < end_row) && (tmp->next_screen != NULL); i++)
- tmp = tmp->next_screen;
- tmp1->next_screen = tmp;
- tmp1->prev_screen = tmp->prev_screen;
- if (tmp1->prev_screen != NULL)
- tmp1->prev_screen->next_screen = tmp1;
- tmp->prev_screen = tmp1;
-
- Position(window, (window->SR + row), 0);
- String_Out(String_table[dl__], NULL, 0);
- if ((!String_table[cs__]) && (end_row < window->Num_lines))
- {
- Position(window, (window->SR + end_row), 0);
- String_Out(String_table[al__], NULL, 0);
- }
- else if ((String_table[cs__] != NULL) && (String_table[dl__] == NULL))
- {
- Position(window, (window->SR + end_row), 0);
- putchar('\n');
- }
-
- if (row == (window->Num_lines-1))
- tmp2 = tmp1;
- if ((row + window->SR) == 0)
- curscr->first_line = top_of_win = tmp2;
- return(tmp2);
-}
-
-void
-CLEAR_TO_EOL(window, row, column)
-WINDOW *window;
-int row, column;
-{
- int x, y;
- struct _line *tmp1;
-
- for (y = 0, tmp1 = curscr->first_line; (y < (window->SR+row)) && (tmp1->next_screen != NULL); y++)
- tmp1 = tmp1->next_screen;
- for (x = column; x<window->Num_cols; x++)
- {
- tmp1->row[x] = ' ';
- tmp1->attributes[x] = (char) NULL;
- }
- tmp1->row[column] = (char) NULL;
- tmp1->last_char = column;
- if (column < COLS)
- {
- if (STAND)
- {
- STAND = FALSE;
- Position(window, row, column);
- attribute_off();
- }
- if (String_table[ce__] != NULL)
- String_Out(String_table[ce__], NULL, 0);
- else
- {
- for (x = column; x < window->Num_cols; x++)
- putchar(' ');
- Curr_x = x;
- }
- }
-}
-
-int
-check_delete(window, line, offset, pointer_new, pointer_old)
-WINDOW *window;
-int line, offset;
-struct _line *pointer_new, *pointer_old;
-{
- int end_old;
- int end_new;
- int k;
- int changed;
- char *old_lin;
- char *new_lin;
- char *old_att;
- char *new_att;
-
- changed = FALSE;
- new_lin = pointer_new->row;
- new_att = pointer_new->attributes;
- old_lin = pointer_old->row;
- old_att = pointer_old->attributes;
- end_old = end_new = offset;
- while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (old_lin[end_old] != (char) NULL) && (new_lin[end_old] != (char) NULL))
- end_old++;
- if (old_lin[end_old] != (char) NULL)
- {
- k = 0;
- while ((old_lin[end_old+k] == new_lin[end_new+k]) && (new_att[end_new+k] == old_att[end_old+k]) && (new_lin[end_new+k] != (char) NULL) && (old_lin[end_old+k] != (char) NULL) && (k < 10))
- k++;
- if ((k > 8) || ((new_lin[end_new+k] == (char) NULL) && (k != 0)))
- {
- if (new_lin[end_new+k] == (char) NULL)
- {
- Position(window, line, (end_new+k));
- CLEAR_TO_EOL(window, line, (end_new+k));
- }
- Position(window, line, offset);
- for (k = offset; k < end_old; k++)
- Char_del(old_lin, old_att, offset, window->Num_cols);
- while ((old_lin[offset] != (char) NULL) && (offset < COLS))
- offset++;
- pointer_old->last_char = offset;
- changed = TRUE;
- }
- }
- return(changed);
-}
-
-int
-check_insert(window, line, offset, pointer_new, pointer_old)
-WINDOW *window;
-int line, offset;
-struct _line *pointer_new, *pointer_old;
-{
- int changed;
- int end_old, end_new;
- int k;
- int same = FALSE;
- int old_off;
- int insert;
- char *old_lin;
- char *new_lin;
- char *old_att;
- char *new_att;
-
- changed = FALSE;
- new_lin = pointer_new->row;
- new_att = pointer_new->attributes;
- old_lin = pointer_old->row;
- old_att = pointer_old->attributes;
- end_old = end_new = offset;
- while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (new_lin[end_new] != (char) NULL) && (old_lin[end_new] != (char) NULL))
- end_new++;
- if (new_lin[end_new] != (char) NULL)
- {
- k = 0;
- while ((old_lin[end_old+k] == new_lin[end_new+k]) && (old_att[end_old+k] == new_att[end_new+k]) && (new_lin[end_new+k] != (char) NULL) && (old_lin[end_old+k] != (char) NULL) && (k < 10))
- k++;
- /*
- | check for commonality between rest of lines (are the old
- | and new lines the same, except for a chunk in the middle?)
- | if the rest of the lines are common, do not insert text
- */
- old_off = end_new;
- while ((old_lin[old_off] != (char) NULL) && (new_lin[old_off] != (char) NULL) && (old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off]))
- old_off++;
- if ((old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off]))
- same = TRUE;
- if ((!same) && ((k > 8) || ((new_lin[end_new+k] == (char) NULL) && (k != 0))))
- {
- Position(window, line, offset);
- insert = FALSE;
- if (String_table[ic__] == NULL)
- {
- String_Out(String_table[im__], NULL, 0);
- insert = TRUE;
- }
- for (k = offset; k < end_new; k++)
- {
- if (!insert)
- String_Out(String_table[ic__], NULL, 0);
- Char_ins(old_lin, old_att, new_lin[k], new_att[k], k, window->Num_cols);
- }
- if (insert)
- String_Out(String_table[ei__], NULL, 0);
- while ((old_lin[offset] != (char) NULL) && (offset < COLS))
- offset++;
- pointer_old->last_char = offset;
- changed = TRUE;
- }
- }
- return(changed);
-}
-
-void
-doupdate()
-{
- WINDOW *window;
- int similar;
- int diff;
- int begin_old, begin_new;
- int end_old, end_new;
- int count1, j;
- int from_top, tmp_ft, offset;
- int changed;
- int first_time;
- int first_same;
- int last_same;
- int list[10];
-
- struct _line *curr;
- struct _line *virt;
- struct _line *old;
-
- struct _line *new;
-
- char *cur_lin;
- char *vrt_lin;
- char *cur_att;
- char *vrt_att;
- char *att1, *att2;
- char *c1, *c2;
-
- window = virtual_scr;
-
- if (Repaint_screen)
- {
- if (String_table[cl__])
- String_Out(String_table[cl__], NULL, 0);
- else
- {
- from_top = 0;
- while (from_top < LINES)
- {
- Position(curscr, from_top, 0);
- if (String_table[ce__] != NULL)
- String_Out(String_table[ce__], NULL, 0);
- else
- {
- for (j = 0; j < window->Num_cols; j++)
- putchar(' ');
- }
- from_top++;
- }
- }
- for (from_top = 0, curr = curscr->first_line; from_top < curscr->Num_lines; from_top++, curr = curr->next_screen)
- {
- Position(curscr, from_top, 0);
- for (j = 0; (curr->row[j] != (char) NULL) && (j < curscr->Num_cols); j++)
- {
- Char_out(curr->row[j], curr->attributes[j], curr->row, curr->attributes, j);
- }
- if (STAND)
- {
- STAND = FALSE;
- Position(curscr, from_top, j);
- attribute_off();
- }
- }
- Repaint_screen = FALSE;
- }
-
- similar = 0;
- diff = FALSE;
- top_of_win = curscr->first_line;
-
- for (from_top = 0, curr = top_of_win, virt = window->first_line;
- from_top < window->Num_lines; from_top++)
- {
- virtual_lines[from_top] = TRUE;
- if ((similar = Comp_line(curr, virt)) > 0)
- {
- virtual_lines[from_top] = FALSE;
- diff = TRUE;
- }
- curr = curr->next_screen;
- virt = virt->next_screen;
- }
-
- from_top = 0;
- virt = window->first_line;
- curr = top_of_win;
- similar = 0;
- /*
- | if the window has lines that are different
- */
- if (diff)
- {
- last_same = -1;
- changed = FALSE;
- for (first_same = window->Num_lines;
- (first_same > from_top) && (virtual_lines[first_same - 1]);
- first_same--)
- ;
- count1 = first_same - 1;
- for (last_same = 0;
- (last_same < window->Num_lines) && (virtual_lines[last_same]== FALSE);
- last_same++)
- ;
- while ((from_top < first_same) && nc_scrolling_ability)
- /* check entire lines for diffs */
- {
-
-
- if (from_top >= last_same)
- {
- for (last_same = from_top;
- (last_same < window->Num_lines) &&
- (virtual_lines[last_same] == FALSE);
- last_same++)
- ;
- }
- if (!virtual_lines[from_top])
- {
- diff = TRUE;
- /*
- | check for lines deleted (scroll up)
- */
- for (tmp_ft = from_top+1, old = curr->next_screen;
- ((window->scroll_up) && (diff) &&
- (tmp_ft < last_same) &&
- (!virtual_lines[tmp_ft]));
- tmp_ft++)
- {
- if ((Comp_line(old, virt) == -1) && (!virtual_lines[from_top]))
- {
- if (String_table[cs__]) /* scrolling region */
- {
- list[1] = from_top;
- list[0] = min((last_same - 1), (window->Num_lines - 1));
- String_Out(String_table[cs__], list, 2);
- Curr_y = Curr_x = -1;
- }
-
- for (offset = (tmp_ft - from_top); (offset > 0); offset--)
- {
- old = Delete_line(from_top, min((last_same - 1), (window->Num_lines - 1)), window);
- diff = FALSE;
- }
-
- if (String_table[cs__]) /* scrolling region */
- {
- list[1] = 0;
- list[0] = LINES;
- String_Out(String_table[cs__], list, 2);
- Curr_y = Curr_x = -1;
- }
-
- top_of_win = curscr->first_line;
- curr = top_of_win;
- for (offset = 0; offset < from_top; offset++)
- curr = curr->next_screen;
- for (offset = from_top, old=curr, new=virt;
- offset < window->Num_lines;
- old=old->next_screen, new=new->next_screen,
- offset++)
- {
- similar = Comp_line(old, new);
- virtual_lines[offset] = (similar > 0 ? FALSE : TRUE);
- }
- }
- else
- old = old->next_screen;
- }
- /*
- | check for lines inserted (scroll down)
- */
- for (tmp_ft = from_top-1, old = curr->prev_screen;
- ((window->scroll_down) && (tmp_ft >= 0) &&
- (diff) &&
- (!virtual_lines[tmp_ft]));
- tmp_ft--)
- {
- if (Comp_line(old, virt) == -1)
- {
- if (String_table[cs__]) /* scrolling region */
- {
- list[1] = tmp_ft;
- list[0] = min((last_same - 1), (window->Num_lines - 1));
- String_Out(String_table[cs__], list, 2);
- Curr_y = Curr_x = -1;
- }
-
- for (offset = (from_top - tmp_ft); (offset > 0); offset--)
- {
- old = Insert_line(tmp_ft, min((last_same - 1), (window->Num_lines -1)), window);
- diff = FALSE;
- }
-
- if (String_table[cs__]) /* scrolling region */
- {
- list[1] = 0;
- list[0] = LINES;
- String_Out(String_table[cs__], list, 2);
- Curr_y = Curr_x = -1;
- }
-
- top_of_win = curscr->first_line;
- curr = top_of_win;
- for (offset = 0; offset < from_top; offset++)
- curr = curr->next_screen;
- for (offset = from_top, old=curr, new=virt;
- offset < window->Num_lines;
- old=old->next_screen, new=new->next_screen,
- offset++)
- {
- similar = Comp_line(old, new);
- virtual_lines[offset] = (similar > 0 ? FALSE : TRUE);
- }
- }
- else
- old = old->prev_screen;
- }
- }
- from_top++;
- curr = curr->next_screen;
- virt = virt->next_screen;
- }
- }
-
- for (from_top = 0, curr = curscr->first_line; from_top < window->SR; from_top++)
- curr = curr->next_screen;
- top_of_win = curr;
- for (from_top = 0, curr = top_of_win, virt = window->first_line; from_top < window->Num_lines; from_top++, curr = curr->next_screen, virt = virt->next_screen)
- {
- if (((String_table[ic__]) || (String_table[im__])) && (String_table[dc__]) && (curr->row[0] != (char) NULL))
- {
- j = 0;
- first_time = TRUE;
- vrt_lin = virt->row;
- vrt_att = virt->attributes;
- cur_lin = curr->row;
- cur_att = curr->attributes;
- while ((vrt_lin[j] != (char) NULL) && (j < window->Num_cols))
- {
- if ((STAND) && (Booleans[xs__]))
- {
- while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != (char) NULL) && (vrt_att[j]))
- j++;
- if ((STAND) && (!vrt_att[j]))
- {
- STAND = FALSE;
- Position(window, from_top, j);
- attribute_off();
- attribute_off();
- }
- }
- else
- {
- while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != (char) NULL))
- j++;
- }
- if ((vrt_att[j] != cur_att[j]) && (cur_att[j]) && (Booleans[xs__]))
- {
- Position(window, from_top, j);
-/* CLEAR_TO_EOL(window, from_top, j);*/
- attribute_off();
- attribute_off();
- }
- if (vrt_lin[j] != (char) NULL)
- {
- begin_new = j;
- begin_old = j;
- end_old = j;
- end_new = j;
- if ((first_time) && (virt->changed))
- {
- if (curr->last_char <= virt->last_char)
- changed = check_insert(window, from_top, j, virt, curr);
- }
- changed = check_delete(window, from_top, j, virt, curr);
- first_time = FALSE;
- virt->changed = FALSE;
- if (!changed)
- changed = check_insert(window, from_top, j, virt, curr);
- if (((!changed) || (cur_lin[j] != vrt_lin[j]) || (cur_att[j] != vrt_att[j])) && (j < window->Num_cols))
- {
- if ((vrt_lin[j] == ' ') && (cur_lin[j] == (char) NULL) && (vrt_att[j] == cur_att[j]))
- cur_lin[j] = ' ';
- else
- {
- Position(window, from_top, j);
- Char_out(vrt_lin[j], vrt_att[j], cur_lin, cur_att, j);
- }
- }
- if ((vrt_lin[j] != (char) NULL))
- j++;
- }
- if ((STAND) && (!vrt_att[j]))
- {
- STAND = FALSE;
- Position(window, from_top, j);
- attribute_off();
- }
- }
- if ((vrt_lin[j] == (char) NULL) && (cur_lin[j] != (char) NULL))
- {
- Position(window, from_top, j);
- CLEAR_TO_EOL(window, from_top, j);
- }
- }
- else /*if ((similar != -1) && (similar != 0))*/
- {
- j = 0;
- c1 = curr->row;
- att1 = curr->attributes;
- c2 = virt->row;
- att2 = virt->attributes;
- while ((j < window->Num_cols) && (c2[j] != (char) NULL))
- {
- while ((c1[j] == c2[j]) && (att1[j] == att2[j]) && (j < window->Num_cols) && (c2[j] != (char) NULL))
- j++;
- begin_old = j;
- begin_new = j;
- if ((j < window->Num_cols) && (c2[j] != (char) NULL))
- {
- Position(window, from_top, begin_old);
- CLEAR_TO_EOL(window, from_top, j);
- Position(window, from_top, begin_old);
- for (j = begin_old; (c2[j] != (char) NULL) && (j < window->Num_cols); j++)
- Char_out(c2[j], att2[j], c1, att1, j);
- }
- }
- if ((c2[j] == (char) NULL) && (c1[j] != (char) NULL))
- {
- Position(window, from_top, j);
- CLEAR_TO_EOL(window, from_top, j);
- }
- }
- if (STAND)
- {
- STAND = FALSE;
- Position(window, from_top, j);
- attribute_off();
- }
- virt->number = from_top;
- }
- Position(window, window->LY, window->LX);
-}
-
-void
-Position(window, row, col) /* position the cursor for output on the screen */
-WINDOW *window;
-int row;
-int col;
-{
- int list[10];
- int place;
-
- int pos_row;
- int pos_column;
-
- pos_row = row + window->SR;
- pos_column = col + window->SC;
- if ((pos_row != Curr_y) || (pos_column != Curr_x))
- {
- if (String_table[cm__] != NULL) /* && (row < window->Num_lines) && (column < window->Num_cols))*/
- {
- place = 0;
- list[place++] = pos_column;
- list[place++] = pos_row;
- String_Out(String_table[cm__], list, place);
- if ((STAND) && (!Booleans[ms__]))
- attribute_on();
- }
- Curr_x = pos_column;
- Curr_y = pos_row;
- }
-}
-
-void
-Char_del(line, attrib, offset, maxlen) /* delete chars from line */
-char *line;
-char *attrib;
-int offset;
-int maxlen;
-{
- int one, two;
-
- for (one = offset, two = offset+1; (line[one] != (char) NULL) && (one < maxlen); one++, two++)
- {
- line[one] = line[two];
- attrib[one] = attrib[two];
- }
- String_Out(String_table[dc__], NULL, 0);
-}
-
-void
-Char_ins(line, attrib, newc, newatt, offset, maxlen) /* insert chars in line */
-char *line;
-char *attrib;
-char newc;
-char newatt;
-int offset;
-int maxlen;
-{
- int one, two;
-
- one = 0;
- while ((line[one] != (char) NULL) && (one < (maxlen - 2)))
- one++;
- for (two = one + 1; (two > offset); one--, two--)
- {
- line[two] = line[one];
- attrib[two] = attrib[one];
- }
- line[offset] = newc;
- attrib[offset] = newatt;
- Char_out(newc, newatt, line, attrib, offset);
-}
-
-void
-attribute_on()
-{
- if (String_table[sa__])
- {
- attributes_set[0] = 1;
- String_Out(String_table[sa__], attributes_set, 1);
- }
- else if (String_table[so__])
- String_Out(String_table[so__], NULL, 0);
-}
-
-void
-attribute_off()
-{
- if (String_table[me__])
- String_Out(String_table[me__], NULL, 0);
- else if (String_table[sa__])
- {
- attributes_set[0] = 0;
- String_Out(String_table[sa__], attributes_set, 1);
- }
- else if (String_table[se__])
- String_Out(String_table[se__], NULL, 0);
-}
-
-void
-Char_out(newc, newatt, line, attrib, offset) /* output character with proper attribute */
-char newc;
-char newatt;
-char *line;
-char *attrib;
-int offset;
-{
-
-
- if ((newatt) && (!STAND))
- {
- STAND = TRUE;
- attribute_on();
- }
- else if ((STAND) && (!newatt))
- {
- STAND = FALSE;
- attribute_off();
- }
-
- if ((newatt) && (STAND) && (Booleans[xs__]))
- {
- attribute_on();
- }
-
- if (!((Curr_y >= (LINES - 1)) && (Curr_x >= (COLS - 1))))
- {
- putchar(newc);
- line[offset] = newc;
- attrib[offset] = newatt;
- }
- Curr_x++;
-}
-
diff --git a/usr.bin/ee/new_curse.h b/usr.bin/ee/new_curse.h
deleted file mode 100644
index 86a8574da87b..000000000000
--- a/usr.bin/ee/new_curse.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- | new_curse.h
- |
- | A subset of curses developed for use with ae.
- |
- | written by Hugh Mahon
- |
- | THIS MATERIAL IS PROVIDED "AS IS". THERE ARE
- | NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
- | MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
- | IMPLIED WARRANTIES OF MERCHANTABILITY AND
- | FITNESS FOR A PARTICULAR PURPOSE. Neither
- | Hewlett-Packard nor Hugh Mahon shall be liable
- | for errors contained herein, nor for
- | incidental or consequential damages in
- | connection with the furnishing, performance or
- | use of this material. Neither Hewlett-Packard
- | nor Hugh Mahon assumes any responsibility for
- | the use or reliability of this software or
- | documentation. This software and
- | documentation is totally UNSUPPORTED. There
- | is no support contract available. Hewlett-
- | Packard has done NO Quality Assurance on ANY
- | of the program or documentation. You may find
- | the quality of the materials inferior to
- | supported materials.
- |
- | This software is not a product of Hewlett-Packard, Co., or any
- | other company. No support is implied or offered with this software.
- | You've got the source, and you're on your own.
- |
- | This software may be distributed under the terms of Larry Wall's
- | Artistic license, a copy of which is included in this distribution.
- |
- | This notice must be included with this software and any derivatives.
- |
- | Copyright (c) 1986, 1987, 1988, 1991, 1995 Hugh Mahon
- | All are rights reserved.
- |
- */
-
-#include <stdio.h>
-
-#ifdef SYS5
-#include <termio.h>
-#else
-#include <sgtty.h>
-#include <fcntl.h>
-#endif
-
-#define KEY_BREAK 0401
-#define KEY_DOWN 0402
-#define KEY_UP 0403
-#define KEY_LEFT 0404
-#define KEY_RIGHT 0405
-#define KEY_HOME 0406
-#define KEY_BACKSPACE 0407
-#define KEY_F0 0410
-#define KEY_F(n) (KEY_F0+(n))
-#define KEY_DL 0510
-#define KEY_IL 0511
-#define KEY_DC 0512
-#define KEY_IC 0513
-#define KEY_EIC 0514
-#define KEY_CLEAR 0515
-#define KEY_EOS 0516
-#define KEY_EOL 0517
-#define KEY_SF 0520
-#define KEY_SR 0521
-#define KEY_NPAGE 0522
-#define KEY_PPAGE 0523
-#define KEY_STAB 0524
-#define KEY_CTAB 0525
-#define KEY_CATAB 0526
-#define KEY_ENTER 0527
-#define KEY_SRESET 0530
-#define KEY_RESET 0531
-#define KEY_PRINT 0532
-#define KEY_LL 0533
-#define KEY_A1 0534
-#define KEY_A3 0535
-#define KEY_B2 0536
-#define KEY_C1 0537
-#define KEY_C3 0540
-#define KEY_BTAB 0541
-#define KEY_BEG 0542
-#define KEY_CANCEL 0543
-#define KEY_CLOSE 0544
-#define KEY_COMMAND 0545
-#define KEY_COPY 0546
-#define KEY_CREATE 0547
-#define KEY_END 0550
-#define KEY_EXIT 0551
-#define KEY_FIND 0552
-#define KEY_HELP 0553
-#define KEY_MARK 0554
-#define KEY_MESSAGE 0555
-#define KEY_MOVE 0556
-#define KEY_NEXT 0557
-#define KEY_OPEN 0560
-#define KEY_OPTIONS 0561
-#define KEY_PREVIOUS 0562
-#define KEY_REDO 0563
-#define KEY_REFERENCE 0564
-#define KEY_REFRESH 0565
-#define KEY_REPLACE 0566
-#define KEY_RESTART 0567
-#define KEY_RESUME 0570
-#define KEY_SAVE 0571
-#define KEY_SBEG 0572
-#define KEY_SCANCEL 0573
-#define KEY_SCOMMAND 0574
-#define KEY_SCOPY 0575
-#define KEY_SCREATE 0576
-#define KEY_SDC 0577
-#define KEY_SDL 0600
-#define KEY_SELECT 0601
-#define KEY_SEND 0602
-#define KEY_SEOL 0603
-#define KEY_SEXIT 0604
-#define KEY_SFIND 0605
-#define KEY_SHELP 0606
-#define KEY_SHOME 0607
-#define KEY_SIC 0610
-#define KEY_SLEFT 0611
-#define KEY_SMESSAGE 0612
-#define KEY_SMOVE 0613
-#define KEY_SNEXT 0614
-#define KEY_SOPTIONS 0615
-#define KEY_SPREVIOUS 0616
-#define KEY_SPRINT 0617
-#define KEY_SREDO 0620
-#define KEY_SREPLACE 0621
-#define KEY_SRIGHT 0622
-#define KEY_SRSUME 0623
-#define KEY_SSAVE 0624
-#define KEY_SSUSPEND 0625
-#define KEY_SUNDO 0626
-#define KEY_SUSPEND 0627
-#define KEY_UNDO 0630
-
-#define TRUE 1
-#define FALSE 0
-
-#define A_STANDOUT 0001 /* standout mode */
-#define SCROLL 1 /* text has been scrolled */
-#define CLEAR 2 /* window has been cleared */
-#define CHANGE 3 /* window has been changed */
-#define UP 1 /* direction of scroll */
-#define DOWN 2
-
-struct _line {
- struct _line *next_screen;
- struct _line *prev_screen;
- char *row;
- char *attributes;
- int last_char;
- int changed;
- int scroll;
- int number;
- };
-
-struct _line *top_of_win;
-
-typedef struct WIND {
- int SR; /* starting row */
- int SC; /* starting column */
- int LC; /* last column */
- int LX; /* last cursor column position */
- int LY; /* last cursor row position */
- int Attrib; /* attributes active in window */
- int Num_lines; /* number of lines */
- int Num_cols; /* number of columns */
- int scroll_up; /* number of lines moved */
- int scroll_down;
- int SCROLL_CLEAR; /* indicates that window has been scrolled or cleared */
- struct _line *first_line;
- } WINDOW;
-
-extern WINDOW *curscr;
-extern WINDOW *stdscr;
-
-extern int LINES, COLS;
-
-#if __STDC__ || defined(__cplusplus)
-#define P_(s) s
-#else
-#define P_(s) ()
-#endif
-
-extern void copy_window P_((WINDOW *origin, WINDOW *destination));
-extern void reinitscr P_((int));
-extern void initscr P_((void));
-extern int Get_int P_((void));
-extern int INFO_PARSE P_((void));
-extern int AtoI P_((void));
-extern void Key_Get P_((void));
-extern struct _line *Screenalloc P_((int columns));
-extern WINDOW *newwin P_((int lines, int cols, int start_l, int start_c));
-extern int Operation P_((int Temp_Stack[], int place));
-extern void Info_Out P_((char *string, int p_list[], int place));
-extern void wmove P_((WINDOW *window, int row, int column));
-extern void clear_line P_((struct _line *line, int column, int cols));
-extern void werase P_((WINDOW *window));
-extern void wclrtoeol P_((WINDOW *window));
-extern void wrefresh P_((WINDOW *window));
-extern void touchwin P_((WINDOW *window));
-extern void wnoutrefresh P_((WINDOW *window));
-extern void flushinp P_((void));
-extern void ungetch P_((int c));
-extern int wgetch P_((WINDOW *window));
-extern void Clear P_((int));
-extern int Get_key P_((int first_char));
-extern void waddch P_((WINDOW *window, int c));
-extern void winsertln P_((WINDOW *window));
-extern void wdeleteln P_((WINDOW *window));
-extern void wclrtobot P_((WINDOW *window));
-extern void wstandout P_((WINDOW *window));
-extern void wstandend P_((WINDOW *window));
-extern void waddstr P_((WINDOW *window, char *string));
-extern void clearok P_((WINDOW *window, int flag));
-extern void echo P_((void));
-extern void noecho P_((void));
-extern void raw P_((void));
-extern void noraw P_((void));
-extern void nl P_((void));
-extern void nonl P_((void));
-extern void saveterm P_((void));
-extern void fixterm P_((void));
-extern void resetterm P_((void));
-extern void nodelay P_((WINDOW *window, int flag));
-extern void idlok P_((WINDOW *window, int flag));
-extern void keypad P_((WINDOW *window, int flag));
-extern void savetty P_((void));
-extern void resetty P_((void));
-extern void endwin P_((void));
-extern void delwin P_((WINDOW *window));
-extern void wprintw P_((WINDOW *window, const char* format, ...));
-extern void iout P_((WINDOW *window, int value));
-extern int Comp_line P_((struct _line *line1, struct _line *line2));
-extern struct _line *Insert_line P_((int row, int end_row, WINDOW *window));
-extern struct _line *Delete_line P_((int row, int end_row, WINDOW *window));
-extern void CLEAR_TO_EOL P_((WINDOW *window, int row, int column));
-extern int check_delete P_((WINDOW *window, int line, int offset, struct _line *pointer_new, struct _line *pointer_old));
-extern int check_insert P_((WINDOW *window, int line, int offset, struct _line *pointer_new, struct _line *pointer_old));
-extern void doupdate P_((void));
-extern void Position P_((WINDOW *window, int row, int col));
-extern void Char_del P_((char *line, char *attrib, int offset, int maxlen));
-extern void Char_ins P_((char *line, char *attrib, int newc, int newatt, int offset, int maxlen));
-extern void attribute_on P_((void));
-extern void attribute_off P_((void));
-extern void Char_out P_((int newc, int newatt, char *line, char *attrib, int offset));
-
-#undef P_
-
diff --git a/usr.bin/file/Magdir/alpha b/usr.bin/file/Magdir/alpha
deleted file mode 100644
index 42e19176c98a..000000000000
--- a/usr.bin/file/Magdir/alpha
+++ /dev/null
@@ -1,21 +0,0 @@
-#------------------------------------------------------------------------------
-# alpha architecture description
-#
-
-0 leshort 0603 COFF format alpha
->22 leshort&030000 !020000 executable
->24 leshort 0410 pure
->24 leshort 0413 paged
->22 leshort&020000 !0 dynamically linked
->16 lelong !0 not stripped
->16 lelong 0 stripped
->22 leshort&030000 020000 shared library
->24 leshort 0407 object
->27 byte x - version %d
->26 byte x .%d
->28 byte x -%d
-
-# Basic recognition of OSF/1 core dumps - Mike Bremford <mike@opac.bl.uk>
-#
-0 string Core\001 COFF format core dump (OSF/1)
->24 string >\0 generated by '%s'
diff --git a/usr.bin/file/Magdir/amanda b/usr.bin/file/Magdir/amanda
deleted file mode 100644
index 57c4359fc169..000000000000
--- a/usr.bin/file/Magdir/amanda
+++ /dev/null
@@ -1,7 +0,0 @@
-#------------------------------------------------------------------------------
-# amanda: file(1) magic for amanda file format
-#
-0 string AMANDA:\ TAPESTART\ DATE AMANDA dump header file,
->23 string X
->>25 string >\ Unused %s
->23 string >\ DATE %s
diff --git a/usr.bin/file/Magdir/amigaos b/usr.bin/file/Magdir/amigaos
deleted file mode 100644
index 6073936e17bd..000000000000
--- a/usr.bin/file/Magdir/amigaos
+++ /dev/null
@@ -1,10 +0,0 @@
-#------------------------------------------------------------------------------
-# amigaos: file(1) magic for AmigaOS binary formats:
-
-#
-# From ignatios@cs.uni-bonn.de (Ignatios Souvatzis)
-# Some formats are still missing: AmigaOS special IFF's, e.g.: FORM....CTLG
-# (the others should be seperate, anyway)
-#
-0 belong 0x000003f3 AmigaOS loadseg()ble executable/binary
-0 belong 0x000003e7 AmigaOS object/library data
diff --git a/usr.bin/file/Magdir/asterix b/usr.bin/file/Magdir/asterix
deleted file mode 100644
index d89504a2407f..000000000000
--- a/usr.bin/file/Magdir/asterix
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#------------------------------------------------------------------------------
-# asterix: file(1) magic for Aster*x; SunOS 5.5.1 gave the 4-character
-# strings as "long" - we assume they're just strings:
-# From: guy@netapp.com (Guy Harris)
-#
-0 string *STA Aster*x
->7 string WORD Words Document
->7 string GRAP Graphic
->7 string SPRE Spreadsheet
->7 string MACR Macro
-0 string 2278 Aster*x Version 2
->29 byte 0x36 Words Document
->29 byte 0x35 Graphic
->29 byte 0x32 Spreadsheet
->29 byte 0x38 Macro
-
diff --git a/usr.bin/file/Magdir/digital b/usr.bin/file/Magdir/digital
deleted file mode 100644
index f4ebbff985bd..000000000000
--- a/usr.bin/file/Magdir/digital
+++ /dev/null
@@ -1,41 +0,0 @@
-# Digital UNIX - Info
-#
-0 string ^!<arch>\n_______64E Alpha archive
->22 string X -- out of date
-#
-# Alpha COFF Based Executables
-# The stripped stuff really needs to be an 8 byte (64 bit) compare,
-# but this works
-0 leshort 0x183 COFF format alpha
->22 leshort&020000 &010000 sharable library,
->22 leshort&020000 ^010000 dynamically linked,
->24 leshort 0410 pure
->24 leshort 0413 demand paged
->8 lelong >0 executable or object module, not stripped
->8 lelong 0
->>12 lelong 0 executable or object module, stripped
->>12 lelong >0 executable or object module, not stripped
->27 byte >0 - version %d.
->26 byte >0 %d-
->28 leshort >0 %d
-#
-# The next is incomplete, we could tell more about this format,
-# but its not worth it.
-0 leshort 0x188 Alpha compressed COFF
-0 leshort 0x18f Alpha u-code object
-#
-#
-# Some other interesting Digital formats,
-0 string \377\377\177 ddis/ddif
-0 string \377\377\174 ddis/dots archive
-0 string \377\377\176 ddis/dtif table data
-0 string \033c\033 LN03 output
-0 long 04553207 X image
-#
-0 string !<PDF>!\n profiling data file
-#
-# Locale data tables (MIPS and Alpha).
-#
-0 short 0x0501 locale data table
->6 short 0x24 for MIPS
->6 short 0x40 for Alpha
diff --git a/usr.bin/file/Magdir/island b/usr.bin/file/Magdir/island
deleted file mode 100644
index 9903cddf9217..000000000000
--- a/usr.bin/file/Magdir/island
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#------------------------------------------------------------------------------
-# island: file(1) magic for IslandWite/IslandDraw, from SunOS 5.5.1
-# "/etc/magic":
-# From: guy@netapp.com (Guy Harris)
-#
-4 string pgscriptver IslandWrite document
-13 string DrawFile IslandDraw document
-
diff --git a/usr.bin/file/Magdir/mach b/usr.bin/file/Magdir/mach
deleted file mode 100644
index 308325ee4e4e..000000000000
--- a/usr.bin/file/Magdir/mach
+++ /dev/null
@@ -1,38 +0,0 @@
-#------------------------------------------------------------------------------
-# mach file description
-#
-0 belong 0xcafebabe mach-o fat file
->4 belong 1 with 1 architecture
->4 belong >1
->>4 belong x with %ld architectures
-#
-0 belong 0xfeedface mach-o
->12 belong 1 object
->12 belong 2 executable
->12 belong 3 shared library
->12 belong 4 core
->12 belong 5 preload executable
->12 belong >5
->>12 belong x filetype=%ld
->4 belong <0
->>4 belong x architecture=%ld
->4 belong 1 vax
->4 belong 2 romp
->4 belong 3 architecture=3
->4 belong 4 ns32032
->4 belong 5 ns32332
->4 belong 6 for m68k architecture
->4 belong 7 i386
->4 belong 8 mips
->4 belong 9 ns32532
->4 belong 10 architecture=10
->4 belong 11 hp pa-risc
->4 belong 12 acorn
->4 belong 13 m88k
->4 belong 14 sparc
->4 belong 15 i860-big
->4 belong 16 i860
->4 belong 17 rs6000
->4 belong 18 powerPC
->4 belong >18
->>4 belong x architecture=%ld
diff --git a/usr.bin/file/Magdir/osf1 b/usr.bin/file/Magdir/osf1
deleted file mode 100644
index d2868c3dd7d4..000000000000
--- a/usr.bin/file/Magdir/osf1
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Mach magic number info
-#
-0 long 0xefbe OSF/Rose object
-# I386 magic number info
-#
-0 short 0565 i386 COFF object
-#
-0 string Core Alpha Digital UNIX core file
->24 string >\0 \b, generated from '%s'
diff --git a/usr.bin/file/Magdir/sniffer b/usr.bin/file/Magdir/sniffer
deleted file mode 100644
index 861ec8c85dd3..000000000000
--- a/usr.bin/file/Magdir/sniffer
+++ /dev/null
@@ -1,63 +0,0 @@
-
-#------------------------------------------------------------------------------
-# sniffer: file(1) magic for packet captured files
-#
-# From: guy@netapp.com (Guy Harris)
-#
-# Microsoft NetMon (packet capture/display program) capture files.
-#
-0 string RTSS NetMon capture file
->4 byte x - version %d
->5 byte x \b.%d
-#
-# Network General Sniffer capture files (the Sniffer software does,
-# after all, run under MS-DOS...).
-#
-0 string TRSNIFF\ data\ \ \ \ \032 Sniffer capture file
->23 leshort x - version %d
->25 leshort x \b.%d
->33 byte x (Format %d,
->32 byte 0 Token ring)
->32 byte 1 Ethernet)
->32 byte 2 ARCnet)
->32 byte 3 StarLAN)
->32 byte 4 PC Network broadband)
->32 byte 5 LocalTalk)
->32 byte 6 Znet)
-#
-# (We call them "tcpdump capture file(s)" for now, as "tcpdump" is
-# the main program that uses that format, but there's also "tcpview",
-# and there may be others in the future.)
-#
-0 ubelong 0xa1b2c3d4 tcpdump capture file (big-endian)
->4 beshort x - version %d
->6 beshort x \b.%d
->20 belong 0 (No link-layer encapsulation
->20 belong 1 (Ethernet
->20 belong 2 (3Mb Ethernet
->20 belong 3 (AX.25
->20 belong 4 (ProNet
->20 belong 5 (Chaos
->20 belong 6 (IEEE 802.x network
->20 belong 7 (ARCnet
->20 belong 8 (SLIP
->20 belong 9 (PPP
->20 belong 10 (FDDI
->20 belong 11 (RFC 1483 ATM
->16 belong x \b, capture length %d)
-0 ulelong 0xa1b2c3d4 tcpdump capture file (little-endian)
->4 leshort x - version %d
->6 leshort x \b.%d
->20 lelong 0 (No link-layer encapsulation
->20 lelong 1 (Ethernet
->20 lelong 2 (3Mb Ethernet
->20 lelong 3 (AX.25
->20 lelong 4 (ProNet
->20 lelong 5 (Chaos
->20 lelong 6 (IEEE 802.x network
->20 lelong 7 (ARCnet
->20 lelong 8 (SLIP
->20 lelong 9 (PPP
->20 lelong 10 (FDDI
->20 lelong 11 (RFC 1483 ATM
->16 lelong x \b, capture length %d)
diff --git a/usr.bin/file/Magdir/xenix b/usr.bin/file/Magdir/xenix
deleted file mode 100644
index 1acadec62a01..000000000000
--- a/usr.bin/file/Magdir/xenix
+++ /dev/null
@@ -1,72 +0,0 @@
-
-#------------------------------------------------------------------------------
-# xenix: file(1) magic for Microsoft Xenix
-#
-# "Middle model" stuff, and "Xenix 8086 relocatable or 80286 small
-# model" lifted from "magic.xenix", with comment "derived empirically;
-# treat as folklore until proven"
-#
-# "small model", "large model", "huge model" stuff lifted from XXX
-#
-# XXX - "x.out" collides with PDP-11 archives
-#
-0 string core core file (Xenix)
-0 byte 0x80 8086 relocatable (Microsoft)
-0 leshort 0xff65 x.out
->2 string __.SYMDEF randomized
->0 byte x archive
-0 leshort 0x206 Microsoft a.out
->8 leshort 1 Middle model
->0x1e leshort &0x10 overlay
->0x1e leshort &0x2 separate
->0x1e leshort &0x4 pure
->0x1e leshort &0x800 segmented
->0x1e leshort &0x400 standalone
->0x1e leshort &0x8 fixed-stack
->0x1c byte &0x80 byte-swapped
->0x1c byte &0x40 word-swapped
->0x10 lelong >0 not-stripped
->0x1e leshort ^0xc000 pre-SysV
->0x1e leshort &0x4000 V2.3
->0x1e leshort &0x8000 V3.0
->0x1c byte &0x4 86
->0x1c byte &0xb 186
->0x1c byte &0x9 286
->0x1c byte &0xa 386
->0x1f byte <0x040 small model
->0x1f byte =0x048 large model
->0x1f byte =0x049 huge model
->0x1e leshort &0x1 executable
->0x1e leshort ^0x1 object file
->0x1e leshort &0x40 Large Text
->0x1e leshort &0x20 Large Data
->0x1e leshort &0x120 Huge Objects Enabled
->0x10 lelong >0 not stripped
-
-0 leshort 0x140 old Microsoft 8086 x.out
->0x3 byte &0x4 separate
->0x3 byte &0x2 pure
->0 byte &0x1 executable
->0 byte ^0x1 relocatable
->0x14 lelong >0 not stripped
-
-0 lelong 0x206 b.out
->0x1e leshort &0x10 overlay
->0x1e leshort &0x2 separate
->0x1e leshort &0x4 pure
->0x1e leshort &0x800 segmented
->0x1e leshort &0x400 standalone
->0x1e leshort &0x1 executable
->0x1e leshort ^0x1 object file
->0x1e leshort &0x4000 V2.3
->0x1e leshort &0x8000 V3.0
->0x1c byte &0x4 86
->0x1c byte &0xb 186
->0x1c byte &0x9 286
->0x1c byte &0x29 286
->0x1c byte &0xa 386
->0x1e leshort &0x4 Large Text
->0x1e leshort &0x2 Large Data
->0x1e leshort &0x102 Huge Objects Enabled
-
-0 leshort 0x580 XENIX 8086 relocatable or 80286 small model
diff --git a/usr.bin/file/internat.c b/usr.bin/file/internat.c
deleted file mode 100644
index 59a508a4f75c..000000000000
--- a/usr.bin/file/internat.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "file.h"
-
-#include <string.h>
-
-#define F 0
-#define T 1
-
-/*
- * List of characters that look "reasonable" in international
- * language texts. That's almost all characters :), except a
- * few in the control range of ASCII (all the known international
- * charactersets share the bottom half with ASCII).
- */
-static char maybe_internat[256] = {
- F, F, F, F, F, F, F, F, T, T, T, T, T, T, F, F, /* 0x0X */
- F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x8X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x9X */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0xaX */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0xbX */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0xcX */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0xdX */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0xeX */
- T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T /* 0xfX */
-};
-
-/* Maximal length of a line we consider "reasonable". */
-#define MAXLINELEN 300
-
-int
-internatmagic(buf, nbytes)
- unsigned char *buf;
- int nbytes;
-{
- int i;
- unsigned char *cp;
-
- nbytes--;
-
- /* First, look whether there are "unreasonable" characters. */
- for (i = 0, cp = buf; i < nbytes; i++, cp++)
- if (!maybe_internat[*cp])
- return 0;
-
- /*
- * Now, look whether the file consists of lines of
- * "reasonable" length.
- */
-
- for (i = 0; i < nbytes;) {
- cp = memchr(buf, '\n', nbytes - i);
- if (cp == NULL) {
- /* Don't fail if we hit the end of buffer. */
- if (i + MAXLINELEN >= nbytes)
- break;
- else
- return 0;
- }
- if (cp - buf > MAXLINELEN)
- return 0;
- i += (cp - buf + 1);
- buf = cp + 1;
- }
- ckfputs("International language text", stdout);
- return 1;
-}
diff --git a/usr.bin/file/readelf.c b/usr.bin/file/readelf.c
deleted file mode 100644
index 2ae533b2bea7..000000000000
--- a/usr.bin/file/readelf.c
+++ /dev/null
@@ -1,318 +0,0 @@
-
-#ifdef BUILTIN_ELF
-#include <sys/types.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include "readelf.h"
-#include "file.h"
-
-static void doshn __P((int, off_t, int, size_t, char *));
-static void dophn_exec __P((int, off_t, int, size_t, char *));
-static void dophn_core __P((int, off_t, int, size_t, char *));
-
-static void
-doshn(fd, off, num, size, buf)
- int fd;
- off_t off;
- int num;
- size_t size;
- char *buf;
-{
- /*
- * This works for both 32-bit and 64-bit ELF formats,
- * because it looks only at the "sh_type" field, which is
- * always 32 bits, and is preceded only by the "sh_name"
- * field which is also always 32 bits, and because it uses
- * the shdr size from the ELF header rather than using
- * the size of an "Elf32_Shdr".
- */
- Elf32_Shdr *sh = (Elf32_Shdr *) buf;
-
- if (lseek(fd, off, SEEK_SET) == -1)
- error("lseek failed (%s).\n", strerror(errno));
-
- for ( ; num; num--) {
- if (read(fd, buf, size) == -1)
- error("read failed (%s).\n", strerror(errno));
- if (sh->sh_type == SHT_SYMTAB) {
- (void) printf (", not stripped");
- return;
- }
- }
- (void) printf (", stripped");
-}
-
-/*
- * Look through the program headers of an executable image, searching
- * for a PT_INTERP section; if one is found, it's dynamically linked,
- * otherwise it's statically linked.
- */
-static void
-dophn_exec(fd, off, num, size, buf)
- int fd;
- off_t off;
- int num;
- size_t size;
- char *buf;
-{
- /* I am not sure if this works for 64 bit elf formats */
- Elf32_Phdr *ph = (Elf32_Phdr *) buf;
-
- if (lseek(fd, off, SEEK_SET) == -1)
- error("lseek failed (%s).\n", strerror(errno));
-
- for ( ; num; num--) {
- if (read(fd, buf, size) == -1)
- error("read failed (%s).\n", strerror(errno));
- if (ph->p_type == PT_INTERP) {
- /*
- * Has an interpreter - must be a dynamically-linked
- * executable.
- */
- printf(", dynamically linked");
- return;
- }
- }
- printf(", statically linked");
-}
-
-size_t prpsoffsets[] = {
- 100, /* SunOS 5.x */
- 32, /* Linux */
-};
-
-#define NOFFSETS (sizeof prpsoffsets / sizeof prpsoffsets[0])
-
-/*
- * Look through the program headers of an executable image, searching
- * for a PT_NOTE section of type NT_PRPSINFO, with a name "CORE"; if one
- * is found, try looking in various places in its contents for a 16-character
- * string containing only printable characters - if found, that string
- * should be the name of the program that dropped core.
- * Note: right after that 16-character string is, at least in SunOS 5.x
- * (and possibly other SVR4-flavored systems) and Linux, a longer string
- * (80 characters, in 5.x, probably other SVR4-flavored systems, and Linux)
- * containing the start of the command line for that program.
- */
-static void
-dophn_core(fd, off, num, size, buf)
- int fd;
- off_t off;
- int num;
- size_t size;
- char *buf;
-{
- /*
- * This doesn't work for 64-bit ELF, as the "p_offset" field is
- * 64 bits in 64-bit ELF.
- */
- /*
- * This doesn't work for 64-bit ELF, as the "p_offset" field is
- * 64 bits in 64-bit ELF.
- */
- Elf32_Phdr *ph = (Elf32_Phdr *) buf;
- Elf32_Nhdr *nh;
- size_t offset, noffset, reloffset;
- unsigned char c;
- int i, j;
- char nbuf[BUFSIZ];
- int bufsize;
-
- for ( ; num; num--) {
- if (lseek(fd, off, SEEK_SET) == -1)
- error("lseek failed (%s).\n", strerror(errno));
- if (read(fd, buf, size) == -1)
- error("read failed (%s).\n", strerror(errno));
- off += size;
- if (ph->p_type != PT_NOTE)
- continue;
- if (lseek(fd, ph->p_offset, SEEK_SET) == -1)
- error("lseek failed (%s).\n", strerror(errno));
- bufsize = read(fd, nbuf, BUFSIZ);
- if (bufsize == -1)
- error("read failed (%s).\n", strerror(errno));
- offset = 0;
- for (;;) {
- if (offset >= bufsize)
- break;
- nh = (Elf32_Nhdr *)&nbuf[offset];
- offset += sizeof *nh;
-
- /*
- * If this note isn't an NT_PRPSINFO note, it's
- * not what we're looking for.
- */
- if (nh->n_type != NT_PRPSINFO) {
- offset += nh->n_namesz;
- offset = ((offset + 3)/4)*4;
- offset += nh->n_descsz;
- offset = ((offset + 3)/4)*4;
- continue;
- }
-
- /*
- * Make sure this note has the name "CORE".
- */
- if (offset + nh->n_namesz >= bufsize) {
- /*
- * We're past the end of the buffer.
- */
- break;
- }
- if (nh->n_namesz != 5
- || strcmp(&nbuf[offset], "CORE") != 0)
- continue;
- offset += nh->n_namesz;
- offset = ((offset + 3)/4)*4;
-
- /*
- * Extract the program name. We assume it to be
- * 16 characters (that's what it is in SunOS 5.x
- * and Linux).
- *
- * Unfortunately, it's at a different offset in
- * SunOS 5.x and Linux, so try multiple offsets.
- * If the characters aren't all printable, reject
- * it.
- */
- for (i = 0; i < NOFFSETS; i++) {
- reloffset = prpsoffsets[i];
- noffset = offset + reloffset;
- for (j = 0; j < 16;
- j++, noffset++, reloffset++) {
- /*
- * Make sure we're not past the end
- * of the buffer; if we are, just
- * give up.
- */
- if (noffset >= bufsize)
- return;
-
- /*
- * Make sure we're not past the
- * end of the contents; if we
- * are, this obviously isn't
- * the right offset.
- */
- if (reloffset >= nh->n_descsz)
- goto tryanother;
-
- c = nbuf[noffset];
- if (c != '\0' && !isprint(c))
- goto tryanother;
- }
-
- /*
- * Well, that worked.
- */
- printf(", from '%.16s'",
- &nbuf[offset + prpsoffsets[i]]);
- return;
-
- tryanother:
- ;
- }
- offset += nh->n_descsz;
- offset = ((offset + 3)/4)*4;
- }
- }
-}
-
-void
-tryelf(fd, buf, nbytes)
- int fd;
- char *buf;
- int nbytes;
-{
- union {
- int32 l;
- char c[sizeof (int32)];
- } u;
-
- /*
- * ELF executables have multiple section headers in arbitrary
- * file locations and thus file(1) cannot determine it from easily.
- * Instead we traverse thru all section headers until a symbol table
- * one is found or else the binary is stripped.
- */
- if (buf[EI_MAG0] != ELFMAG0 || buf[EI_MAG1] != ELFMAG1
- || buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
- return;
-
-
- if (buf[4] == ELFCLASS32) {
- Elf32_Ehdr elfhdr;
- if (nbytes <= sizeof (Elf32_Ehdr))
- return;
-
-
- u.l = 1;
- (void) memcpy(&elfhdr, buf, sizeof elfhdr);
- /*
- * If the system byteorder does not equal the
- * object byteorder then don't test.
- * XXX - we could conceivably fix up the "dophn_XXX()" and
- * "doshn()" routines to extract stuff in the right
- * byte order....
- */
- if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) {
- if (elfhdr.e_type == ET_CORE)
- dophn_core(fd, elfhdr.e_phoff, elfhdr.e_phnum,
- elfhdr.e_phentsize, buf);
- else {
- if (elfhdr.e_type == ET_EXEC) {
- dophn_exec(fd, elfhdr.e_phoff,
- elfhdr.e_phnum,
- elfhdr.e_phentsize, buf);
- }
- doshn(fd, elfhdr.e_shoff, elfhdr.e_shnum,
- elfhdr.e_shentsize, buf);
- }
- }
- return;
- }
-
- if (buf[4] == ELFCLASS64) {
- Elf64_Ehdr elfhdr;
- if (nbytes <= sizeof (Elf64_Ehdr))
- return;
-
-
- u.l = 1;
- (void) memcpy(&elfhdr, buf, sizeof elfhdr);
-
- /*
- * If the system byteorder does not equal the
- * object byteorder then don't test.
- * XXX - we could conceivably fix up the "dophn_XXX()" and
- * "doshn()" routines to extract stuff in the right
- * byte order....
- */
- if ((u.c[sizeof(long) - 1] + 1) == elfhdr.e_ident[5]) {
-#ifdef notyet
- if (elfhdr.e_type == ET_CORE)
- dophn_core(fd, elfhdr.e_phoff, elfhdr.e_phnum,
- elfhdr.e_phentsize, buf);
- else
-#endif
- {
-#ifdef notyet
- if (elfhdr.e_type == ET_EXEC) {
- dophn_exec(fd, elfhdr.e_phoff,
- elfhdr.e_phnum,
- elfhdr.e_phentsize, buf);
- }
-#endif
- doshn(fd, elfhdr.e_shoff, elfhdr.e_shnum,
- elfhdr.e_shentsize, buf);
- }
- }
- return;
- }
-}
-#endif
diff --git a/usr.bin/file/readelf.h b/usr.bin/file/readelf.h
deleted file mode 100644
index 853eed600f95..000000000000
--- a/usr.bin/file/readelf.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * readelf.h
- * @(#)$Id: readelf.h,v 1.1.1.1 1997/03/18 17:58:55 mpp Exp $
- *
- * Provide elf data structures for non-elf machines, allowing file
- * non-elf hosts to determine if an elf binary is stripped.
- * Note: cobbled from the linux header file, with modifications
- */
-#ifndef __fake_elf_h__
-#define __fake_elf_h__
-
-typedef unsigned int Elf32_Addr;
-typedef unsigned short Elf32_Half;
-typedef unsigned int Elf32_Off;
-typedef unsigned int Elf32_Word;
-typedef unsigned char Elf32_Char;
-
-/* XXX: We need 64 bit numbers here */
-typedef u_quad_t Elf64_Addr;
-typedef unsigned short Elf64_Half;
-typedef u_quad_t Elf64_Off;
-typedef unsigned int Elf64_Word;
-typedef unsigned char Elf64_Char;
-
-#define EI_NIDENT 16
-
-typedef struct {
- Elf32_Char e_ident[EI_NIDENT];
- Elf32_Half e_type;
- Elf32_Half e_machine;
- Elf32_Word e_version;
- Elf32_Addr e_entry; /* Entry point */
- Elf32_Off e_phoff;
- Elf32_Off e_shoff;
- Elf32_Word e_flags;
- Elf32_Half e_ehsize;
- Elf32_Half e_phentsize;
- Elf32_Half e_phnum;
- Elf32_Half e_shentsize;
- Elf32_Half e_shnum;
- Elf32_Half e_shstrndx;
-} Elf32_Ehdr;
-
-typedef struct {
- Elf64_Char e_ident[EI_NIDENT];
- Elf64_Half e_type;
- Elf64_Half e_machine;
- Elf64_Word e_version;
- Elf64_Addr e_entry; /* Entry point */
- Elf64_Off e_phoff;
- Elf64_Off e_shoff;
- Elf64_Word e_flags;
- Elf64_Half e_ehsize;
- Elf64_Half e_phentsize;
- Elf64_Half e_phnum;
- Elf64_Half e_shentsize;
- Elf64_Half e_shnum;
- Elf64_Half e_shstrndx;
-} Elf64_Ehdr;
-
-/* e_type */
-#define ET_EXEC 2
-#define ET_CORE 4
-
-/* sh_type */
-#define SHT_SYMTAB 2
-#define SHT_NOTE 7
-
-/* elf type */
-#define ELFDATANONE 0 /* e_ident[EI_DATA] */
-#define ELFDATA2LSB 1
-#define ELFDATA2MSB 2
-
-/* elf class */
-#define ELFCLASSNONE 0
-#define ELFCLASS32 1
-#define ELFCLASS64 2
-
-/* magic number */
-#define EI_MAG0 0 /* e_ident[] indexes */
-#define EI_MAG1 1
-#define EI_MAG2 2
-#define EI_MAG3 3
-#define EI_CLASS 4
-#define EI_DATA 5
-#define EI_VERSION 6
-#define EI_PAD 7
-
-#define ELFMAG0 0x7f /* EI_MAG */
-#define ELFMAG1 'E'
-#define ELFMAG2 'L'
-#define ELFMAG3 'F'
-#define ELFMAG "\177ELF"
-
-typedef struct {
- Elf32_Word p_type;
- Elf32_Off p_offset;
- Elf32_Addr p_vaddr;
- Elf32_Addr p_paddr;
- Elf32_Word p_filesz;
- Elf32_Word p_memsz;
- Elf32_Word p_flags;
- Elf32_Word p_align;
-} Elf32_Phdr;
-
-#define PT_NULL 0 /* p_type */
-#define PT_LOAD 1
-#define PT_DYNAMIC 2
-#define PT_INTERP 3
-#define PT_NOTE 4
-#define PT_SHLIB 5
-#define PT_PHDR 6
-#define PT_NUM 7
-
-typedef struct {
- Elf32_Word sh_name;
- Elf32_Word sh_type;
- Elf32_Word sh_flags;
- Elf32_Addr sh_addr;
- Elf32_Off sh_offset;
- Elf32_Word sh_size;
- Elf32_Word sh_link;
- Elf32_Word sh_info;
- Elf32_Word sh_addralign;
- Elf32_Word sh_entsize;
-} Elf32_Shdr;
-
-typedef struct {
- Elf64_Word sh_name;
- Elf64_Word sh_type;
- Elf64_Off sh_flags;
- Elf64_Addr sh_addr;
- Elf64_Off sh_offset;
- Elf64_Off sh_size;
- Elf64_Word sh_link;
- Elf64_Word sh_info;
- Elf64_Off sh_addralign;
- Elf64_Off sh_entsize;
-} Elf64_Shdr;
-
-/* Notes used in ET_CORE */
-#define NT_PRSTATUS 1
-#define NT_PRFPREG 2
-#define NT_PRPSINFO 3
-#define NT_TASKSTRUCT 4
-
-/* Note header in a PT_NOTE section */
-typedef struct elf_note {
- Elf32_Word n_namesz; /* Name size */
- Elf32_Word n_descsz; /* Content size */
- Elf32_Word n_type; /* Content type */
-} Elf32_Nhdr;
-
-typedef struct {
- Elf64_Word n_namesz;
- Elf64_Word n_descsz;
- Elf64_Word n_type;
-} Elf64_Nhdr;
-
-#define NT_PRSTATUS 1
-#define NT_PRFPREG 2
-#define NT_PRPSINFO 3
-#define NT_PRXREG 4
-#define NT_PLATFORM 5
-#define NT_AUXV 6
-
-#endif
diff --git a/usr.sbin/sendmail/cf/ostype/powerux.m4 b/usr.sbin/sendmail/cf/ostype/powerux.m4
deleted file mode 100644
index d0fd3dc28129..000000000000
--- a/usr.sbin/sendmail/cf/ostype/powerux.m4
+++ /dev/null
@@ -1,46 +0,0 @@
-divert(-1)
-#
-# Copyright (c) 1983 Eric P. Allman
-# Copyright (c) 1988, 1993
-# 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.
-#
-
-divert(0)
-VERSIONID(`@(#)powerux.m4 8.1 (Berkeley) 1/16/97')
-
-define(`ALIAS_FILE', /etc/mail/aliases)dnl
-ifdef(`HELP_FILE',,`define(`HELP_FILE', /etc/mail/sendmail.hf)')dnl
-ifdef(`STATUS_FILE',,`define(`STATUS_FILE', /etc/mail/sendmail.st)')dnl
-define(`LOCAL_MAILER_PATH', `/usr/bin/rmail')dnl
-define(`LOCAL_MAILER_FLAGS', `mn9')dnl
-define(`LOCAL_MAILER_ARGS', `rmail $u')dnl
-define(`LOCAL_SHELL_FLAGS', `ehuP')dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gmedium $h!rmail ($u)')dnl
diff --git a/usr.sbin/sendmail/cf/ostype/sinix.m4 b/usr.sbin/sendmail/cf/ostype/sinix.m4
deleted file mode 100644
index 7b50e9e2cc31..000000000000
--- a/usr.sbin/sendmail/cf/ostype/sinix.m4
+++ /dev/null
@@ -1,45 +0,0 @@
-divert(-1)
-#
-# Copyright (c) 1996 Eric P. Allman
-# Copyright (c) 1988, 1993
-# 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.
-#
-
-divert(0)
-VERSIONID(`@(#)sinix.m4 8.1 (Berkeley) 12/14/96')
-define(`QUEUE_DIR', /usr/ucblib/mqueue)dnl
-define(`ALIAS_FILE', /usr/ucblib/aliases)dnl
-ifdef(`HELP_FILE',,`define(`HELP_FILE', /usr/ucblib/sendmail.hf)')dnl
-ifdef(`STATUS_FILE',,`define(`STATUS_FILE', /usr/ucblib/sendmail.st)')dnl
-define(`LOCAL_MAILER_PATH', `/usr/ucblib/mail.local')dnl
-define(`LOCAL_MAILER_FLAGS', `rmn9')dnl
-define(`LOCAL_SHELL_FLAGS', `ehuP')dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gmedium $h!rmail ($u)')dnl
diff --git a/usr.sbin/vidcontrol/decode.h b/usr.sbin/vidcontrol/decode.h
deleted file mode 100644
index b939af4f369e..000000000000
--- a/usr.sbin/vidcontrol/decode.h
+++ /dev/null
@@ -1 +0,0 @@
-int decode(FILE *fd, char *buffer);